Ask Your Question
0

specifying ur5 robot_description in moveit_commander.RobotCommander() initialization

asked 2019-12-10 07:27:20 -0600

shu gravatar image

updated 2019-12-11 04:07:30 -0600

I'm trying to specify the robot_description parameter in initializing the moveit_commander for my robot. As in the documentation the moveit_commander takes a robot_description, which I expect is a URDF file. Below is how I am attempting to do so:

desc = '/home/team-sewts/catkin_ws/src/fmauch_universal_robot/ur_description/urdf'
klaus_commander = moveit_commander.RobotCommander(robot_description = desc, ns = "klaus")
frank_commander = moveit_commander.RobotCommander(robot_description = desc, ns = "frank")
scene = moveit_commander.PlanningSceneInterface()


group_name = "manipulator" #manipulator in gazebo
klaus_group = moveit_commander.MoveGroupCommander(group_name, desc, "klaus")
frank_group = moveit_commander.MoveGroupCommander(group_name, desc, "frank")

However I am getting an error reading [ERROR] [1575984235.264155297]: Robot model parameter not found! Did you remap '/home/team-sewts/catkin_ws/src/fmauch_universal_robot/ur_description/urdf'?. I am guessing that I am not specifying the urdf correctly - how can I do so for my moveit_commander? Full error output below, please let me know if anything else is needed.

team-sewts@sewts-Legion:~/catkin_ws/src/moveit_scripts$ python x2_coordinate_tester.py
Failed to import pyassimp, see https://github.com/ros-planning/moveit/issues/86 for more info
[ERROR] [1575984235.264155297]: Robot model parameter not found! Did you remap '/home/team-sewts/catkin_ws/src/fmauch_universal_robot/ur_description/urdf'?
Traceback (most recent call last):
  File "x2_coordinate_tester.py", line 290, in <module>
    main()
  File "x2_coordinate_tester.py", line 266, in main
    tutorial = MoveGroupPythonIntefaceTutorial()
  File "x2_coordinate_tester.py", line 30, in __init__
    klaus_commander = moveit_commander.RobotCommander(robot_description = desc, ns = "klaus")
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/moveit_commander/robot.py", line 151, in __init__
    self._r = _moveit_robot_interface.RobotInterface(robot_description, ns)
RuntimeError: RobotInterfacePython: invalid robot model 


team-sewts@sewts-Legion:~/catkin_ws/src/moveit_scripts$ python coordinate_tester.py
Failed to import pyassimp, see https://github.com/ros-planning/moveit/issues/86 for more info
[ERROR] [1576058021.474502119]: Robot model parameter not found! Did you remap '<?xml version="1.0" ?>
<!-- =================================================================================== -->
<!-- |    This document was autogenerated by xacro from /home/team-sewts/catkin_ws/src/fmauch_universal_robot/ur_description/urdf/ur5_joint_limited_robot.urdf.xacro | -->
<!-- |    EDITING THIS FILE BY HAND IS NOT RECOMMENDED                                 | -->
<!-- =================================================================================== -->
<robot name="ur5" xmlns:xacro="http://wiki.ros.org/xacro">
  <gazebo>
    <plugin filename="libgazebo_ros_control.so" name="ros_control">
      <!--robotNamespace>/</robotNamespace-->
<!--robotSimType>gazebo_ros_control/DefaultRobotHWSim</robotSimType-->
    </plugin>
    <!--
    <plugin name="gazebo_ros_power_monitor_controller" filename="libgazebo_ros_power_monitor.so">
      <alwaysOn>true</alwaysOn>
      <updateRate>1.0</updateRate>
      <timeout>5</timeout>
      <powerStateTopic>power_state</powerStateTopic>
      <powerStateRate>10.0</powerStateRate>
<fullChargeCapacity>87.78</fullChargeCapacity>
      <dischargeRate>-474</dischargeRate>
      <chargeRate>525</chargeRate>
      <dischargeVoltage>15.52</dischargeVoltage>
      <chargeVoltage>16.41</chargeVoltage>
    </plugin>
