0
$\begingroup$

Rosanswers logo

Hello all,

I followed the tutorial pr2_mechanism/Tutorials/Running a real-time Cartesian/controller exactly to write a pr2 controller. Everything seems fine except nothing happened in the gazebo simulator. Could anyone help me out? I describe what I have done as follows:

package name: my_controller_cart_pkg

Plugin class defined:

namespace my_controller_ns{
class MyCartControllerClass: public pr2_controller_interface::Controller
{....
}

Plugin declaration in src/my_controller_cart.cpp:

PLUGINLIB_DECLARE_CLASS (my_controller_cart_pkg, MyCartControllerClass,
                         my_controller_ns::MyCartControllerClass,
                         pr2_controller_interface::Controller)

Actually, I also tried PLUGINLIB_REGISTER_CLASS(MyCartControllerClass, my_controller_ns::MyCartControllerClass, pr2_controller_interface::Controller), but it didn't work.

controller_plugins.xml:

<library path="lib/libmy_controllers">
  <class name="my_controller_cart_pkg/MyCartControllerClass" 
         type="my_controller_ns::MyCartControllerClass"           
         base_class_type="pr2_controller_interface::Controller" />
</library>

cart_controller.yaml:

my_tutorial_controller:
    type: my_controller_cart_pkg/MyCartControllerClass
    root_name: torso_lift_link
    tip_name: r_gripper_tool_frame

my_controller_cart.launch:

<launch>
   <rosparam file="$(find my_controller_cart_pkg)/cart_controller.yaml" command="load" />

   <node pkg="pr2_controller_manager" type="spawner" args="my_tutorial_controller" name="my_controller_cart_spawner" />
</launch>

After I launched the gazebo simulator, I typed:

rosrun pr2_controller_manager pr2_controller_manager list-types

Then I can see:

JointGravityController

JointPendulumController

ethercat_trigger_controllers/MultiTriggerController

ethercat_trigger_controllers/ProjectorController

ethercat_trigger_controllers/TriggerController

my_controller_cart_pkg/MyCartControllerClass

...

After that, I launched my my_controller_cart.launch file. I run:

rosrun pr2_controller_manager pr2_controller_manager list

I received:

base_controller ( running )

base_odometry ( running )

head_traj_controller ( running )

l_arm_controller ( running )

l_gripper_controller ( running )

laser_tilt_controller ( running )

my_tutorial_controller ( running )

r_arm_controller ( running )

r_gripper_controller ( running )

torso_controller ( running )

my_tutorial_controller plugin is running. But nothing happened in gazebo simulator. Could anyone help me out? Thank you in advance.


Originally posted by Xiaolong on ROS Answers with karma: 66 on 2012-12-05

Post score: 3


Original comments

Comment by Xiaolong on 2012-12-06:
I noticed a similar question posted previously, but it didn't solve my problem. http://answers.ros.org/question/45279/pr2-writing-a-realtime-joint-controller/

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I happened to change the cart_controller.yaml file to control the left arm. It works!

my_tutorial_controller:
    type: my_controller_cart_pkg/MyCartControllerClass
    root_name: torso_lift_link
    tip_name: l_gripper_tool_frame

Now I want to know why the right arm doesn't work?


Originally posted by Xiaolong with karma: 66 on 2012-12-06

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by ccm on 2012-12-06:
Wow, yes it works on the left arm too for the tutorial that I was stuck on.

Comment by Xiaolong on 2012-12-07:
Did you figure out why it doesn't work on the right arm?

Comment by ccm on 2013-02-22:
I found that if I kill the right_arm_controller, it and load my_controller_name afterwards, the right arm works. @.@ perhaps the default controller was interfering?

$\endgroup$

Your Answer

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