ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

PR2: Running a Realtime joint controller problem

asked 2012-11-06 00:23:45 -0500

joseescobar60 gravatar image

updated 2014-11-22 17:05:03 -0500

ngrennan gravatar image

hello...

i'm trying to realize the "Runing a Realtime joint controller" tutorial, i did everything how the tutorial said, i think that my probnlem is with the controller name, but in another question @Lorenz tells me that isn't my problem...

what i do was the following:

i opened the gazebo with the PR2 and open the rxconsole, later i wrote:

$ rosparam set my_controller_name/type MyControllerPlugin
$ rosrun pr2_controller_manager pr2_controller_manager list-joints

Waiting for mechanism statistics message...
Actuators:
    0 bl_caster_l_wheel_motor
    1 bl_caster_r_wheel_motor
    2 bl_caster_rotation_motor
    3 br_caster_l_wheel_motor
    4 br_caster_r_wheel_motor
    5 br_caster_rotation_motor
    6 fl_caster_l_wheel_motor
    7 fl_caster_r_wheel_motor
    8 fl_caster_rotation_motor
    9 fr_caster_l_wheel_motor
   10 fr_caster_r_wheel_motor
   11 fr_caster_rotation_motor
   12 head_pan_motor
   13 head_tilt_motor
   14 l_elbow_flex_motor
   15 l_forearm_roll_motor
   16 l_gripper_motor
   17 l_shoulder_lift_motor
   18 l_shoulder_pan_motor
   19 l_upper_arm_roll_motor
   20 l_wrist_l_motor
   21 l_wrist_r_motor
   22 laser_tilt_mount_motor
   23 r_elbow_flex_motor
   24 r_forearm_roll_motor
   25 r_gripper_motor
   26 r_shoulder_lift_motor
   27 r_shoulder_pan_motor
   28 r_upper_arm_roll_motor
   29 r_wrist_l_motor
   30 r_wrist_r_motor
   31 torso_lift_motor
Joints:
    0 fl_caster_rotation_joint
    1 fl_caster_l_wheel_joint
    2 fl_caster_r_wheel_joint
    3 fr_caster_rotation_joint
    4 fr_caster_l_wheel_joint
    5 fr_caster_r_wheel_joint
    6 bl_caster_rotation_joint
    7 bl_caster_l_wheel_joint
    8 bl_caster_r_wheel_joint
    9 br_caster_rotation_joint
   10 br_caster_l_wheel_joint
   11 br_caster_r_wheel_joint
   12 torso_lift_joint
   13 torso_lift_motor_screw_joint
   14 head_pan_joint
   15 head_tilt_joint
   16 laser_tilt_mount_joint
   17 r_upper_arm_roll_joint
   18 r_shoulder_pan_joint
   19 r_shoulder_lift_joint
   20 r_forearm_roll_joint
   21 r_elbow_flex_joint
   22 r_wrist_flex_joint
   23 r_wrist_roll_joint
   24 r_gripper_joint
   25 r_gripper_l_finger_joint
   26 r_gripper_r_finger_joint
   27 r_gripper_r_finger_tip_joint
   28 r_gripper_l_finger_tip_joint
   29 r_gripper_motor_screw_joint
   30 r_gripper_motor_slider_joint
   31 l_upper_arm_roll_joint
   32 l_shoulder_pan_joint
   33 l_shoulder_lift_joint
   34 l_forearm_roll_joint
   35 l_elbow_flex_joint
   36 l_wrist_flex_joint
   37 l_wrist_roll_joint
   38 l_gripper_joint
   39 l_gripper_l_finger_joint
   40 l_gripper_r_finger_joint
   41 l_gripper_r_finger_tip_joint
   42 l_gripper_l_finger_tip_joint
   43 l_gripper_motor_screw_joint
   44 l_gripper_motor_slider_joint

$ rosparam set my_controller_name/joint_name r_shoulder_pan_joint
$ rosparam get -p my_controller_name

and i obtain :

joint_name: r_shoulder_pan_joint
type: MyControllerPlugin

$ rosrun pr2_controller_manager pr2_controller_manager list

base_controller ( running )
base_odometry ( running )
head_traj_controller ( running )
l_arm_controller ( running )
l_gripper_controller ( running )
laser_tilt_controller ( running )
r_arm_controller ( running )
r_gripper_controller ( running )
torso_controller ( running )

