您的位置:首页 > 房产 > 建筑 > 个人网站设计成首页_黑龙江省特种证查询_西安关键词推广_免费的行情网站app软件

个人网站设计成首页_黑龙江省特种证查询_西安关键词推广_免费的行情网站app软件

2025/7/8 0:11:05 来源:https://blog.csdn.net/bohu83/article/details/145113450  浏览:    关键词:个人网站设计成首页_黑龙江省特种证查询_西安关键词推广_免费的行情网站app软件
个人网站设计成首页_黑龙江省特种证查询_西安关键词推广_免费的行情网站app软件

ros2-6.4.4 两轮差速控制机器人的问题-CSDN博客

上次遇到的问题,经过查看ros2 node list 之后,发现有多个

/robot_state_publisher

这是不正常的,应该是我看视频6.2 的没有及时关闭导致冲突了。

没有修改代码,单纯的重启就解决了。正常显示TF tree 如下:

小鱼老师在视频解释过,left_wheel_link 、right_wheel_link 两个轮子在base_footprint下是差速控制插件发布的。

此时,能正常看到轮子的tf轴转动。

<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro"><xacro:macro name="gazebo_control_plugin"><gazebo><plugin name='diff_drive' filename='libgazebo_ros_diff_drive.so'><ros><namespace>/</namespace><remapping>cmd_vel:=cmd_vel</remapping><remapping>odom:=odom</remapping></ros><update_rate>30</update_rate><!-- wheels --><left_joint>left_wheel_joint</left_joint><right_joint>right_wheel_joint</right_joint><!-- kinematics --><wheel_separation>0.2</wheel_separation><wheel_diameter>0.064</wheel_diameter><!-- limits --><max_wheel_torque>20</max_wheel_torque><max_wheel_acceleration>1.0</max_wheel_acceleration><!-- output --><publish_odom>true</publish_odom><publish_odom_tf>true</publish_odom_tf><publish_wheel_tf>true</publish_wheel_tf><odometry_frame>odom</odometry_frame><robot_base_frame>base_footprint</robot_base_frame></plugin></gazebo></xacro:macro>
</robot>

补充下差速控制的参数含义,就是书上6-1 表格。

配置项含义
rosros相关配置,包含命名空间和话题重映射等
update_rate数据更新速率
left_joint左轮关节名称
right_joint右轮关节名称
wheel_separation左右轮子的间距
wheel_diameter轮子的直径
max_wheel_torque轮子最大的力矩
max_wheel_acceleration轮子最大的加速度
publish_odom是否发布里程计
publish_odom_tf是否发布里程计的tf开关
publish_wheel_tf是否发布轮子的tf数据开关
odometry_frame里程计的framed ID,最终体现在话题和TF上
robot_base_frame机器人的基础frame的ID

一些 控制信息;

cmd_vel 就是

bohu@bohu-TM1701:~$ ros2 topic echo /cmd_vel
linear:x: 0.5y: 0.0z: 0.0
angular:x: 0.0y: 0.0z: 0.0
---
linear:x: 0.0y: 0.0z: 0.0
angular:x: 0.0y: 0.0z: 0.0

里程计信息默认的输出话题为odom,查看信息:

    header,表示该消息发布的时间
    pose,表示当前机器人位置和朝向
    twist,表示当前机器人的线速度和角速度

covariance 协方差矩阵信息,小鱼老师说以后讲。在rviz里面Odometry关闭了,没有勾选。

header:stamp:sec: 4564nanosec: 469000000frame_id: odom
child_frame_id: base_footprint
pose:pose:position:x: -1.786928065906287y: -0.8138664866993258z: 0.0009999934627118873orientation:x: 3.9145606329839545e-08y: 1.401121596460272e-07z: -0.96438294476112w: -0.2645099919735544covariance:- 1.0e-05- 0.0- 0.0- 0.0- 0.0- 0.0- 0.0- 1.0e-05- 0.0- 0.0- 0.0- 0.0- 0.0- 0.0- 1000000000000.0- 0.0- 0.0- 0.0- 0.0- 0.0- 0.0- 1000000000000.0- 0.0- 0.0- 0.0- 0.0- 0.0- 0.0- 1000000000000.0- 0.0- 0.0- 0.0- 0.0- 0.0- 0.0- 0.001
twist:twist:linear:x: -1.6229530798319845e-05y: -3.1758267246886164e-05z: 0.0angular:x: 0.0y: 0.0z: -9.914752588517208e-05covariance:- 1.0e-05- 0.0- 0.0- 0.0- 0.0- 0.0- 0.0- 1.0e-05- 0.0- 0.0- 0.0- 0.0- 0.0- 0.0- 1000000000000.0- 0.0- 0.0- 0.0- 0.0- 0.0- 0.0- 1000000000000.0- 0.0- 0.0- 0.0- 0.0- 0.0- 0.0- 1000000000000.0- 0.0- 0.0- 0.0- 0.0- 0.0- 0.0- 0.001
---
header:stamp:sec: 4564nanosec: 503000000frame_id: odom
child_frame_id: base_footprint

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com