0
$\begingroup$

Rosanswers logo

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_robot/tree/calibration_devel/ur_gazebo/urdf

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_robot/blob/calibration_devel/ur_gazebo/launch/inc/load_ur.launch.xml#L33

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


Originally posted by rosberrypi on ROS Answers with karma: 75 on 2022-01-18

Post score: 0


Original comments

Comment by aarsh_t on 2022-01-18:
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"/>

Comment by rosberrypi on 2022-01-20:
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?

Comment by aarsh_t on 2022-01-20:
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.

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

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.


Originally posted by Mike Scheutzow with karma: 4903 on 2022-01-19

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by rosberrypi on 2022-01-20:
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.

Comment by Mike Scheutzow on 2022-01-21:
I don't know how to add an .stl file to the moveit planning scene.

$\endgroup$
0
$\begingroup$

Rosanswers logo

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.


Originally posted by fexner with karma: 221 on 2022-01-24

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

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