Difference between revisions of "HITL"

From PaparazziUAV
Jump to navigation Jump to search
Line 16: Line 16:
Note that a high baudrate (at least 57600) is required to allow the '''COMMANDS''' messages to be correctly transmitted.
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 <tt>simhitl</tt> simulator agent, ran with the <tt>-ac HITL</tt> 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.
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).
<aircraft name="HITL" ac_id="7"
  airframe="airframes/tiny_hitl.xml"
  telemetry="telemetry/hitl.xml"
  ...
/>
The '''HITL''' session entry gives an example of the corresponding session involving the <tt>simhitl</tt> simulator agent, ran with the <tt>-ac HITL</tt> 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.
<session name="HITL">
  <program name="Hardware in the Loop">
  <arg flag="-a" constant="HITL"/>
  <arg flag="-noground"/>
  <arg flag="-boot"/>
  </program>
  <program name="Data Link">
  <arg flag="-s" constant="57600"/>
  </program>
</session>


==Datalink through the USB link==
==Datalink through the USB link==
''coming soon''
''coming soon''

Revision as of 01:27, 19 April 2009

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).

<aircraft name="HITL" ac_id="7"
 airframe="airframes/tiny_hitl.xml"
 telemetry="telemetry/hitl.xml"
 ...
/>

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.

<session name="HITL">
 <program name="Hardware in the Loop">
  <arg flag="-a" constant="HITL"/>
  <arg flag="-noground"/>
  <arg flag="-boot"/>
 </program>
 <program name="Data Link">
  <arg flag="-s" constant="57600"/>
 </program>
</session>

Datalink through the USB link

coming soon