Robotics StackExchange | Archived questions

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

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_description

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!

Asked by Pacom on 2021-10-07 08:54:45 UTC

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

Asked by Mike Scheutzow on 2021-10-09 07:43:04 UTC

Answers

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 with your sensor. Make sure to create a joint that connects the sensor link to the chassis or wherever you need to.

Asked by osilva on 2021-10-07 19:07:06 UTC

Comments

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

Asked by Pacom on 2021-10-12 16:13:13 UTC

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 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.

Asked by Pacom on 2021-10-12 08:51:58 UTC

Comments