- 确保安装以下插件,记住对应版本
sudo apt install ros-noetic-gazebo-ros-control
可通过该指令来验证:
rosservice list | grep controller_manager
预计输出:
/controller_manager/list_controller_types
/controller_manager/list_controllers
/controller_manager/load_controller
/controller_manager/reload_controller_libraries
/controller_manager/switch_controller
/controller_manager/unload_controller
<gazebo>
<plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
<robotNamespace>/MYROBOT</robotNamespace>
</plugin>
</gazebo>
如果robotNamespace在上面指定(它是可选的),则controller_manager 将被命名为/MYROBOT/controller_manager/…
- 若还是有问题,请注意检查命名空间:命名空间必须一致!! /arm arm: /arm,切记斜杠!
<!-- load the controllers -->
<node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
output="screen" ns="/arm" args="joint_state_controller"/>
arm:
joint_state_controller:
type: joint_state_controller/JointStateController
publish_rate: 50
<!-- ros_control plugin -->
<gazebo>
<plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
<robotNamespace>/arm</robotNamespace>
<robotSimType>gazebo_ros_control/DefaultRobotHWSim</robotSimType>
</plugin>
</gazebo>
|