ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

DAY-9 综合应用 机器人运动控制以及里程计信息显示

2022-01-09 22:02:58  阅读:219  来源: 互联网

标签:teleop true 机器人 里程计 twist link keyboard gazebo DAY


URDF、Gazebo与Rviz 现在终于百川汇海,综合应用拉!

URDF、Gazebo与Rviz综合应用-文档

第一个重要的概念:ros_control 类比手机的typc接口,什么型号都适用。

机器人运动控制

还没运行就报错了非常不爽:解决运行gazebo时出现gazebo-2process has died pid 7920, exit code 255…的问题
在上一节的基础上,集成运动控制即可。

<robot name="my_car_camera" xmlns:xacro="http://wiki.ros.org/xacro">
    <!-- 包含惯性矩阵文件 -->
    <xacro:include filename="head.xacro" />
    <!-- 组合小车底盘与摄像头与雷达 -->
    <xacro:include filename="my_base.urdf.xacro" />
    <xacro:include filename="my_camera.urdf.xacro" />
    <xacro:include filename="my_laser.urdf.xacro" />
    <!-- 集成运动控制 -->
    <xacro:include filename="gazebo/move.xacro" />
</robot>

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">
            ...
        </transmission>
    </xacro:macro>

    <!-- 每一个驱动轮都需要配置传动装置 -->
    <xacro:joint_trans joint_name="left_2base_link" />
    <xacro:joint_trans joint_name="right_2base_link" />




<!-- 第2部分,根据自己定义的参数,进行修改,需要细心 -->
    <!-- 差速控制器  适用于两轮模型 -->
    <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_2base_link</leftJoint> <!-- 左轮 -->
            <rightJoint>right_2base_link</rightJoint> <!-- 右轮 -->
            <wheelSeparation>${base_link_radius * 2}</wheelSeparation> <!-- 车轮间距 -->
            <wheelDiameter>${wheel_radius * 2}</wheelDiameter> <!-- 车轮直径 -->
            <broadcastTF>1</broadcastTF>
            <wheelTorque>30</wheelTorque>
            <wheelAcceleration>1.8</wheelAcceleration>
            <commandTopic>cmd_vel</commandTopic> <!-- 运动控制话题 -->
            <odometryFrame>odom</odometryFrame> 
            <odometryTopic>odom</odometryTopic> <!-- 里程计话题 -->
            <robotBaseFrame>base_footprint</robotBaseFrame> <!-- 根坐标系 -->
        </plugin>
    </gazebo>

</robot>

我在进行修改的时候,会打印出节点图,对照着改,感觉很有用。
在这里插入图片描述之后,我们就可以在gazebo中用键盘控制小车运动了:rosrun teleop_twist_keyboard teleop_twist_keyboard.py 如果找不到这个命令,那就需要安装:sudo apt-get install ros-noetic-teleop-twist-keyboard

标签:teleop,true,机器人,里程计,twist,link,keyboard,gazebo,DAY
来源: https://blog.csdn.net/weixin_45942372/article/details/122398992

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有