Setting up accurate SITL configuration

Hello all,

I am trying to understand how to set up SITL (via sim_vehicle.py) to most accurately represent how ardupilot will act on the aircraft hardware, and have the below questions:

  1. SITL version - If I have checked out an ardupilot tag (ex. Plane-4.3.7) then is the SITL build automatically running the 4.3.7 version of the firmware if I am using sim_vehicle.py? Or is that something I need to configure somewhere?

  2. Board version - Does building with ./waf for the target hardware (ex. CubeOrange) do anything to configure how SITL performs? Or is there a way to configure SITL as if it were running on the CubeOrange? Is this an I-don’t-know-what-I’m-talking-about question?

  3. Params - I have a param file pulled from an aircraft that I would like to run with, but I have also pulled params from an ardupilot SITL instance and found that there are a significant number of “SIM_” params in that file that do not exist in my aircraft param file. Would I need to add those into my aircraft param file to be able to run with it in SITL?

  4. Serial connections - I am interested in interacting with the telem2 port (Serial 2) on the physical pixhawk, at particular data rates for the different message params ex SR2_ADSB. But in SITL, the telem2 port does not exist. I believe I can set up a serial interface with the SITL instance, but since that interface is not associated with Serial 2(?) I’m not sure how to configure the individual message rates.

Even if you don’t know answers to all of these questions, any help is appreciated! Thanks!

Hello,

Some answers :
sim_vehicle.py is just a python launcher for SITL not SITL itself.

  1. Yes, if you checkout an ardupilot release or a git tag, SITL will be build with this version.

  2. There is not board for SITL as it stand for Software In The Loop ! So that is pure software simulation. It is closer to the Linux Hal than the STM32 hardware that run Chibios like on CubeOrange, but that shouldn’t matter.
    For now, there is not easy way as the hwdef on Chibios to modify which lib you want to use, so by default , SITL have all hardware support. But on otherside, you rarely lack CPU power on a normal computer.

  3. SIM_* Params are specific to SITL, they allow to control how the simulation is working. They are always present. Using your own plane parameter, specially the tunning, will need some modification on SITL to match your drone performance. I don’t know how to do it on plane thus …

  4. SITL has virtual serial port. By default, we are using TCP socket : see SITL Simulator (Software in the Loop) — Dev documentation
    You can then connect MissionPlanner or anything speaking Mavlink to the computer running SITL port 5762 in TCP and have the telemetry and be able to control the message rate . In fact, most GCS set automatically some default rate for you ! By default , ArduPilot doesn’t send anything on serial ports.

1 Like

Thank you very much!

One follow-up on the virtual serial ports:

I am able to set up a virtual serial port with the --out=/dev/ttyUSB0 argument for sim_vehicle.py, and receive traffic on the other end of that connection. But when I try to set up a specific serial port as linked in your SITL documentation with ex -A --serial5=/dev/ttyUSB0 and the SERIAL5_PROTOCOL parameter value set to anything other than -1, I get an error in the ArduPlane terminal: PANIC: Invalid device path: /dev/ttyUSB0. Do you know why I would be able to use this output port with the --out argument but not the --serialX argument?

Thanks!