How to implement a JointPositionController
Hi,
I want to implement a JointPositionController so I can conveniently tune PID-values with rqt_gui (Tell me if there is a better method). I have a working JointTrajectoryController which I tried changing to be a position controller. I want to change it because I don't know what values to publish to just move the joints, while with the JointPositionController I can simply publish a float and the robot should move to the position.
My ros_controllers.yaml
looks like this:
irb4600_40_255_arm_controller:
type: effort_controllers/JointPositionController
joints:
- joint_1
- joint_2
- joint_3
- joint_4
- joint_5
- joint_6
gains: # manually tuned
joint_1: { p: 2000.0, d: 500.0, i: 50.0, i_clamp: 10000 }
joint_2: { p: 100000.0, d: 100000.0, i: 2000, i_clamp: 10000 }
joint_3: { p: 10000.0, d: 800.0, i: 500.0, i_clamp: 1000 }
joint_4: { p: 18000, d: 200, i: 0.01, i_clamp: 10000 }
joint_5: { p: 100, d: 0, i: 0, i_clamp: 0}
joint_6: { p: 8, d: 0, i: 0, i_clamp: 0}
I exchanged the effort_controllers/JointTrajectoryController
of my working controller with effort_controllers/JointPositionController
.
In my ros_controllers.launch
file I have:
<?xml version="1.0"?>
<launch>
<!-- Load joint controller configurations from YAML file to parameter server -->
<rosparam file="$(find irb4600_40_255_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="irb4600_40_255_arm_controller "/>
</launch>
This launch file get's called in my launch file starting gazebo like this:
<!-- Load joint controller parameters for Gazebo -->
<rosparam file="$(find irb4600_40_255_moveit_config)/config/gazebo_controllers.yaml" />
<!-- Spawn Gazebo ROS controllers -->
<node name="gazebo_controller_spawner" pkg="controller_manager" type="spawner" respawn="false" output="screen" args="joint_state_controller" />
<!-- Load ROS controllers -->
<include file="$(dirname)/ros_controllers.launch"/>
Now when I try roslaunch irb4600_40_255_moveit_config sim.launch
, which launches my gazebo launch file as well, i get:
[ERROR] [1648127146.564436320, 0.012000000]: No joint given (namespace: /irb4600_40_255_arm_controller)
[ERROR] [1648127146.564570962, 0.013000000]: Failed to initialize the controller
[ERROR] [1648127146.564650287, 0.013000000]: Initializing controller 'irb4600_40_255_arm_controller' failed
This does not happen for EXACT SAME code, with the controller type switched from JointPositionController
to JointTrajectoryController
.
I aswell tried implementing it after the example of the rrbot.
The ros_controllers.launch
<?xml version="1.0"?>
<launch>
<!-- Load joint controller configurations from YAML file to parameter server -->
<rosparam file="$(find irb4600_40_255_moveit_config)/config/ros_controllers.yaml" command="load"/>
<!-- Load the controllers -->
<node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
output="screen" ns="/abb_irb4600_40_255"
args="joint_states_controller
joint1_position_controller
joint2_position_controller
joint3_position_controller
joint4_position_controller
joint5_position_controller
joint6_position_controller "/>
</launch>
The ros_controllers.yaml
:
irb4600_40_255_arm_controller:
# Publish all joint states -----------------------------------
joint_states_controller:
type: joint_state_controller/JointStateController
publish_rate: 25
# Position Controllers ---------------------------------------
joint1_position_controller:
type: effort_controllers/JointPositionController
joint: joint_1
pid: {p: 100.0, i: 0.01, d: 10.0}
joint2_position_controller:
type: effort_controllers/JointPositionController
joint: joint_2
pid: {p: 100.0, i: 0.01, d: 10.0}
joint3_position_controller:
type: effort_controllers/JointPositionController
joint: joint_3
pid: {p: 100.0, i: 0.01, d: 10.0}
joint4_position_controller:
type: effort_controllers/JointPositionController
joint: joint_4
pid: {p: 100.0, i: 0.01 ...