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

How to change the robot_description paramter for the joint_trajectory_controller

asked 2017-07-25 08:12:55 -0600

Panda1638 gravatar image

Dear ROS community,

i am simulating a ABB IRB2400 robot arm in gazebo controlling it with MoveIt. This is working so far. My goal is to simulate two arms. So i moved them in different namespaces and give their descriptions different names. The Problem that now is occurring that the joint_trajectory_controllercant find the 'robot_description' parameter on the parameter server.

The errors i get are:

[ERROR] [1500973451.323217096, 0.454000000]: Could not find parameter robot_description on parameter server
[ERROR] [1500973451.323364757, 0.454000000]: Failed to parse URDF contained in 'robot_description' parameter
[ERROR] [1500973451.323468398, 0.454000000]: Failed to initialize the controller
[ERROR] [1500973451.323531930, 0.454000000]: Initializing controller 'arm_controller' failed
[ERROR] [WallTime: 1500973452.325133] [1.452000] Failed to load arm_controller

I looked up in the Wiki and the code and as far as i know there is no way to tell the joint_trajectory_controller to look for the robot description under a different name than 'robot_description'. Am i wrong? Is there a simple way i am overseeing?

If there is no way implemented i would like to do so. But i could use some enlightening on how to do that a good way. Entering the robot description in the yaml file describing the controller would be the way i would choose. But i have not yet found the part of the code wich parses the arguments from the yaml to the actual controller.

edit retag flag offensive close merge delete

Comments

I managed to implement the use of a different robot description. It was quite easy after i understood how everything works. I copied the joint_trajectory_controller package and renamed it. Than you need to register it under that name. To get a different description i added a parameter to the server.

Panda1638 gravatar image Panda1638  ( 2017-08-01 05:18:52 -0600 )edit

Could you please elaborate on what was required to "register it under that name"?

drcra gravatar image drcra  ( 2018-05-24 16:37:53 -0600 )edit

3 Answers

Sort by ยป oldest newest most voted
0

answered 2017-08-24 04:09:42 -0600

Panda1638 gravatar image

updated 2017-08-29 03:46:43 -0600

As my own comment said i managed to change the joint trajectory controller to get a parameter from the parameter server. If anyone is interested in details let me know.

Details: I basically just changed one line of code in the joint_trajectory_controller_impl.h from:

urdf::ModelSharedPtr urdf = getUrdf(root_nh, "robot_description");

To:

std::string robot_description = "robot_description";
controller_nh_.getParam("robot_description", robot_description);
boost::shared_ptr<urdf::Model> urdf = getUrdf(root_nh, robot_description);

Now i can add robot_description : my_robot_description to the yaml file and the controller will look it up.

edit flag offensive delete link more

Comments

Yes, you should post the details here please.

jayess gravatar image jayess  ( 2017-08-24 11:13:06 -0600 )edit

I added them to my answer.

Panda1638 gravatar image Panda1638  ( 2017-08-29 03:50:23 -0600 )edit
2

answered 2017-08-28 04:35:25 -0600

You can remap parameter just like topics, so for instance this works:

  <node pkg="robot_self_filter" type="self_filter" name="self_filter">
    <remap from="robot_description" to="robot_description_self_filter" />
  </node>

For ros_control, things might be a little more complicated as the remapping has to be performed for the node, which is the controller_manager that loads a joint_trajectory_controller.

edit flag offensive delete link more

Comments

Thanks for your Answer. I was aware of that :) I solved the problem already myself, but i can't accept my own answer haha.

Panda1638 gravatar image Panda1638  ( 2017-08-29 03:48:46 -0600 )edit
0

answered 2020-05-10 17:07:17 -0600

INSA gravatar image

Dear Panda1638

I changed the line of code that you suggest in the joint_trajectory_controller_impl.h file from

urdf::ModelSharedPtr urdf = getUrdf(root_nh, "robot_description");

to

std::string robot_description = "robot_description";
controller_nh_.getParam("robot_description", robot_description);
boost::shared_ptr<urdf::Model> urdf = getUrdf(root_nh, robot_description);

and i specified the robot_description in my controllers .yaml file as so :

boom_robot_arm_controller:
  robot_description: robot_description
  type: position_controllers/JointTrajectoryController
  joints:
....

I recompiled the joint_trajectory_controller pkg and when i try to choose the controller manage ns i get the following error :

Traceback (most recent call last):
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rqt_joint_trajectory_controller/joint_trajectory_controller.py", line 271, in _on_cm_change
    self._update_jtc_list()
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rqt_joint_trajectory_controller/joint_trajectory_controller.py", line 243, in _update_jtc_list
    self._robot_joint_limits = get_joint_limits()  # Lazy evaluation
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rqt_joint_trajectory_controller/joint_limits_urdf.py", line 21, in get_joint_limits
    description = rospy.get_param(key)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/client.py", line 465, in get_param
    return _param_server[param_name] #MasterProxy does all the magic for us
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/msproxy.py", line 123, in __getitem__
    raise KeyError(key)
KeyError: 'robot_description'

This is my robot group namespace in my launch file :

  <group ns="/boom_robot_arm_gazebo">

  <param name="tf_prefix" 
         value="boom_robot_arm_gazebo" />

  <!--   <rosparam file="$(find robot_description)/config/control.yaml" command="load" ns="/robot1" /> -->
  <param name="robot_description" 
         command="$(find xacro)/xacro --inorder $(find boom_robot_gazebo)/urdf/boom_robot_arm_gazebo.xacro"/>

  <!-- Spawning the robot arm initial joint poses don't work because of gazebo_ros_control, maybe in gazebo 11 -->
      <node name="boom_robot_arm_gazebo_spawn" 
            pkg="gazebo_ros" 
            type="spawn_model"
            respawn="false" 
            output="screen"
            args="-urdf -param robot_description  -model boom_robot_arm_gazebo -x 19 -y 0 -z 0.0 -R 0.0 -P 0.0 -Y -1.57079632679 Turret_Joint 0 -J Boom_Joint 0 -J Boom_telesc1_Joint 0 -J Boom_telesc2_Joint 0 -J Rotary_hydraulic_cylinder_Joint 0 -J Basket_Joint 0 -J Chariot_Joint 0 -J Frame_Joint 0 -J Slider_Joint 0 -J Effector_Joint 0">
      </node>

  <!-- convert joint states to TF transforms for rviz, etc -->
  <node name="robot_state_publisher_2" pkg="robot_state_publisher" type="robot_state_publisher"
  output="screen">
  </node>

  <!-- init and start Gazebo ros_control interface for boom_robot_arm_gazebo -->
  <include file="$(find boom_robot_gazebo)/launch/boom_robot_arm_gazebo_control.launch"/> 

  </group>

Can you please help me with this problem. I also tried "robot_description: /boom_robot_arm_gazebo_control/robot_description" in the controllers yaml file.

Thank you

edit flag offensive delete link more

Comments

I actually solved the problem. For people having the same problem, just launch rqt in the right namespace like so : rqt robot_description:=/boom_robot_arm_gazebo/robot_description

You don't have to do anything else. Like this, the joint controller wil look for the robot_description in the right namespace. No
raise KeyError(key) KeyError: 'robot_description'

error anymore !

INSA gravatar image INSA  ( 2020-05-11 03:58:28 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2017-07-25 08:12:55 -0600

Seen: 3,500 times

Last updated: May 10 '20