Question for HITL code in firmware

Hi, all,

I would like to ask two questions for HITL (Hardware In The Loop).
1 . Does MAVlink send and receive physics data?
In this context, I referred physics data to sensor data, motor data and so on.
If it is not true, which ports (or comm protocols) are responsible for such data communication.

  1. Are HIL functions already included in firmware (e.g., fmuv2 or v4)?
    Some old board has its own HIL configuration. However, other boards do not have such setting.
    When I took a look at codes such as fmuv2 firmware, I found ‘set_hil_enabled’ function in firmware.
    So, are such functions are included?
    Otherwise, do you have any idea about how to compile ‘HIL’ firmware?

Note that I ordered a pixracer board via purchase manager in the lab but it takes time. So, I cannot currently test and setup HITL.

Yes PX4 has HIL and it works with with jmavsim, X-Plane, and Flightgear although I’d recommend you also try SITL (software in the loop) with gazebo.

https://dev.px4.io/simulation-gazebo.html

I guess you may misunderstand what I said (if it is not true, sorry)

Suppose I compiled a firmware with ‘make px4fmu-v4_default’
This firmware is compiled to fly real drone.
In this case, does this firmware include HITL functions for HITL testing without firmware recompilation or modification?

Yes it does. There’s no special HIL firmware, however there are specific airframe configurations you have to choose for HIL.
https://dev.px4.io/simulation-hitl.html

There’s no need to wait for hardware though. You could be running simulation in software (same code) in a few minutes.

I appreciate your help. Thank you.