HITL

From PaparazziUAV
Revision as of 12:58, 18 April 2009 by HectoPascal (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Hardware In The Loop Simulation

Principle

While the Software In The Loop simulation (SITL) executes the airborne code on the ground host, HITL is a way to run the autopilot code on the actual hardware in an environment where sensors and actuators are simulated. Two processes are involved:

  • The real autopilot code on the control board;
  • A flight model combined with a model of the actuators and the sensors.

Commands computed by the autopilot are sent to the flight model which sends back simulated values of the sensors output (e.g infrared and GPS).

In Paparazzi, the link between the two processes is done through the telemetry/datalink:

  • Commands are sent through the standard COMMANDS telemetry message. Since the refresh rate must be high enough, a special telemetry file will be used (settings/hitl.xml)
  • Sensor values are sent through the HITL_UBX (GPS) and HITL_INFRARED datalink messages.

Configuration

The airborne code has to be compiled with a specific flag to use these HITL messages instead of the sensors. The following line must be added in the makefile section of the airframe file (here for a Tiny 1 board where the modem is plugged to the UART0):

ap.CFLAGS += -DHITL -UGPS_CONFIGURE -UUART0_BAUD -DUART0_BAUD=B57600

Note that a high baudrate (at least 57600) is required to allow the COMMANDS messages to be correctly transmitted.

The code has to be compiled (ap target) as usual and uploaded to the board. The HITL A/C entry provides an example of configuration for a Tiny 1 board (set UART1_BAUD for a Tiny 2). The HITL session entry gives an example of the corresponding session involving the simhitl simulator agent, ran with the -ac HITL option (the name of the simulated aircraft), and the standard link, server and GCS. The link can be done with a serial cable (probably through USB) or with the installed modem.