所用的学习链接:
【奥特学园】ROS机器人入门课程《ROS理论与实践》零基础教程P278-288
【以上视频笔记见http://www.autolabor.com.cn/book/ROSTutorials/】
官方参考链接:http://gazebosim.org/tutorials?tut=ros_gzplugins
前文参考
ROS入门(六)——仿真机器人二(Xacro+Rviz+Arbotix小车运动)
ROS入门(七)——仿真机器人三(Gazebo+Xacro)
一、介绍
1.目标
1.运动控制以及里程计信息显示
2.雷达信息仿真以及显示
3.摄像头信息仿真以及显示
4.kinect 信息仿真以及显示
2.ros_control
为了提高机器人系统在不同平台上的可移植性,ROS内置了一个解决方案ros_control。包含了各种接口以实现不同平台上的机器人系统兼容,提高程序的效率和灵活性。
二、实操流程
1.运动控制
(1)运动控制 t6_move.xacro文件
在前面章节中已经创建了一个机器人模型,接下来需要编写一个单独的 xacro 文件【t6_move.xacro】,为机器人模型添加传动装置以及控制器
<!-- 文件内容:实现两轮差速配置 -->
<robot name="my_car_move" xmlns:xacro="http://wiki.ros.org/xacro">
<!-- 传动实现:用于连接控制器与关节 -->
<xacro:macro name="joint_trans" params="joint_name">
<!-- Transmission is important to link the joints and the controller -->
<transmission name="${joint_name}_trans">
<type>transmission_interface/SimpleTransmission</type>
<joint name="${joint_name}">
<hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
</joint>
<actuator name="${joint_name}_motor">
<hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
<mechanicalReduction>1</mechanicalReduction>
</actuator>
</transmission>
</xacro:macro>
<!-- 每一个驱动轮都需要配置传动装置 -->
<xacro:joint_trans joint_name="left_wheel2base_link" />
<xacro:joint_trans joint_name="right_wheel2base_link" />
<!-- 控制器 -->
<gazebo>
<plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so">
<rosDebugLevel>Debug</rosDebugLevel>
<publishWheelTF>true</publishWheelTF>
<robotNamespace>/</robotNamespace>
<publishTf>1</publishTf>
<publishWheelJointState>true</publishWheelJointState>
<alwaysOn>true</alwaysOn>
<updateRate>100.0</updateRate>
<legacyMode>true</legacyMode>
<leftJoint>left_wheel2base_link</leftJoint> <!-- 左轮 -->
<rightJoint>right_wheel2base_link</rightJoint> <!-- 右轮 -->
<wheelSeparation>${base_link_radius * 2}</wheelSeparation> <!-- 车轮间距 -->
<wheelDiameter>${wheel_radius * 2}</wheelDiameter> <!-- 车轮直径 -->
<broadcastTF>1</broadcastTF>
<wheelTorque>30</wheelTorque>
<wheelAcceleration>1.8</wheelAcceleration>
<com

本文介绍了如何使用ROS进行机器人仿真,包括运动控制、里程计信息显示、雷达和摄像头信息的仿真。通过ROS内置的ros_control实现不同平台的兼容性,使用Gazebo进行场景模拟,并通过xacro文件配置机器人模型和传感器。在rviz中展示了雷达扫描和摄像头图像,还涉及了Kinect摄像头的深度信息仿真。
最低0.47元/天 解锁文章
414





