Rosanswers logo


I'm trying to follow along with the Writing a realtime joint controller tutorial. I've got the class all set up, and I believe I've got it installed correctly using the plugin lib, as I can see the controller when I do

rosrun pr2_controller_manager pr2_controller_manager list

and I can see that the plugin is running OK. The problem is that even when I set the joint_state_->commanded_effort_ to a fixed value, I don't see any change in the joints of my simulation in gazebo. However, when I do a rostopic echo of the /mechanism_statistics, I can see that the commanded effort is non-zero and that the limits haven't been violated:

name: p_one_joint_4
  secs: 54
  nsecs: 5000000
position: 0.0
velocity: 0.0
measured_effort: 0.0
commanded_effort: -100.0
is_calibrated: True
violated_limits: False
odometer: 0.0
min_position: 0.0
max_position: 0.0
max_abs_velocity: 0.0
max_abs_effort: 0.0

Also, it is interesting that when I go into gazebo and tinker with the joints manually by using the little hand tool and making the joints move, I don't see anything when I add a printf into the controller to print the joint position (it stays 0). I know that putting a printf in the controller is a bad idea for real-time behavior... Any hints on why I can't get the joint to move with my simple controller would be appreciated. Also in my joint definition in my URDF file I do not have a limit or safety_controller tag currently in it (they're below but commented out):

    <joint name="${parent}_${suffix}_joint_4" type="continuous">
        <origin xyz="${link_4_len} 0 0" rpy="0 0 0" />
        <axis xyz="0 1 0" />
        <!-- <limit effort="10" velocity="10" /> -->
        <!-- <safety_controller soft_lower_limit="-1.5" soft_upper_limit="1.5" k_position="1" k_velocity="1"/> -\-> -->
        <joint_properties damping="0.0" friction="0.0" />
        <parent link="${parent}_${suffix}_link_4" />
        <child link="${parent}_${suffix}_link_5" />

I have also verified that the links look OK in the simulation as well as in rviz, and the TF tree looks like it's being published.

Originally posted by andrew-unit on ROS Answers with karma: 283 on 2011-10-25

Post score: 0

Original comments

Comment by Guido on 2011-11-15:
Puting printfs in the realtime loop won't crash it, though it will diminish its performances you can try it. Have you been through this tutorial : http://www.ros.org/wiki/pr2_mechanism/Tutorials/Running%20a%20controller%20in%20simulation ?

Comment by andrew-unit on 2011-10-26:
Hmm. Another observation is that when I fire up the simulation and grab the robot with the hand tool to get it to move the joints, and I try to do a rostopic echo of /joint_states, I see all the joints in my urdf file, but the positions, velocities, and effort are all zero. Also in rviz it looks like the joints aren't moving at all.

Comment by sglaser on 2012-02-14:
Is this joint connected to any actuators?


1 Answer 1


Rosanswers logo

Do you have gazebo_ros_controller_manager or an equivalent gazebo plugin in your simulated robot XML?

  <controller:gazebo_ros_controller_manager name="gazebo_ros_controller_manager" plugin="libgazebo_ros_controller_manager.so">

Originally posted by hsu with karma: 5780 on 2012-02-14

This answer was ACCEPTED on the original site

Post score: 2


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.