SITL setup with xacro

I hope this is the right place to post. I am trying to use the SITL simulation with Gazebo and ROS. I took the iris xacro files from the RotorS simulator framework from ETHZ and I wrote a launch files based on the mavros_posix_sitl.launch file. Everything seems to be launched properly (px4, gazebo, mavros), the drone is spawned in Gazebo but I keep getting the following message on the console “WARN [lib__ecl] EKF baro hgt timeout - reset to baro”. When I look at the rostopic /mavros/local_position/pose the z value of the pose swings between -2 and 10, which I believe is the reason why I get that warning. Before the warning messages, everyting seems to initialize properly (I get messages stating that a high resolution IMU and an attitude quaternion IMU have been detected, GPS checks passed, commencing GPS fusion). I am completely at a loss to understand why that z value is behaving like that. When I test with the iris sdf file provided everything works properly, the z value is stable. I have tried to compare the urdf file generated with xacro and the sdf but I don’t see what the issue could be. I am running in debug and verbose mode but it does not help. If anyone could provide some pointers on where to look or what to do to track down the error, or if you have any idea what might be probable causes that would be tremendously helpful.
Thanks for the help.

No longer an issue, although I still don’t know why it was not working. I copied and made a few changes to the files located in Tools/sitl_gazebo/models/urdf and it works with gazebo and rviz.

1 Like

Hello Coline !
I am unable to view the iris model of gazebo in rviz. How did you figure it out ?
Thanks much !

Hey Vrinda,
A few things to check:

  1. are you publishing the URDF model in the launch file (sdf files won’t work)
    You should have something like that in your launch file
` You can find a full example launch file in Firmware/Launch/single_vehicle_spawn.launch 2. in rviz are you using the robotmodel display with the right parameter for Robot Description? It should be the name you gave the urdf description (in the example above it would be rotors_description, the default is robot_description) 3. Is the target frame set properly? base_link should work Without more information on your issue I can't really be more specific. I also no longer have access to the code I developed for that project so I don't remember all the details. I hope this helps
1 Like

Thanks much Coline for getting back to me !

  1. Yes I converted the iris.xacro to iris.urdf. And then I made a launch file to launch it. What you say makes sense to me. I will use the single_vehicle_spawn.launch.
  2. I was not able to view robot model previously.
  3. I was using base link.
    I feel step 1 will help me. I will do as you suggested ! What I wanted to do was to visualize the real time trajectory of iris model in rviz.
    Thanks once again ! The explanation you provided above is very helpful !