HITL vs SITL: when to choose one over the other?

I need some clarification.

What are the real differences between SITL and HITL other than using an actual Pixhawk to run PX4? Are there things I can do in HITL that are not possible using SITL? What can I accomplish with HITL that I can’t with SITL?

I have been using SITL to simulate autonomous missions using Python scripts. This involves manually entering GPS coordinates into a script. My goal is to get beyond software-only simulation and start using some real hardware to feed data to the sim. Is there some way to feed GPS parameters to SITL via MAVLink using external hardware?

Final question: I am using hexacopters. I notice that both jMAVSim and Gazebo have quadcoprters but not hex’s. Can I run HITL with my Pixhawk/PX4 set up as a hex?

Thanks for any light you can shed.

Joe

I find HITL mode useful to test that my flight control software will actually work on real hardware (like Pixhawk). SITL mode is running the PX4 software in Linux on your PC which is a vastly superior performing computer than the tiny little ARM Cortex M4 chip in the Pixhawk. So I find comfort in knowing that the real Pixhawk hardware can handle the job. Perhaps I’m just being paranoid, but I’ve also found bugs in PX4 HITL mode that didn’t appear in SITL mode, like multithreaded mavlink issues and so on. So I think it’s good practice if you are into simulation to try both SITL and HITL. I don’t think HITL has any more “features”. Features of course are just the list of modules you include in the PX4 build, so you choose which features you want either way. Both SITL and HITL get sensor data to the PX4 software (including GPS) via the HIL_SENSOR message. See https://dev.px4.io/en/simulation/ for more information.

As for hexacopter simulation models, I don’t know about jMAVSim and Gazebo, but I did play with building a hexacopter model for AirSim, see AirSim hexacopter. Some of that article may help you get a hexacopter working in jMAVSim also.

2 Likes

HITL is also useful for testing payloads and peripherals, like camera triggering etc

1 Like

You can use MAVLink to sends GPS points, missions, and other commands to PX4. What language are you programming in?

We have basically bypassed the sim and have been developing C++ code to send MAVLink commands to the actual Pixhawk. Right now we are not using simulation, but may come back to it in the future.

Thanks for the responses
Joe