在使用moveit对机械臂进行配置后,启动demo_gazebo.launch报错如下:
[ WARN] [1688175232.930768924, 359.533000000]: Failed to read controllers from /controller_manager/list_controllers
[ERROR] [1688175232.930839190, 359.533000000]: Unable to identify any set of controllers that can actuate the specified joints: [ foreArm_joint shoulder_joint upperArm_joint wrist1_joint wrist2_joint wrist3_joint ]
[ERROR] [1688175232.930871178, 359.533000000]: Known controllers and their joints:
[ERROR] [1688175232.930915666, 359.533000000]: Apparently trajectory initialization failed
解决:
1.没有安装完整的包 (但我不是这个原因)
参考:ubuntu20.04_ROS中运行gazebo控制机器人模型报错_tudoukaihua的博客-CSDN博客
2.命名空间相关 (最终解决方案)
在使用的xacro或者urdf文件中,有这样几行代码:
<gazebo>
<plugin filename="libgazebo_ros_control.so" name="gazebo_ros_control">
<robotNamespace>/aubo_i5</robotNamespace>
</plugin>
</gazebo>
注意到这里有/aubo_i5的ns,结合pid报错:
[ERROR] [1688174872.705100840]: No p gain specified for pid. Namespace: /aubo_i5/gazebo_ros_control/pid_gains/shoulder_joint
[ERROR] [1688174872.705629967]: No p gain specified for pid. Namespace: /aubo_i5/gazebo_ros_control/pid_gains/upperArm_joint
[ERROR] [1688174872.706135086]: No p gain specified for pid. Namespace: /aubo_i5/gazebo_ros_control/pid_gains/foreArm_joint
[ERROR] [1688174872.706622912]: No p gain specified for pid. Namespace: /aubo_i5/gazebo_ros_control/pid_gains/wrist1_joint
[ERROR] [1688174872.707091179]: No p gain specified for pid. Namespace: /aubo_i5/gazebo_ros_control/pid_gains/wrist2_joint
[ERROR] [1688174872.707567789]: No p gain specified for pid. Namespace: /aubo_i5/gazebo_ros_control/pid_gains/wrist3_joint
[WARN] [1688174903.059474, 30.291000]: Controller Spawner couldn't find the expected controller_manager ROS interface.
[WARN] [1688174903.066453, 30.299000]: Controller Spawner couldn't find the expected controller_manager ROS interface.
可以看到是在/aubo_i5下找的控制器,而我的roscontrollers.launch中没有写controller_manager的ns参数
<launch>
<!-- Load joint controller configurations from YAML file to parameter server -->
<rosparam file="$(find aubo_i5_moveit_config)/config/ros_controllers.yaml" command="load"/>
<!-- Load the controllers -->
<node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
output="screen" args="controller_gazebo "/>
</launch>
所以我将/aubo_i5删掉,如下
<gazebo>
<plugin filename="libgazebo_ros_control.so" name="gazebo_ros_control">
<robotNamespace>/</robotNamespace>
</plugin>
</gazebo>
启动demo_gazebo.launch,正常plan&execute
[ERROR] [1688175681.042191937]: No p gain specified for pid. Namespace: /gazebo_ros_control/pid_gains/shoulder_joint
[ERROR] [1688175681.042996266]: No p gain specified for pid. Namespace: /gazebo_ros_control/pid_gains/upperArm_joint
[ERROR] [1688175681.043924942]: No p gain specified for pid. Namespace: /gazebo_ros_control/pid_gains/foreArm_joint
[ERROR] [1688175681.044743047]: No p gain specified for pid. Namespace: /gazebo_ros_control/pid_gains/wrist1_joint
[ERROR] [1688175681.045200787]: No p gain specified for pid. Namespace: /gazebo_ros_control/pid_gains/wrist2_joint
[ERROR] [1688175681.045775736]: No p gain specified for pid. Namespace: /gazebo_ros_control/pid_gains/wrist3_joint
上面的pid报错可以不管
[INFO] [1688175681.251713, 0.203000]: Controller Spawner: Waiting for service controller_manager/load_controller
[INFO] [1688175681.251845, 0.203000]: Controller Spawner: Waiting for service controller_manager/load_controller
[INFO] [1688175681.254210, 0.205000]: Controller Spawner: Waiting for service controller_manager/switch_controller
[INFO] [1688175681.254519, 0.205000]: Controller Spawner: Waiting for service controller_manager/switch_controller
[INFO] [1688175681.256840, 0.208000]: Controller Spawner: Waiting for service controller_manager/unload_controller
[INFO] [1688175681.257486, 0.208000]: Controller Spawner: Waiting for service controller_manager/unload_controller