环境:ubuntu18
安装ArbotiX控制器
sudo apt-get install ros-indigo-arbotix
sudo apt-get install ros-indigo-arbotix-*
编辑launch文件
新增加2个文件:
arbotix_mybot_with_laser.launch
fake_mybot_arbotix.yaml
mybot_description/
├── CMakeLists.txt
├── config
│ ├── fake_mybot_arbotix.yaml
│ └── mybot_urdf.rviz
├── launch
│ ├── arbotix
│ │ └── arbotix_mybot_with_laser.launch
│ └── xacro
│ ├── display_mybot_base_xacro.launch
│ └── display_mybot_with_laser.launch
├── package.xml
└── urdf
├── urdf
│ ├── mybot_base.urdf
│ └── mybot_with_laser.urdf
└── xacro
├── laser.xacro
├── mybot_base.xacro
├── mybot_with_laser.xacro
└── mybot.xacro
arbotix_mybot_with_laser.launch
:
<launch>
<param name="/use_sim_time" value="false" />
<!-- 加载机器人URDF/Xacro模型 -->
<arg name="model" default="$(find xacro)/xacro --inorder '$(find mybot_description)/urdf/xacro/mybot_with_laser.xacro'" />
<arg name="gui" default="true" />
<param name="robot_description" command="$(arg model)" />
<!-- 设置GUI参数,显示关节控制插件 -->
<param name="use_gui" value="$(arg gui)"/>
<!-- arbotix -->
<node name="arbotix" pkg="arbotix_python" type="arbotix_driver" output="screen">
<rosparam file="$(find mybot_description)/config/fake_mybot_arbotix.yaml" command="load" />
<param name="sim" value="true"/>
</node>
<!-- 运行joint_state_publisher节点,发布机器人的关节状态 -->
<node name="joint_state_publisher_gui" pkg="joint_state_publisher_gui" type="joint_state_publisher_gui" />
<!-- 运行robot_state_publisher节点,发布tf -->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher">
<param name="publish_frequency" type="double" value="20.0" />
</node>
<!-- 运行rviz可视化界面 -->
<node name="rviz" pkg="rviz" type="rviz" args="-d $(find mybot_description)/config/mybot_urdf.rviz" required="true" />
</launch>
fake_mybot_arbotix.yaml
:
controllers: {
base_controller: {
type: diff_controller,
base_frame_id: base_footprint,
base_width: 0.26,
ticks_meter: 4100,
Kp: 12,
Kd: 12,
Ki: 0,
Ko: 50,
accel_limit: 1.0 }
}
运行launch文件
roslaunch mybot_description arbotix_mybot_with_laser.launch
ubuntu@ubuntu-vpv:~$ rostopic list
/clicked_point
/cmd_vel
/diagnostics
/initialpose
/joint_states
/move_base_simple/goal
/odom
/rosout
/rosout_agg
/tf
/tf_static
发布速度
ubuntu@ubuntu-vpv:~$ rostopic pub /cmd_vel geometry_msgs/Twist "linear:
x: 0.3
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 0.3"
疑问:
Joint state with name: "base_l_wheel_joint" was received but not found in URDF