ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
After trawlling through various tutorials and vidoes on ROS control, I found a solution to the problem. It was a problem of namespaces betwen Gazebo and ROS.
I went back and did the MoveIt! config setup again for the robot arm. I then removed all references to namespaces. So no namespace in the URDF for Gazebo, removed the namespace from the MoveIt! generated controller files and any namespaces in launch files.
The following is based on my understanding of ROS control so may not be totally accurate. So I then figured out that in the error message:
Waiting for arm_controller/follow_joint_trajectory server...
The arm_controller
refers to the actual controller and follow_joint_trajectory
is the action server (really not sure how this works). So in my controllers.yaml
file, I changed the following:
Previous:
joint_state_controller:
type: joint_state_controller/JointStateController
publish_rate: 50
controller_list:
- name: "arm_controller"
action_ns: follow_joint_trajectory
type: FollowJointTrajectory
joints:
- joint_a1
- joint_a2
- joint_a3
- joint_a4
- joint_a5
- joint_a6
arm_position_controller:
type: position_controllers/JointTrajectoryController
joints:
- joint_a1
- joint_a2
- joint_a3
- joint_a4
- joint_a5
- joint_a6
...(controller gains etc...)
Now:
joint_state_controller:
type: joint_state_controller/JointStateController
publish_rate: 50
controller_list:
- **name: ""**
action_ns: follow_joint_trajectory
type: FollowJointTrajectory
joints:
- joint_a1
- joint_a2
- joint_a3
- joint_a4
- joint_a5
- joint_a6
arm_position_controller:
type: position_controllers/JointTrajectoryController
joints:
- joint_a1
- joint_a2
- joint_a3
- joint_a4
- joint_a5
- joint_a6
Removing the name
field from controller_list
meant that ROS would now be looking for an action server on the /follow_joint_trajectory
topic. I then remapped the topic /follow_joint_trajectory
to [controller_name]/follow_joint_trajectory
so in my case I added the follwing to my launch file:
<!-- Remap follow_joint_trajectory -->
<remap if="$(arg sim)" from="/follow_joint_trajectory" to="/arm_position_controller/follow_joint_trajectory"/>
This led to the controller being found and loaded correctly.
I hope this is of help to others and I would appreciate anyone more knowlegable improving the answer and my understanding of ROS control.