in this case i don't stop any controller (i have to?)

$rosrun pr2_controller_manager pr2_controller_manager list-types


JointGravityController
JointPendulumController
ethercat_trigger_controllers/MultiTriggerController
ethercat_trigger_controllers/ProjectorController
ethercat_trigger_controllers/TriggerController
pr2_calibration_controllers/CasterCalibrationController
pr2_calibration_controllers/FakeCalibrationController
pr2_calibration_controllers/GripperCalibrationController
pr2_calibration_controllers/JointCalibrationController
pr2_calibration_controllers/WristCalibrationController
pr2_controller_manager/TestController
pr2_mechanism_controllers/CasterController
pr2_mechanism_controllers/CasterControllerNode
pr2_mechanism_controllers/LaserScannerTrajController
pr2_mechanism_controllers/Pr2BaseController
pr2_mechanism_controllers/Pr2BaseController2
pr2_mechanism_controllers/Pr2GripperController
pr2_mechanism_controllers/Pr2Odometry
robot_mechanism_controllers/CartesianPoseController
robot_mechanism_controllers/CartesianTwistController
robot_mechanism_controllers/CartesianWrenchController
robot_mechanism_controllers/JTCartesianController
robot_mechanism_controllers/JointEffortController
robot_mechanism_controllers/JointPositionController
robot_mechanism_controllers/JointSplineTrajectoryController
robot_mechanism_controllers/JointTrajectoryActionController
robot_mechanism_controllers/JointVelocityController

$rosrun pr2_controller_manager pr2_controller_manager load my_controller_name

and i obtain the first error:

Error when loading my_controller_name

if i continue i obtain the following lines:

$rosrun pr2_controller_manager pr2_controller_manager list

base_controller ( running )
base_odometry ( running )
head_traj_controller ( running )
l_arm_controller ( running )
l_gripper_controller ( running )
laser_tilt_controller ( running )
r_arm_controller ( running )
r_gripper_controller ( running )
torso_controller ( running )

i try to:

$rosparam set my_controller_name/type my_controller_pkg/MyControllerPlugin

but the problem persist.

If anyone could help me i gonna thank you....

the output of

rospack plugins --attrib=plugin pr2_controller_interface


pr2_controller_manager /opt/ros/fuerte/stacks/pr2_mechanism/pr2_controller_manager/test/controller_plugin.xml
pr2_gazebo_benchmarks /opt/ros/fuerte/stacks/pr2_simulator/pr2_gazebo_benchmarks/gazebo_physics_controller_plugins.xml
pr2_mechanism_controllers /opt/ros/fuerte/stacks/pr2_controllers/pr2_mechanism_controllers/controller_plugins.xml
my_controller_pkg /home/jose/ros_pkg_tutorials/my_controller_pkg/controller_plugins.xml
ethercat_trigger_controllers /opt/ros/fuerte/stacks/pr2_controllers/ethercat_trigger_controllers/controller_plugins.xml
pr2_calibration_controllers /opt/ros/fuerte/stacks/pr2_controllers/pr2_calibration_controllers/controller_plugins.xml
robot_mechanism_controllers /opt/ros/fuerte/stacks/pr2_controllers/robot_mechanism_controllers/controller_plugins.xml

this is the contents of the controller_plugin.xml:

<library path="lib/libmy_controller_lib">
  <class name="my_controller_pkg/MyControllerPlugin" 
         type="my_controller_ns::MyControllerClass"           
         base_class_type="pr2_controller_interface::Controller" />
</library>

well here ... (more)

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
1

answered 2012-11-06 00:30:13 -0500

Lorenz gravatar image

As you can see, the controller named MyControllerPlugin is not known in your system. Did you really follow the previous tutorial as it is assumed (stated at the beginning of the tutorial page you are referring to)? You can find it here. It shows you how to actually write the controller and declare the plugin properly.

edit flag offensive delete link more

Comments

yes Lorenz, i do everithing, i'll do the tutorials again...

joseescobar60 gravatar image joseescobar60  ( 2012-11-06 00:33:58 -0500 )edit

I still believe that something is wrong with your ros package defining the controller. Is it in your ROS_PACKAGE_PATH? Please edit your question and add the output of rospack plugins --attrib=plugin pr2_controller_interface executed in your controller package.

Lorenz gravatar image Lorenz  ( 2012-11-06 00:36:08 -0500 )edit