-->
  </gazebo>
  <!-- measured from model -->
  <link name="base_link">
    <visual>
      <origin rpy="0 0 3.14159265359" xyz="0 0 0"/>
      <geometry>
        <mesh filename="package://ur_description/meshes/ur5/visual/base.dae"/>
      </geometry>
      <material name="LightGrey">
        <color rgba="0.7 0.7 0.7 1.0"/>
      </material>
    </visual>
    <collision>
      <origin rpy="0 0 3.14159265359" xyz="0 0 0"/>
      <geometry>
        <mesh filename="package://ur_description/meshes/ur5/collision/base.stl"/>
      </geometry>
    </collision>
    <inertial>
      <mass value="4.0"/>
      <origin rpy="0 0 0" xyz="0.0 0.0 0.0"/>
      <inertia ixx="0.00443333156" ixy="0.0" ixz="0.0" iyy="0.00443333156" iyz="0.0" izz="0 ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-12-10 15:17:58 -0600

gvdhoorn gravatar image

updated 2019-12-11 04:30:50 -0600

The robot_description parameter actually should be set to the name of the parameter that contains your robot description.

It's not a file path, but the name of the parameter itself.

By default, that would be robot_description (hence the default value there being robot_description).

You'll have to load the actual contents of the file in /home/team-sewts/catkin_ws/src/fmauch_universal_robot/ur_description/urdf into a parameter and then pass the name of that parameter to the RobotCommander constructor.

But perhaps you could (re)use one of the *_upload.launch files provided with the ur_description package, as it already does all of that for you.

Be sure to select the correct one (ie: the one that matches the robot you're trying to use.


Edit: just to be clear: I'm referrig to ROS parameters there, not the concept of parameters and arguments to functions and constructors as you find in generic programming languages.

You seem to be loading the contents of a urdf file into a Python variable and then passing that as an argument to the RobotCommander constructor. That is not what you should do.

You only need to pass the name of the ROS parameter. No contents.


Edit 2:

Does ur5_upload.launch pass the urdf file into a ros parameter that robot_description is set to?

Yes and no.

Yes: it does load the file into a parameter.

No: it does not load the file into "a ros parameter that robot_description is set to". The .launch file loads it into a parameter that is actually called robot_description. Please note the difference.

The .launch file is stand-alone, it does not know anything about the RobotCommander.

I wouls also recommend to not use any different name for the parameter, as robot_description is standard and unless you have a very good reason, should not be changed.

Typing rosparam get /robot_description (I think that's the same parameter as robot_description, let me know if I'm wrong) returns the whole urdf file.

That is indeed the parameter.

You don't have to interact with it at all actually: just roslaunch the .launch file and start your Python script. Things should just work without specifying any custom name for the robot_description parameter. Your use is not special. The default values should work.

edit flag offensive delete link more

Comments

Thanks for explaining. Does ur5_upload.launch pass the urdf file into a ros parameter that robot_description is set to? I'm having a look at the file and I'm having trouble understanding how the urdf is passed into robot_description.

Typing rosparam get /robot_description (I think that's the same parameter as robot_description, let me know if I'm wrong) returns the whole urdf file.

edit:

No: it does not load the file into "a ros parameter that robot_description is set to". The .launch file loads it into a parameter that is actually called robot_description. Please note the difference.

So does this mean there are two robot_description parameters? One that the Commander takes during initialization and one that ur5_upload.launch passes the urdf file into?

shu gravatar imageshu ( 2019-12-11 04:23:34 -0600 )edit

Since I'm specifying namespaces for the robots the script will not run unless I specify a robot_description. I am finding that running

klaus_commander = moveit_commander.RobotCommander(robot_description = '/klaus/robot_description', ns = "klaus")
frank_commander = moveit_commander.RobotCommander(robot_description = '/frank/robot_description', ns = "frank")

is at least running, but I'm not sure if this is the correct thing to do as I'm having a different issue which I don't know is caused by specifying the robot_description (all commands are being sent to one robot).

shu gravatar imageshu ( 2019-12-11 06:31:17 -0600 )edit

Yes, you'd have to take namespaces into account. But I'm surprised RobotCommander does not look in the namespace you're giving it the ns argument.

re: commands: robot_description is purely used for the robot model (ie: kinematics and visualisation). It's not involved in actuation.

gvdhoorn gravatar imagegvdhoorn ( 2019-12-11 09:41:00 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-12-10 07:27:20 -0600

Seen: 47 times

Last updated: Dec 11 '19