Gazebo HITL not working

Hey @Themaksiest

I was able to resolve this issue by running this command in the src/Fimrware folder “git checkout v1.10.1”

If you didnt run this command after you cloned PX4 repository then you will have to start again.

You only upload the firmware v1.10.1 into pixhawk, however, it is not enough, you need to checkout Firmware folder too.

In Firmware master branch (after you git clone, the master branch is default need to checkout v1.10.1) no “iris vehicle”. It is a bug for master branch for now. because the developer are implementing a new way to call iris and world.

@mehdi786 You can simply use

gazebo Tools/sitl_gazebo/worlds/empty.world

Instead of
gazebo Tools/sitl_gazebo/worlds/iris.world

I will update the docs accordingly

I have the same problem. If I open QGC, it just says waiting for connection. The question semes connect to upon.

Hey @mehdi786.

Thanks for the response. After some time of recloning and remaking I finally got to the point where iris model was visible in the simulation.
I still could not make the simulation connect to QGC and FC.

@Chris_iav We are working on it in https://github.com/PX4/PX4-SITL_gazebo/pull/651

@Jaeyoung-Lim great to hear, is there a workaround until the pull request is through? Reverting to an older qgc version or changing the parameter names in the firmware?

@cschindlbeck HIL is not related to a qgroundcontrol version - it works whether or not QGC is running

Have you tried pulling the PR?

so the battery parameter issue still exists, is this causing an AUTODISARM?

For some reason, the Led I/O B/E is flashing red which apparently does’t connect to the vehicle as shown in qgroundcontrol

@bperseghetti Any chance you have any insights?

@cschindlbeck can you list your FCs “changed” params, specifically hil_enable and sys_autostart, firmware version, QGC version, model you are trying to run in sitl_gazebo, the way you are connected from computer to FC, how you are launching it, commit sitl_gazebo is on for you, ubuntu version, gazebo version, and any other possible details.

@bperseghetti
i bought a new pixhawk, i still get the red flashing I/O

  • SYS_HITL is set to HITL enabled
  • SYS_AUTOSTART is set to 1001
  • Only box UDP is checked in
  • sitl_gazebo model is iris.world (at commit 0da08f0333cd14c08a9545c6ba7ddfc18706398f)
  • computer is connected to FC via USB, ubuntu is 18.04, gazebo version is 9.16.0, QGroundControl is 4.0.11

My launching process:

  1. gazebo Tools/sitl_gazebo/worlds/iris.world
  2. Connect FC via USB
  3. Start QGroundControl

Then it says Waiting for Vehicle Connection and the I/O led is flashing red

@cschindlbeck does QGC recognize the FC when it is plugged into USB and the “pixhawk box” is clicked in QGC? What version of firmware is it on? Is the FC an FMUv5? I would recommend in the future:
1.) Connect FC via USB
2.) Start QGroundControl (should not connect or see anything if only the UDP box is selected)
3.) gazebo Tools/sitl_gazebo/worlds/iris.world (note that the iris world has been removed from more recent firmware/sitl)
4.) Should now show up in QGC

If using more recent firmware and sitl there is a hitl_iris.world as of commit b02899.

I would suggest moving your Firmware forward, then build it, flash it to your FC, set SYS_AUTOSTART to 1001 or 4001 (has RC AUX pass through), and check all params in QGC – lastly make sure QGC is then set to UDP only, then:
1.) Connect FC via USB
2.) Start QGroundControl (should not connect or see anything if only the UDP box is selected)
3.) gazebo Tools/sitl_gazebo/worlds/hitl_iris.world
4.) Should now show up in QGC

@bperseghetti Thank you for your time, with hitl_iris.world and updating sitl_gazebo to master, the HITL is running…
However, the quadcopter exhibits erratic behavior, i guess the rotors are off from where they are supposed to be so it crashes after arming it…
EMERGENCY: BARO 0 failed TIMEOUT!
Anyway, that is something that probably should be continued somewhere else…thanks!

Were you able to find any sort of solution to the erratic behavior? I have the exact same config, ubuntu 18.04, QGC 4.0.11 and Gazebo 9.16.0. I found this thread after following the instructions here: https://dev.px4.io/master/en/simulation/hitl.html, which do not work anymore, as no drone is spawned in iris.world… luckily, running hitl_iris.world now spawns a drone. When the drone takes off however, i see the same erratic behavior. Immediately doing a barrel roll and falling to the ground. Any known remedy for this?

I too am running into the issues that @jmalbert and @cschindlbeck are running into in regards to erratic behavior with the drone. Does this have to do with the iris model? I assume it has to do with the joint PID controllers but havent figured out how to solve it.

The erratic drone problem was due to the rotor links not being properly placed on the iris_hitl.sdf model. I went into the iris.sdf and copied over the proper rotor link positions and the drone looks like it has the propellors and rotors running properly now.

My main issue now is that when I try to arm and have the drone takeoff , the gazebo console log starts showing a “tx queue overflow” message repetitively. This causes the drone to not takeoff because it loses global position data.

I have followed all the steps from https://docs.px4.io/master/en/simulation/hitl.html, and can confirm I am using the same firm and tools like @cschindlbeck. I also start up the HIL system like @bperseghetti mentions on how to start it up. Finally I have looked into this “tx queue overflow” issue on forums and have not really been able to figure out why this might be happening. I believe QGC is using the serial connection (instead of the UDP one) to get the drone to takeoff, but I am not sure why it would be doing that. Any insights would be great.

2 Likes

Hi.
Try to change in the file “hitl_iris.world” value “real_time_update_rate” to 100 …150.

1 Like

Hi, I am following the instructions in https://docs.px4.io/master/en/simulation/hitl.html and I see a lot of references to iris, but I don’t see anything about the specific firmware for iris to load to pixhawk. Is the default px4 firmware tuned for iris?

Thanks,
Ahmad

For the erratic drone problem, after you followed all the steps from (Hardware in the Loop Simulation \(HITL\) | PX4 User Guide), then copy Tools/sitl_gazebo/worlds/hitl_iris.world and rename it to iris.world. Open the new .world file and find:

<uri>model://iris_hitl</uri>

modify to:

<uri>model://iris</uri>

save and reboot the gazebo, you’ll find that everything works.
@jmalbert @cschindlbeck

Hey, I’m experiencing some strange behavior in HITL mode, I get no global position, and baro #0 failed warnings. Iris wont takeoff in simulation (only spin its rotors) and in the QGC it prints some random numbers of height and vertical speed.

Any idea what is going on?