ROS中小车设置差速控制器遇到的问题

<robot name="robot_model_move" xmlns:xacro="http://wiki.ros.org/xacro">

    
    <xacro:macro name="joint_trans" params="joint_name">
        
        <transmission name="${joint_name}_trans">
            <type>transmission_interface/SimpleTransmissiontype>
            <joint name="${joint_name}">
                <hardwareInterface>hardware_interface/VelocityJointInterfacehardwareInterface>
            joint>
            <actuator name="${joint_name}_motor">
                <hardwareInterface>hardware_interface/VelocityJointInterfacehardwareInterface>
                <mechanicalReduction>1mechanicalReduction>
            actuator>
        transmission>
    xacro:macro>

    
    <xacro:joint_trans joint_name="base_l_wheel_joint" />
    <xacro:joint_trans joint_name="base_r_wheel_joint" />

    
    <gazebo>
        <plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so">
            <rosDebugLevel>DebugrosDebugLevel>
            <publishWheelTF>falsepublishWheelTF>
            <robotNamespace>/robotNamespace>
            <publishTf>1publishTf>
            <publishWheelJointState>falsepublishWheelJointState>
            <alwaysOn>truealwaysOn>
            <updateRate>100.0updateRate>
            <legacyMode>truelegacyMode>
            <leftJoint>base_l_wheel_jointleftJoint> 
            <rightJoint>base_r_wheel_jointrightJoint> 
            <wheelSeparation>0.4869646685wheelSeparation> 
            <wheelDiameter>0.006wheelDiameter> 
            <broadcastTF>1broadcastTF>
            <wheelTorque>30wheelTorque>
            <wheelAcceleration>1.8wheelAcceleration>
            <commandTopic>cmd_velcommandTopic> 
            <odometryFrame>odomodometryFrame> 
            <odometryTopic>odomodometryTopic> 
            <robotBaseFrame>base_footprintrobotBaseFrame> 
        plugin>
    gazebo>
robot>

小车双轮差速控制文件,需要注意的地方如下:

1.命令行输入rostopic list,查看目前的话题通信,看是否有“/cmd_vel”话题

2.开启gazebo并启动rviz时,rviz终端会一直产生一个警告:TF_REPEATED_DATA ignoring data with redundant timestamp for frame left_wheel at time 140.726000 according to authority unknown_publisher

[ WARN] [1657462827.907037520, 140.746000000]: TF_REPEATED_DATA ignoring data with redundant timestamp for frame left_wheel at time 140.726000 according to authority unknown_publisher
[ WARN] [1657462827.907093593, 140.746000000]: TF_REPEATED_DATA ignoring data with redundant timestamp for frame right_wheel at time 140.726000 according to authority unknown_publisher
[ WARN] [1657462827.907845999, 140.746000000]: TF_REPEATED_DATA ignoring data with redundant timestamp for frame left_wheel at time 140.746000 according to authority unknown_publisher
[ WARN] [1657462827.907878461, 140.746000000]: TF_REPEATED_DATA ignoring data with redundant timestamp for frame right_wheel at time 140.746000 according to authority unknown_publisher

在终端使用roswtf,可以看到如下问题:
ROS中小车设置差速控制器遇到的问题_第1张图片报错提示/robot_state_publisher发布了左右轮到base_link的tf变换,但是/gazebo又发布了左右轮到base_footprint的tf变换,导致了二者的冲突。ROS中小车设置差速控制器遇到的问题_第2张图片
将gazebo_control中的publishWheelTF和publishWheelJointState均设置为false就可以解决掉这个问题

你可能感兴趣的:(ros,人工智能,ros)