Imu

The IMU is composed of a gyroscope and an accelerometer, which measure the angular velocity and acceleration of the vehicle in the body frame, respectively. The bias/drift of the imu is given by a slowly varying random walk processes of diffusion, as described in [RNS+16], [May79].

File: imu.py
Author: Marcelo Jacinto (marcelo.jacinto@tecnico.ulisboa.pt)
License: BSD-3-Clause. Copyright (c) 2023, Marcelo Jacinto. All rights reserved.
Description: Simulates an imu. Based on the implementation provided in PX4 stil_gazebo (https://github.com/PX4/PX4-SITL_gazebo)

Classes:

IMU

The class that implements the IMU sensor.

class pegasus.simulator.logic.sensors.imu.IMU

Bases: Sensor

The class that implements the IMU sensor. This class inherits the base class Sensor.

Methods:

__init__([config])

Initialize the IMU class

update(state, dt)

Method that should be implemented by the class that inherits Sensor.

Attributes:

state

(dict) The 'state' of the sensor, i.e. the data produced by the sensor at any given point in time.

__init__(config={})

Initialize the IMU class

Parameters:

config (dict) – A Dictionary that contains all the parameters for configuring the IMU - it can be empty or only have some of the parameters used by the IMU.

Examples

The dictionary default parameters are

>>> {"gyroscope": {
>>>        "noise_density": 2.0 * 35.0 / 3600.0 / 180.0 * pi,
>>>        "random_walk": 2.0 * 4.0 / 3600.0 / 180.0 * pi,
>>>        "bias_correlation_time": 1.0e3,
>>>        "turn_on_bias_sigma": 0.5 / 180.0 * pi},
>>>  "accelerometer": {
>>>         "noise_density": 2.0 * 2.0e-3,
>>>         "random_walk": 2.0 * 3.0e-3,
>>>         "bias_correlation_time": 300.0,
>>>         "turn_on_bias_sigma": 20.0e-3 * 9.8
>>> },
>>>  "update_rate": 1.0}                 # Hz
update(state, dt)

Method that should be implemented by the class that inherits Sensor. This is where the actual implementation of the sensor should be performed.

Parameters:
  • state (State) – The current state of the vehicle.

  • dt (float) – The time elapsed between the previous and current function calls (s).

Returns:

(dict) A dictionary containing the current state of the sensor (the data produced by the sensor)

property state

(dict) The ‘state’ of the sensor, i.e. the data produced by the sensor at any given point in time