补充:
什么是闭环? 闭环(闭环结构)也叫反馈控制系统,是将系统输出量的测量值与所期望的给定值相比较,由此产生一个偏差信号,利用此偏差信号进行调节控制,使输出值尽量接近于期望值。
常见的有对电机的闭环控制驱动板:
示例:
<robot name="mbot">
<link name="base_link">
<visual>
<origin xyz=" 0 0 0 " rpy=" 0 0 0 " />
<geometry>
<cylinder length="0.16" radius="0.20" />
geometry>
<material name="yellow">
<color rgba="1 0.4 0 1" />
material>
visual>
link>
<joint name="left_wheel_joint" type="continuous">
<origin xyz="0 0.19 -0.05" rpy="0 0 0" />
<parent link="base_link" />
<child link="left_wheel_link" />
<axis xyz="0 1 0" />
joint>
<link name="left_wheel_link">
<visual>
<origin xyz="0 0 0" rpy="1.5707 0 0" />
<geometry>
<cylinder radius="0.06" length="0.025" />
geometry>
<material name="while">
<color rgba="1 1 1 0.9" />
material>
visual>
link>
robot>
刚体部分外观过于复杂时,可以使用SolidWorks建模,导出.stl文件
<link name="link_4">
<visual>
<geometry>
<mesh filename="link_4.stl" />
geometry>
<origin xyz="0 0 0" rpy="0 0 0" />
visual>
<collision>
<geometry>
<cylinder lenth="0.5" radius="0.1" />
geometry>
<origin xyz="0 0 -0.05" rpy="0 0 0" />
collision>
link>
关节类型 | 描述 |
---|---|
continuous | 旋转关节,可以围绕单轴无限旋转 |
revolute | 旋转关节,类似于continuous(如:机械臂) |
prismatic | 滑动关节,沿某一轴线移动的关节,带有位置极限 |
planar | 平面关节,允许在平面正交方向上平移或者旋转 |
floating | 浮动关节,允许进行平移、旋转运动 |
fixed | 固定关节,不允许运动的特殊关节(如:桌腿) |
<joint name="joint_2" type="revolute">
<parent link="link_1" />
<child link="link_2" />
<origin xyz="0.2 0.2 0" rpy="0 0 0" />
<axis xyz="0 0 1" />
<limit lower="-3.14" upper="3.14" velocity="1.0" />
joint>
<robot name="" >
<link> ...... link>
<link> ...... link>
<joint> ...... joint>
<joint> ...... joint>
robot>
$ catkin_create_pkg mbot_description urdf xacro
首先,在udrf文件夹下创建底盘文件
$ touch mbot_base.urdf
开始码…
<robot name="mbot">
<link name="base_link">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<cylinder length="0.16" radius="0.20" />
geometry>
<material name="yellow" >
<color rgba="1 0.4 0 1" />
material>
visual>
link>
robot>
这时已经得到了一个这个颜色的圆柱体(查rgba色彩工具),随后使用 .launch 文件将该模型在rviz中显示出来。
<launch>
<param name="robot_description" textfile="$(find mbot_description)/urdf/mbot_base.urdf" />
<param name="use_gui" value="true" />
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
<node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" />
<node name="rviz" pkg="rviz" type="rviz" args="-d $(find mbot_description)/config/mbot_urdf.rviz" required="true" />
launch>
在上面
<joint name="left_wheel_joint" type="continuous">
<origin xyz="0 0.19 -0.05" rpy="0 0 0">
<parent link="base_link" />
<child link="left_wheel_link" />
<axis xyz="0 1 0" />
joint>
<link name="left_wheel_link">
<visual>
<origin xyz="0 0 0" rpy="1.5707 0 0" />
<geometry>
<cylinder radius="0.06" length="0.025" />
geometry>
<material name="white" >
<color rgba="1 1 1 0.9" />
material>
visual>
link>
<joint name="right_wheel_joint" type="continuous" />
<origin xyz="0 -0.19 -0.05" rpy="0 0 0"/>
<parent name="base_link" />
<child name="right_wheel_link" />
<axis xyz="0 1 0" />
joint>
<link name="right_wheel_link">
<visual>
<origin xyz="0 0 0" rpy="1.5707 0 0" />
<geometry>
<cylinder radius="0.06" length="0.025" />
geometry>
<material name="white" >
<color rgba="1 1 1 0.9" />
material>
visual>
link>
<joint name="front_caster_joint" type="continuous" />
<origin xyz="0.18 0 -0.095" rpy="0 0 0"/>
<parent name="base_link" />
<child name="front_caster_link" />
<axis xyz="0 1 0" />
joint>
<link name="front_caster_link">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<sphere radius="0.015" />
geometry>
<material name="black" >
<color rgba="0 0 0 0.95" />
material>
visual>
link>
<joint name="back_caster_joint" type="continuous" />
<origin xyz="-0.18 0 -0.095" rpy="0 0 0"/>
<parent name="base_link" />
<child name="back_caster_link" />
<axis xyz="0 1 0" />
joint>
<link name="back_caster_link">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<sphere radius="0.015" />
geometry>
<material name="black" >
<color rgba="0 0 0 0.95" />
material>
visual>
link>
首先将网盘中文件放入meshes文件夹内
链接: https://pan.baidu.com/s/1vER7NlLcjuIXuj04ni1Y0A 密码: 9p9v
编辑一个.urdf文件,这里就不将修改后的.launch文件贴出了,仅在
<param name="robot_discription" textfile="$(find mbot_discription)/urdf/mbot_with_kinect.urdf" />
做出相对要显示模型的.urdf文件的路径修改即可。
mbot_with_kinect.urdf(完整版):
<robot name="mbot">
<link name="base_link">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<cylinder length="0.16" radius="0.20" />
geometry>
<material name="yellow" >
<color rgba="1 0.4 0 1" />
material>
visual>
link>
<joint name="left_wheel_joint" type="continuous">
<origin xyz="0 0.19 -0.05" rpy="0 0 0">
<parent link="base_link" />
<child link="left_wheel_link" />
<axis xyz="0 1 0" />
joint>
<link name="left_wheel_link">
<visual>
<origin xyz="0 0 0" rpy="1.5707 0 0" />
<geometry>
<cylinder radius="0.06" length="0.025" />
geometry>
<material name="white" >
<color rgba="1 1 1 0.9" />
material>
visual>
link>
<joint name="right_wheel_joint" type="continuous" />
<origin xyz="0 -0.19 -0.05" rpy="0 0 0"/>
<parent name="base_link" />
<child name="right_wheel_link" />
<axis xyz="0 1 0" />
joint>
<link name="right_wheel_link">
<visual>
<origin xyz="0 0 0" rpy="1.5707 0 0" />
<geometry>
<cylinder radius="0.06" length="0.025" />
geometry>
<material name="white" >
<color rgba="1 1 1 0.9" />
material>
visual>
link>
<joint name="front_caster_joint" type="continuous" />
<origin xyz="0.18 0 -0.095" rpy="0 0 0"/>
<parent name="base_link" />
<child name="front_caster_link" />
<axis xyz="0 1 0" />
joint>
<link name="front_caster_link">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<sphere radius="0.015" />
geometry>
<material name="black" >
<color rgba="0 0 0 0.95" />
material>
visual>
link>
<joint name="back_caster_joint" type="continuous" />
<origin xyz="-0.18 0 -0.095" rpy="0 0 0"/>
<parent name="base_link" />
<child name="back_caster_link" />
<axis xyz="0 1 0" />
joint>
<link name="back_caster_link">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<sphere radius="0.015" />
geometry>
<material name="black" >
<color rgba="0 0 0 0.95" />
material>
visual>
link>
<joint name="kinect_joint" type="fixed">
<origin xyz="0.15 0 0.11" rpy="0 0 0" />
<parent link="base_link" />
<child link="kinect_link" />
joint>
<link name="kinect_link" >
<visual>
<origin xyz="0 0 0" rpy="0 0 1.5708" />
<geometry>
<mesh filename="package://mbot_description/meshes/kinect.dae" />
geometry>
visual>
link>
robot>
$ urdf_to_graphiz mbot_base.urdf
链接: https://pan.baidu.com/s/1cOaxROGak5TVpfg2hd_7Lw
密码: sn72
内容大概就是这样,忘记的内容会继续作补充,下一期ヾ( ̄▽ ̄)ByeBye