About
While comparing functionality of Simulator interface for SITL (Software In The Loop) and HITL (Hardware In The Loop) simulations, I’ve noticed in the simulation documentation that:
SITL build of PX4 uses SimulatorMavlink.cpp (opens new window) to handle these messages while a hardware build in HIL mode uses mavlink_receiver.cpp
And it seems like for SITL, the HIL messages are sent through TCP connection (port 4560), and with HITL it uses the serial port connection (by default: /dev/ttyACM0).
Question
Why is the Simulator ↔ SITL interface done via TCP? Any reason why it’s not done through UDP?
Why does the Simulator need a dedicated SimulatorMavlink.cpp (opens new window) , other than the already existing mavlink_receiver.cpp to support HIL message interactions?
What would be the disadvantage to pipe in the HIL messages through a UDP port, so that it gets handled in mavlink_receiver.cpp ?
Perhaps @Jaeyoung-Lim you have comment in these topics?
Because all messages need to arrive exactly once and in order for lockstep to work.
Because that’s how it was done initially, and sometimes it’s handy as simulator specific functionality can be put there:
opened 12:49AM - 27 Mar 17 UTC
closed 09:35AM - 28 Mar 17 UTC
sitl
question
Simulation
Hi,
I am doing some` SITL` and `HIL` experiments in `gazebo`. When I learn th… e inner operating mechanisms of the `SITL` loop, I find the `mavlink` module dose nothing related with the connection between gazebo and the px4 package, but the `simulator` module dose , which receives the vehicle status from gazebo and send back the control commands using socket with TCP/IP protocols.
I tried to figure out the difference among `SITL` , `HIL`, and the onboard loop(which refers to when pixhak FMU is mounted on a` fw` or `mc` plane), finding that it is the `mavlink` module who bears the task of communication with ROS node and QGC in HIL and onboard situations.
I wonder if there is something I misunderstand, and why do not use the `mavlink` module in the `SITL` loop as well?
Thanks.
We could probably make it work. I believe @dagar was in favor of changing this too.
1 Like