![Mastering ROS for Robotics Programming(Second Edition)](https://wfqqreader-1252317822.image.myqcloud.com/cover/200/36700200/b_36700200.jpg)
Interfacing joint state controllers and joint position controllers to the arm
Interfacing robot controllers to each joint is a simple task. The first task is to write a configuration file for two controllers.
The joint state controllers will publish the joint states of the arm and the joint position controllers can receive a goal position for each joint and can move each joint.
We will find the configuration file for the controller at seven_dof_arm_gazebo_control.yaml in the seven_dof_arm_gazebo/config folder.
Here is the configuration file definition:
seven_dof_arm: # Publish all joint states ----------------------------------- joint_state_controller: type: joint_state_controller/JointStateController publish_rate: 50 # Position Controllers --------------------------------------- joint1_position_controller: type: position_controllers/JointPositionController joint: shoulder_pan_joint pid: {p: 100.0, i: 0.01, d: 10.0} joint2_position_controller: type: position_controllers/JointPositionController joint: shoulder_pitch_joint pid: {p: 100.0, i: 0.01, d: 10.0} joint3_position_controller: type: position_controllers/JointPositionController joint: elbow_roll_joint pid: {p: 100.0, i: 0.01, d: 10.0} joint4_position_controller: type: position_controllers/JointPositionController joint: elbow_pitch_joint pid: {p: 100.0, i: 0.01, d: 10.0} joint5_position_controller: type: position_controllers/JointPositionController joint: wrist_roll_joint pid: {p: 100.0, i: 0.01, d: 10.0} joint6_position_controller: type: position_controllers/JointPositionController joint: wrist_pitch_joint pid: {p: 100.0, i: 0.01, d: 10.0} joint7_position_controller: type: position_controllers/JointPositionController joint: gripper_roll_joint pid: {p: 100.0, i: 0.01, d: 10.0}
We can see that all the controllers are inside the namespace seven_dof_arm, and the first line represents the joint state controllers, which will publish the joint state of the robot at the rate of 50 Hz.
The remaining controllers are joint position controllers, which are assigned to the first seven joints, and they also define the PID gains.