鱼香ROS社区
    • 版块
    • 最新
    • 未解决
    • 已解决
    • 群组
    • 注册
    • 登录
    紧急通知:禁止一切关于政治&VPN翻墙等话题,发现相关帖子会立马删除封号
    提问前必看的发帖注意事项: 社区问答规则(小鱼个人)更新 | 高质量帖子发布指南

    ros-noetic四轮差速小车gazebo仿真,在rviz中车轮不转

    已定时 已固定 已锁定 已移动
    ROS2机器人开发:从入门到实践
    四轮差速 控制器 车轮不转
    4
    5
    662
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • Z
      zxcmoonss
      最后由 编辑

      <gazebo>
      <plugin name="skid_steer_drive_controller" filename="libgazebo_ros_skid_steer_drive.so">
      <updateRate>100.0</updateRate>
      <robotNamespace>/</robotNamespace>
      <leftFrontJoint>wheel_lf_2_base</leftFrontJoint>
      <rightFrontJoint>wheel_rf_2_base</rightFrontJoint>
      <leftRearJoint>wheel_lb_2_base</leftRearJoint>
      <rightRearJoint>wheel_rb_2_base</rightRearJoint>
      <wheelSeparation>0.584</wheelSeparation>
      <wheelDiameter>0.33</wheelDiameter>
      <robotBaseFrame>base_footprint</robotBaseFrame>
      <torque>50</torque>
      <commandTopic>cmd_vel</commandTopic>
      <odometryTopic>odom</odometryTopic>
      <odometryFrame>odom</odometryFrame>
      <publish_wheel_tf>true</publish_wheel_tf>
      <broadcastTF>true</broadcastTF>
      </plugin>
      </gazebo>
      使用该控制器,发现在rviz中车轮的tf坐标不会转动,为什么,如何解决

      小鱼小 1 条回复 最后回复 回复 引用 0
      • 小伊小
        机器人小伊
        最后由 编辑

        当你在使用ROS Noetic和Gazebo进行四轮差速小车仿真时,遇到车轮在RViz中不转的问题,通常与几个关键因素相关:Gazebo中的物理仿真、ROS节点之间的通信、以及RViz的配置。以下是一些可能的解决步骤和检查点:

        1. 检查Gazebo中的物理仿真:

          • 确保Gazebo中的小车模型正确设置了物理属性,如质量、惯性、摩擦等。
          • 检查车轮的关节(joint)是否设置为连续旋转(continuous)或具有适当的限制(limits),以允许它们自由旋转。
        2. 检查ROS节点和通信:

          • 确保skid_steer_drive_controller插件正确加载并运行。你可以在ROS的终端中查看相关日志,确认是否有错误或警告信息。
          • 使用rostopic list查看是否有cmd_vel和odom等话题被正确发布和订阅。
          • 使用rostopic echo /cmd_vel来检查是否有速度命令被发送到小车。
        3. 检查RViz配置:

          • 在RViz中,确保你已经添加了TF显示,并正确设置了Fixed Frame(通常是odom或base_footprint,取决于你的配置)。
          • 检查是否有添加车轮的TF(Transform Frames)到RViz的Displays中。你可以通过添加TF或Marker类型的Display来查看车轮的TF。
          • 确保RViz的更新频率足够高,以便能够实时显示车轮的运动。
        4. 检查URDF/XACRO文件:

          • 确保URDF或XACRO文件中定义的关节名称与skid_steer_drive_controller插件中指定的关节名称完全匹配。
          • 检查URDF/XACRO文件中是否有任何可能导致物理仿真问题的配置错误。
        5. 调试和日志:

          • 使用roslaunch或rosrun命令的--screen选项来运行你的节点,以便在终端中看到更详细的输出。
          • 检查Gazebo的日志文件,通常位于~/.gazebo/logs目录下,以获取更多关于物理仿真的信息。
        6. 重新加载和重启:

          • 有时,简单地重启Gazebo和ROS节点可以解决一些看似复杂的问题。
          • 清除ROS的工作空间并重新编译可能也是必要的。
        7. 检查硬件接口:

          • 确保你的skid_steer_drive_controller配置与你的硬件接口(在这个情况下是Gazebo仿真)兼容。

        如果以上步骤都不能解决问题,你可能需要更详细地检查你的ROS节点和Gazebo仿真的配置,或者考虑在ROS社区或相关论坛中寻求帮助。


        以上为生成回答,仅供参考~

        我是小伊,已接入ChatGpt,所有回复,仅供参考~

        Z 1 条回复 最后回复 回复 引用 0
        • 小鱼小
          小鱼 技术大佬 @zxcmoonss
          最后由 编辑

          @zxcmoonss 有没有正常启动加载呢,日志提供下

          新书配套视频:https://www.bilibili.com/video/BV1GW42197Ck/

          1 条回复 最后回复 回复 引用 0
          • Z
            zxcmoonss @小伊
            最后由 编辑

            6bf4790f-f2a5-4389-ba96-e8a8e7521b1b-ef38e1e79785a1ebf524daac7e784f0b.png

            这是我的控制器配置
            robot name="my_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="wheel_lf_2_base" />
            <xacro:joint_trans joint_name="wheel_rf_2_base" />
            <xacro:joint_trans joint_name="wheel_lb_2_base" /> 
            <xacro:joint_trans joint_name="wheel_rb_2_base" />
            
            <!-- 控制器 -->
            <gazebo>
                <plugin name="skid_steer_drive_controller" filename="libgazebo_ros_skid_steer_drive.so">
                    <updateRate>100.0</updateRate>
                    <robotNamespace>/</robotNamespace>
                    <leftFrontJoint>wheel_lf_2_base</leftFrontJoint>
                    <rightFrontJoint>wheel_rf_2_base</rightFrontJoint>
                    <leftRearJoint>wheel_lb_2_base</leftRearJoint>
                    <rightRearJoint>wheel_rb_2_base</rightRearJoint>
                    <wheelSeparation>0.584</wheelSeparation>
                    <wheelDiameter>0.33</wheelDiameter>
                    <robotBaseFrame>base_footprint</robotBaseFrame>
                    <torque>50</torque>
                    <commandTopic>cmd_vel</commandTopic>
                    <odometryTopic>odom</odometryTopic>
                    <odometryFrame>odom</odometryFrame>
                    <publish_wheel_tf>false</publish_wheel_tf>
                    <broadcastTF>true</broadcastTF>
                </plugin>
            </gazebo>
            

            </robot>

            这是启动gazebo仿真的launch文件
            <launch>
            <param name="robot_description" command="$(find xacro)/xacro $(find logistics_trolley)/urdf/logistics_trolley.xacro" />
            <!-- 2. 启动Gazebo仿真环境 -->
            <include file="$(find gazebo_ros)/launch/empty_world.launch">
            <arg name="world_name" value="$(find logistics_trolley)/worlds/box_house.world" />
            </include>

            <!-- 2. 在Gazebo中添加机器人模型 -->
            <node pkg="gazebo_ros" type="spawn_model" name="my_model" args="-urdf -model logistics_trolley -param robot_description" />
            

            </launch>

            这是启动导航的launch文件
            <launch>
            <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
            <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
            <node pkg="rviz" type="rviz" name="rviz" args="-d $(find logistics_trolley)/config/navigation.rviz" />

            <!-- 加载地图服务 -->
            <include file="$(find logistics_trolley)/launch/read_map.launch" />
            <!-- 加载amcl -->
            <include file="$(find logistics_trolley)/launch/m_amcl.launch" />
            <!-- 加载imove_base -->
            <include file="$(find logistics_trolley)/launch/m_path.launch" />
            

            </launch>

            然后启动用键盘控制,车轮在rviz中不转动
            查看tf树f4c27aa5-df73-40b9-ad74-905b0eaf1809-7678cc3590e420530113a0cdb080b5f4_720.png

            1 条回复 最后回复 回复 引用 0
            • T
              td
              最后由 编辑

              此回复已被删除!
              1 条回复 最后回复 回复 引用 0
              • 第一个帖子
                最后一个帖子
              皖ICP备16016415号-7
              Powered by NodeBB | 鱼香ROS