Skip to content

Configuration:Sensors

Martin Scheiber edited this page Apr 26, 2023 · 2 revisions

Sensor Configuration

In general, there are two reasons to add an additional sensor to the flight stack: Estimation or Safety.

Adding a Sensor Flight Stack Umbrella

  1. Add the sensor to the sensors launched through the launch file fs_sensors in src/flightstack/flightstack_bringup. In multi-platform setups, be aware that you have the value dev_id to differentiate between the devices.

Watchdog and Autonomy Setup

These steps are optional, but update the safety features required for flying the new sensor.

Within this tutorial, the example sensor gnss_sensor, with the ROS node /gnss and topic /gnss/fix will be added. Additionally, a system driver checking and restarting script, called gnss_check.sh and gnss_restart.sh is available.

  1. Create an entry for the sensor in the nodes.yaml for the new sensor ROS node
# use the node name (exactly as in the ROS workspace for the entry)
/gnss: 
  # name of the entity
  entity_id: gnss_sensor
  # name of the driver entity associated with it
  driver_name: gnss_driver
  max_restart_attempts: 0
  restart_timeout: 1
  1. Create an entry for the sensor in the topics.yaml for the new sensor ROS topic
# use the topic name (exactly as in the ROS workspace for the entry)
/gnss/fix:
  # name of the entity
  entity_id: gnss_sensor
  # expected frequency [in HZ]
  rate: 100
  # rate delta allowed for non-critical failure [relative to rate]
  margin: 0.1
  # number of messages used to check the rate
  window: 100
  # severity level of failure
  severity: 0
  # name of the rosnode associated with it
  node_name: /gnss  # same as in 'nodes.yaml'
  # name of the driver associated with it
  driver_name: gnss_driver  # same as in 'drivers.yaml'
  1. Create an entry for the sensor in the drivers.yaml for the new sensor. Please note that for some sensors this is not required, as they do not need system-related checking. Example scripts for the Realsense can be found here.
# use the exact same name as in nodes.ini and topics.ini for value "driver_name"
gnss_driver:
  # name of the entity
  entity_id: gnss_sensor
  # path to script where the checking happens
  check_script: /${HOME}/flightstack_cws/src/flightstack/flightstack_scripts/driver_scripts/gnss_check.sh
  # path to script where the restarting happens
  restart_script: /${HOME}/flightstack_cws/src/flightstack/flightstack_scripts/driver_scripts/gnss_restart.sh
  1. In the autonomy engine's config add the action that should be performed in case of the sensor failure. If this is a GPS-based flight, we might want to immediatly land!
missions:

  mission_1:
    description: "Test"
    filepaths:
      - "/home/core/catkin_ws/src/flightstack/flightstack_bringup/trajectories/dh/test.csv"
    entities_actions:
      - ["gnss_sensor", "land"] # value 1 must be the same as the 'entity_id' value in the previous configs

Adding a Sensor to MaRS

To add additional sensors to MaRS we refer to the MaRS tutorial. In general, try to use a ROS wrapper that includes said sensor already. In our example, this could the mars_gps_wrapper or mars_vision_full_warpper.

Adding a Sensor to Data Recording

If you want to add the new sensor to the data recording module, adapt the global variables appropriately.

Assuming the provided scripts are used, add the following lines within the given example

# add to the list of sensor topics on device 1 (DEV1)
export FS_RECORD_ADD_DEV1_SENSOR=(
"/gnss/fix"
)

Then the topics will be automatically recorded on the selected device.