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