i export the ROS_PACKAGE_PATH to my home, there is where i created the directory... in this moments i'm making the previous tutorial again

joseescobar60 gravatar image joseescobar60  ( 2012-11-06 00:47:22 -0500 )edit

Well, i don't have succes with it, i did all the previous tutorial an the runing one to, but it has the same problem.... when i create the plugin description file where i have to save it?

joseescobar60 gravatar image joseescobar60  ( 2012-11-06 01:06:33 -0500 )edit

Sorry, I cannot help if you do not provide the information I ask for. What's the output of the rospack plugins command as shown at the bottom of the tutorial and in my previous comment? Please edit your question to add information. Just saying 'it doesn't work' just costs time...

Lorenz gravatar image Lorenz  ( 2012-11-06 01:08:45 -0500 )edit

Thanks. So the controller_plugins.xml file of my_controller_pkg is known at least. Can you add the contents of that file to your question please? Please format the code correctly (mark it and press Ctrl-k).

Lorenz gravatar image Lorenz  ( 2012-11-06 01:13:33 -0500 )edit

Ok. That looks good, too. Are you using gazebo? Did you actually restart it? Otherwise, the list of controller plugins might be outdated.

Lorenz gravatar image Lorenz  ( 2012-11-06 01:21:25 -0500 )edit

i closed the gazebo and run it again, the problem persist

joseescobar60 gravatar image joseescobar60  ( 2012-11-06 01:27:01 -0500 )edit
0

answered 2015-08-31 17:59:56 -0500

Chuong Nguyen gravatar image

Hi All, I pull up the discussion again, since I have exact the same error as Jose. After trying all the suggestions, I still don't get it work. My ROS version is Indigo, and I use catkin.

  1. I completed the first tutorial successfully, and I can roscd into my_controller_pkg http://wiki.ros.org/pr2_mechanism/Tut... .

    chuong_nguyen@chuongLinux:~$ rospack plugins --attrib=plugin pr2_controller_interface robot_mechanism_controllers /opt/ros/indigo/share/robot_mechanism_controllers/controller_plugins.xml pr2_calibration_controllers /opt/ros/indigo/share/pr2_calibration_controllers/controller_plugins.xml pr2_mechanism_controllers /opt/ros/indigo/share/pr2_mechanism_controllers/controller_plugins.xml pr2_controller_manager /opt/ros/indigo/share/pr2_controller_manager/test/controller_plugin.xml ethercat_trigger_controllers /opt/ros/indigo/share/ethercat_trigger_controllers/controller_plugins.xml pr2_gripper_sensor_controller /opt/ros/indigo/share/pr2_gripper_sensor_controller/controller_plugins.xml my_controller_pkg /home/chuong_nguyen/Chuong/WritingROS/pr2_tutorial/src/my_controller_pkg/controller_plugins.xml

  2. I used the export ROS_PACKAGE_PATH command at each time I open the terminal, (as joseescobar60 comment)

    $ export ROS_PACKAGE_PATH=/home/chuong_nguyen/Chuong/WritingROS/pr2_tutorial:$ROS_PACKAGE_PATH
    $ roslaunch gazebo_ros empty_world.launch
    $ roslaunch pr2_gazebo pr2.launch
    
  3. Follow the tutorial, I got up to here

    $ rosparam get -p my_controller_name
    

and get

     joint_name: r_shoulder_pan_joint
     type: my_controller_pkg/MyControllerPlugin

4. But when I use the command

     $ rosrun pr2_controller_manager pr2_controller_manager list-types

I don't see my_controller_pkg show in the terminal, and only get the same output as Jose's first question.

Greatly thanks to any suggestion.

edit flag offensive delete link more
0

answered 2012-11-08 13:58:28 -0500

ccm gravatar image

Hi Jose, your problem is you have to define MyControllerPlugin as my_controller_pkg/MyControllerPlugin instead. ps*look at my question again

It should at least be able to load in. :) Let me know your results again. My controller still does not do anything despite it being loaded and running.

edit flag offensive delete link more

Comments

According to @joseescobar60's comments, the problem was caused by an inconsistent ROS_PACKAGE_PATH setting and should be solved now.

Lorenz gravatar image Lorenz  ( 2012-11-08 20:54:28 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2012-11-06 00:23:45 -0500

Seen: 575 times

Last updated: Aug 31 '15