SITL Protocol for Custom Simulators

Hi all,
I’m looking into possibly interfacing ArduCopter SITL with a custom, in-house developed vehicle simulator (our simulator handles flight dynamics and world/environment modelling and can generate real-time simulated sensor state). Unfortunately I have little experience with ArduCopter and was hoping someone here could point me towards documentation or code examples regarding the simulator communication protocols.

After a quick search of the forum, it looks like some people have attached custom simulators using specialized protocols for other sims, e.g., Gazebo (SITL with custom FDM). Is there a standard or preferred simulator interface for ArduCopter similar to PX4’s simulator Mavlink API (https://dev.px4.io/v1.9.0/en/simulation/)?

(Search also suggests that HIL is no longer supported in current ArduCopter releases, correct?)

Thanks!

I would recommend the JSON backed, we have python and MATLAB (and Simulink) examples that used it.Your correct, HITL is no longer supported.

We also have a Simulation channel over on Discord, https://discord.gg/3eDNcx

Hello,

Adding a new backend is quite easy. You can look at other backend into libraries/SITL directory (like Gazebo for example). But most use the old custom fdm through raw socket… It works but it is a pain to maintain.
I also recommend you to based you backend on the new JSON backend. It is more flexible and quite easy to understand. Morse and AirSim backend also use the json messaging so it is already well tested method !

The JSON interface looks like exactly what I was looking for. There’s a line in the readme.md that brings up one additional question:
“The SIM_RATE_HZ should value be kept above the vehicle loop rate, by default this 400hz on copter and quadplanes and 50 hz on plane and rover.”

Does that mean those are minimum recommended update rates for copters and fixed wing respectively?

yep!
Ideally, if you can have a 1000hz loop rate that is good, but 800 for copter is fine too !