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

Universal Robot URDF and xacro structure

asked 2022-01-18 10:17:57 -0600

rosberrypi gravatar image

updated 2022-01-18 10:18:26 -0600

Hi all, I am trying to create a custom environment for my UR5e robot and having a little bit of a problem understanding the file structure.

  • I would like to have a fixed, not moving object around 1 meter away from the UR
  • I want to see both the robot and my fixed object in Gazebo and RViz setups

So far, I have extracted the CAD model of my object in .stl format, and created a URDF file where I read that .stl file and I am able to spawn the object both in Gazebo and RViz.

My question is merging that URDF file with the UR setup.

Both xacro files here says that they should not be modified: https://github.com/fmauch/universal_r...

How can I merge them together with my new URDF file?

Where should I call that new xacro file? Here? https://github.com/fmauch/universal_r...

Is that correct/normal that the new object will be a part of robot_description or should I see robot_description and object_description separately? Since my object is not attached to the robot but rather something that should spawn in the environment, it didn't feel quite correct that it is a part of the robot_description.

I am using ROS Noetic with Ubuntu 20.04

Thank you in advance

edit retag flag offensive close merge delete

Comments

1

you can try editing this file and use something like this

<node name="spawn_model" pkg="gazebo_ros" type="spawn_model" 
    args=" -file /path/to/urdf_file/with/stl -urdf 
    -x 0 -y 0 -z 0 -model model_name" 
    respawn="false" output="screen"/>
aarsh_t gravatar image aarsh_t  ( 2022-01-18 12:00:35 -0600 )edit

Thank you for the answer. I am able to spawn the object in gazebo like this, however how do I also attach it to RViz and let the robot know not to plan a path that intersects with that object?

rosberrypi gravatar image rosberrypi  ( 2022-01-20 09:57:48 -0600 )edit

one simple way I can suggest is to use parameter such as <param name="/object/robot_description" textfile=" /path/to/urdf_file" /> and then in rviz add new robotModel with topic /object/robot_description.

For the rviz to know the object you might need to put some sensors or you can remove that part from the robot's workspace. I haven't used universal_robot package focusing this problem so I won't be able to comment on that. Perhaps its a good idea to raise new question for that rather than asking in comments.

aarsh_t gravatar image aarsh_t  ( 2022-01-20 11:45:03 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2022-01-19 08:42:33 -0600

Mike Scheutzow gravatar image

updated 2022-01-19 08:43:18 -0600

The robot and The Object are independent objects, so typically are not described in the same urdf/xacro/sdf file. In gazebo, you create an instance of an object by "spawning" it into the world at some initial position. After that, the physics simulator determines the behavior of all independent objects e.g. if something crashes into your Object, it may move. If you spawn an object in mid-air, gravity will cause it to fall to the ground.

edit flag offensive delete link more

Comments

Thank you for your explanation. What is the correct way of defining that .stl object so that it is visible in RViz and the robot always knows not to hit it? I know that we can add objects to MoveIt's planning interface but I thought I could directly use the .stl object and its URDF for that.

rosberrypi gravatar image rosberrypi  ( 2022-01-20 09:56:07 -0600 )edit

I don't know how to add an .stl file to the moveit planning scene.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-01-21 07:00:05 -0600 )edit
1

answered 2022-01-24 02:33:43 -0600

fexner gravatar image

updated 2022-01-24 02:35:01 -0600

You would usually create your own workcell package with your own description in it. That description could look like this:

<?xml version="1.0"?>
<robot xmlns:xacro="http://wiki.ros.org/xacro" name="my_work_cell">
  <!--Load the macro for creating a UR10e-->
  <xacro:include filename="$(find ur_description)/urdf/inc/ur10e_macro.xacro"/>

  <!--Instanciate the UR10e-->
  <xacro:ur10e_robot prefix="" />

  <!--Let's create a sort of table where the robot stands on-->
  <link name="box">
    <visual>
      <origin xyz="0 0 0.5" rpy="0 0 0"/>
      <geometry>
        <box size="1 1 1"/>
      </geometry>
    </visual>
  </link>

  <!--The robot will be on the top surface of the box in the center-->
  <joint name="table_to_robot" type="fixed">
    <parent link="box" />
    <child link = "base_link" />
    <origin xyz="0 0 1" rpy="0 0 0" />
  </joint>
</robot>

Basically, you create your URDF with everything "around" the robot and then include the macro for creating the robot and add the statement for actually creating the robot to your URDF. To add an item with a custom stl, please refer to the urdf/link docuementation.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2022-01-18 10:17:57 -0600

Seen: 1,212 times

Last updated: Jan 24 '22