Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
sensors_hitl module

Simulated sensors for HITL (HardwareInTheLoop).

No detailed description...

Example for airframe file

Add to your firmware section: This example contains all possible configuration options, not all of them are mandatory!

<module name="sensors_hitl">
b'<define name="USE_BATTERY_MONITOR" value="FALSE|TRUE" />\n '
b'<configure name="HITL_PORT" value="UARTX|UDPX|usb_serial" />\n '
b'<configure name="HITL_BAUD" value="B921600" />\n '
</module>

Module configuration options

Configure Options

  • name: HITL_PORT value: UARTX|UDPX|usb_serial
    Description: Select port for extra datalink
  • name: HITL_BAUD value: B921600
    Description: Baudrate for extra datalink if link device is UART

Define Options

  • name: USE_BATTERY_MONITOR value: FALSE|TRUE
    Description: If the board is not powered from a real battery, set this flag to TRUE to override the battery voltage reading

Module functions

Init Functions

These initialization functions are called once on startup.

Event Functions

These event functions are called in each cycle of the module event loop.

Periodic Functions

These functions are called periodically at the specified frequency from the module periodic loop.

  • sensors_hitl_periodic()
    • Running at maximum module frequency.
    • Autorun: LOCK
      Periodic function automatically starts after init and can't be stopped.

Datalink Functions

Whenever the specified datalink message is received, the corresponing handler function is called.

  • on message HITL_IMU call sensors_hitl_parse_HITL_IMU(buf)
  • on message HITL_GPS call sensors_hitl_parse_HITL_GPS(buf)
  • on message HITL_AIR_DATA call sensors_hitl_parse_HITL_AIR_DATA(buf)

Files

Header Files

The following headers are automatically included in modules.h

Source Files

Raw sensors_hitl.xml file:

<!DOCTYPE module SYSTEM "module.dtd">
<module name="sensors_hitl" dir="sensors" task="sensors">
<doc>
<description>
Simulated sensors for HITL (HardwareInTheLoop).
</description>
<configure name="HITL_PORT" value="UARTX|UDPX|usb_serial" description="Select port for extra datalink"/>
<configure name="HITL_BAUD" value="B921600" description="Baudrate for extra datalink if link device is UART"/>
<define name="USE_BATTERY_MONITOR" value="FALSE|TRUE" description="If the board is not powered from a real battery, set this flag to TRUE to override the battery voltage reading"/>
</doc>
<dep>
<depends>imu_common,gps</depends>
<provides>imu,mag,gps,baro,airspeed</provides>
</dep>
<header>
<file name="sensors_hitl.h"/>
</header>
<init fun="sensors_hitl_init()"/>
<periodic fun="sensors_hitl_periodic()"/>
<event fun="sensors_hitl_event()"/>
<datalink message="HITL_IMU" fun="sensors_hitl_parse_HITL_IMU(buf)"/>
<datalink message="HITL_GPS" fun="sensors_hitl_parse_HITL_GPS(buf)"/>
<datalink message="HITL_AIR_DATA" fun="sensors_hitl_parse_HITL_AIR_DATA(buf)"/>
<makefile target="ap">
<configure name="HITL_PORT" case="upper|lower"/>
<configure name="HITL_BAUD" default="B921600"/>
<define name="HITL_DEVICE" value="$(HITL_PORT_LOWER)"/>
<define name="USE_$(HITL_PORT_UPPER)"/>
<define name="$(HITL_PORT_UPPER)_BAUD" value="$(HITL_BAUD)"/>
<include name="$(PAPARAZZI_HOME)/conf/simulator/nps"/>
<file name="sensors_hitl.c"/>
<test firmware="rotorcraft">
<include name="../../conf/simulator/nps"/>
<define name="PERIODIC_FREQUENCY" value="500"/>
<define name="HITL_DEVICE" value="usb_serial"/>
<define name="USE_USB_SERIAL"/>
</test>
</makefile>
</module>