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

How can I use a .URDF sensor on a .SDF robot on ROS and Gazebo?

asked 2021-10-07 08:54:45 -0500

Pacom gravatar image

Hi, maybe it's a silly question but I am a beginner.

I have a Firmware of a flight controller called PX4, here it is: https://github.com/PX4/PX4-Autopilot That Firmware contains SITL Gazebo tools so I can simulate in gazebo some models which are included in the Firmware in .sdf format and control them with other ros node. They are in Firmware/Tools/sitl_gazebo/models.

I also have a laser sensor which is a Teraranger Tower Evo, which is a laser sensor and has a description for Gazebo in .URDF and .XACRO, here it is: https://github.com/Terabee/teraranger...

So, the idea is to join the sensor to one of those robots but I can't find how to do it. Even I am not able to spawn the sensor in gazebo as standalone model or read data from it (I think it is because I am not spawning it correctly). I did a launcher to spawn a urdf model, it is added to gazebo but not the mesh and it does not do anything.

What occurred to me is to add laser sensors that behave as similar as possible to the one I want to use, but that would be in case I can't add the original one.

Thank you very much!

edit retag flag offensive close merge delete

Comments

That github repo provides example urdf for 1 range-finder sensor, multiple-range-finders, and a "robot" with the sensors mounted. It seems like you should spend some time learning about urdf, joints and links. Here is one tutorial: urdf_tutorial_link

Mike Scheutzow gravatar image Mike Scheutzow  ( 2021-10-09 07:43:04 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2021-10-07 19:07:06 -0500

osilva gravatar image

My suggestion is to modify sdf file. Adding a sensor is fairly straightforward:

<include>
  <uri>model://<sensor></uri>
  <pose>0.2 0 0.2 0 0 0</pose>
</include>
<joint name="<sensor>_joint" type="fixed">
  <child><sensor>::link</child>
  <parent>chassis</parent>
</joint>

Replace <sensor> with your sensor. Make sure to create a joint that connects the sensor link to the chassis or wherever you need to.

edit flag offensive delete link more

Comments

thanks, it was finally another error but this helped me to check that I had it right

Pacom gravatar image Pacom  ( 2021-10-12 16:13:13 -0500 )edit
0

answered 2021-10-12 08:51:58 -0500

Pacom gravatar image

Thank you all for your answers! That was how I was trying to add it but it didn't work. I realised that the .URDF file I was trying to add didn't has an <intertial> tag so gazebo was just skipping it, I just added that tag and it works. I was assuming that the .urdf file of the repo was ok so I couldn't see the error.

Now it is skipping the other .xacro files which are included in the .urdf, but I think that it is because of the directory reference.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-10-07 08:54:45 -0500

Seen: 260 times

Last updated: Oct 12 '21