Capteur IMU pour la robotique

IMU and robotics: All you need to know

This entry was posted in Comparisons, tests and products presentation, Guides & tutorials on by Vanessa Mazzari.

 

In this article, we’ll be sharing all the information you need to buy the right IMU for your project. You will learn how an IMU works and how to interpret its data. At the end of the article, you will also find some links to tests and resources.

Definition – What is an IMU?

An inertial measurement unit (IMU) is an electronic component in the sensor family. It uses a combination of accelerometers, gyroscopes and magnetometers to measure sensor acceleration, angular velocity and orientation. A type I IMU consists of accelerometers and gyroscopes. A type II IMU also includes magnetometers.

The accelerometers, gyroscopes and magnetometers measure data along a single axis (X: pitch, Y: roll, Z: yaw). To get data for all three axes, you need to integrate three components of each (accelerometers, gyros and magnetometers), for a type II IMU. A typical IMU sensor has 9 DoF (degrees of freedom), including:

  • 3 accelerometers
  • 3 gyroscopes
  • 3 magnetometers

Some IMUs may have more degrees of freedom, with a temperature sensor, GPS sensor, pressure sensor, etc. They can perform attitude, velocity and position calculations based on acceleration.

Gyroscopes are used to calculate angular position. This type of IMU data is essential in mobile robotics. It is used alongside LiDAR and odometry measurements.

See our range of IMU.

Physics – How does an IMU work?

To understand how an IMU works, we must first analyse each sub-component:

Sub-component 1: accelerometer

An accelerometer is an electromechanical device used to measure acceleration forces. These forces can be:

  • static, such as the force of gravity
  • dynamic, such as motion and vibration forces

Acceleration is the measurement of a change in velocity, or velocity divided by time. For example, a bicycle that accelerates from standstill to 30 km/h in five seconds has an acceleration of 6 km/h per second (30 divided by 5).

Sub-component 2: gyroscope

A gyroscope is a device used to measure or maintain orientation and angular velocity. It’s a spinning wheel or disc wherein the axis of rotation is free to assume any orientation by itself. While rotating, the orientation of this axis is unaffected by tilting or rotation of the mounting, according to the conservation of angular momentum.

Sub-component 3: magnetometer

A magnetometer is a device that measures magnetism:

  • Its direction
  • Its strength
  • The relative change in a magnetic field at a particular location

A compass is one such device that measures the direction of an ambient magnetic field. In this case, the Earth’s magnetic field.

ROS – Transferring IMU data

All ROS-compatible IMU sensors publish their data on the /imu topic in the sensor_msgs/Imu.msg message format:

std_msgs/Header
header geometry_msgs/Quaternion
orientation float64[9]
orientation_covariance geometry_msgs/Vector3 angular_velocity float64[9] angular_velocity_covariance
geometry_msgs/Vector3 linear_acceleration float64[9] linear_acceleration_covariance

Orientation

3D rotation and orientation can be represented as Euler angles or quaternions.

Euler angles

Euler angles are represented by three angle values for the X, Y and Z axes. Each rotation value is applied sequentially, i.e. in turn. Benefit: Euler angles have an intuitive “human readable” format. Limitation: In some configurations, Euler angles suffer from Gimbal lock, which is the loss of one degree of freedom.

When applying the three rotations in turn, it is possible for the first or second rotation to result in the third axis pointing in the same direction as one of the previous axes. The third rotation value cannot then be applied around a unique axis.

Quaternions

Quaternions can be used to represent the orientation or rotation of an object. This representation consists of four numbers (referenced in unity as x, y, z & w). You should keep in mind that these values do not represent angles or axes and you never normally need to access them directly.

Benefit: Quaternion rotations do not suffer from Gimbal lock.

Limitation: A single quaternion cannot represent a rotation exceeding 180 degrees in any direction and is not intuitively understandable.

Angular velocity

Angular velocity is represented by a three-dimensional vector (x, y and z), with angular velocity values dependent on the x, y and z axes.

Linear acceleration

Linear acceleration is represented by a three-dimensional vector (x, y and z), with linear acceleration values depending on the x, y and z axes.

Covariance

For sensors, covariance is the level of confidence in sensor accuracy. Covariance can be static according to sensor performance or continuously updated by changing over time according to an estimate of accuracy.

The same applies to IMUs; they can have a static or dynamic covariance. Each parameter has an associated covariance coefficient, which is hard-coded or processed by the sensor software and indicates how reliable the value might be.

Overview of IMU characteristics

Energy consumption

When determining the power requirements of your robotics project, you’ll need to consider how and for how long you intend to use your machine. The following parameters are important for battery-operated sensors:

  • Supply voltage in volts
  • Operating current in amperes
  • Power in watts

Sensor characteristics

The digital resolution describes the overall sensing capability of your sensor and consists of two parts: 1. Range => the amount of movement that the sensors accommodate:

  • For accelerometers, this is measured in G forces
  • Gyroscopes are classified according to the angular rotation rate they can quantify in degrees/second
  • Magnetometers measure their capabilities in µT, which can vary depending on the axis of the sensor (x, y, z)

2. Sensitivity => an absolute number representing the smallest amount of change that can be measured and detected. For sensors, this is related directly to the number of bits reserved for the sensor in question. The more bits, the higher the sensitivity.

Zero gravity offset: the reading on the accelerometer when no external force is applied, which is the minimum error it will detect.

Zero rate offset: the offset in value of the gyroscope when there is no angular motion present, which can be temperature dependent.

Data rate: the number of measurements taken over a given period of time. When choosing your IMU, make sure the sensor rates supported match your application needs.

Noise density: defined in units per square root bandwidth, typically:

  • ug/sqrt(Hz) for accelerometers
  • deg/s/sqrt(Hz) for gyroscopes

Bandwidth: the frequency range within which an accelerometer or gyroscope operates.

Interfaces: the communication cable and protocol used for the IMU and your embedded system.

Temperature range: minimum and maximum ambient temperature within which sensors can safely operate to provide accurate measurements.

Output parameters

Static accuracy: accuracy of the sensor output while the device is relatively stable/motionless.

Dynamic accuracy: accuracy of the sensor output while the device is in motion.

Rotation error: difference between outputted vector and truth vector, measured in degrees.

Heading error: difference between outputted yaw and truth yaw, measured in degrees.

Heading drift: accumulated error as a function of time.

Raw accel/gyro/mag: the raw output of each sensor before any processing.

Calibrated accel/gyro/mag: the output of each sensor after sensor fusion has been used to process and clean up each signal.

Calibration

Once you’ve examined the sensor output parameters, there is another thing you’ll need to consider: calibration. The calibration options you choose will depend on your budget and project needs. Once you’ve examined the sensor output parameters, there is another thing you’ll need to consider: calibration. The calibration options you choose will depend on your budget and project needs.

Nominal: nominal calibration uses average values for the sensor to give it an average performance.

Per-device: per-device calibration calibrates certain factors like sensor gain on a sensor-by-sensor basis. You can choose to calibrate according to a single axis or multiple axes, depending on your application.

Dynamic: if you find the nominal calibration is acceptable, sensor output may still be improved dynamically while in-field. Sensor characteristics vary with temperature and can be adjusted as the sensor is used in its final application.

Data fusion algorithms

Kalman filter

The Kalman filter implements a model:

  • First, the filter makes an assumption about the sensor’s next output value based on its model
  • It then takes the measured value and compares it with its assumption
  • Finally, it updates its model to make more accurate assumptions for the next measurement

Each sequence of data obtained from the sensors is used to statistically improve the model in order to calculate outputs. At the same time, sensor accuracy is also judged. The model is dependent on sensor error and the application in question. For mobile robotics systems, real-world knowledge also tells us that physical objects move smoothly and continuously through space, rather than teleporting into space as sample GPS coordinates might indicate.

This means that if a sensor that has always given consistently excellent values starts telling you unlikely things (like GPS/radio systems when you enter a tunnel), the credibility rating of the sensors decreases in iterations of a few milliseconds until it starts measuring coherent values again. This is better than simply calculating an average, because the Kalman filter can manage most sensors that become temporarily inaccurate. However, there must be at least one sensor capable of transmitting relatively accurate values.

This will ensure the robot is functioning properly until such time as the other sensors are working normally again. The Kalman filter applies the more general concepts of Markov chains and Bayesian inference, which are mathematical systems that iteratively refine their assumptions based on proof.

Basic concept of the Kalman filter
Diagram of the Kalman filter logic. Image created by Petteri Aimonen via Wikimedia Commons.

PID filters

Simpler robotics systems can be equipped with PID filters. These are like primitive Kalman filters fed by a single sensor, with all the iterative settings cut off and replaced with three fixed values (kp, ki and kd). It is a correction system that adjusts the input through the control loop to obtain the correct output. Even when PID values are set automatically or manually, the whole “tuning” process (adjust, fly, judge, repeat) is an externalised version of Kalman with a human carrying out the belief-propagation step.

Custom filters

Real systems are often hybrids, somewhere between the two.

ROS IMU packages

If you run your robot software under a ROS, it would be easier to buy ROS-compatible sensors. This means that the manufacturer will have already developed an ROS package to make the sensor interact under the ROS, which will save you time. As far as IMUs are concerned, the sensor will publish raw or processed data, depending on how you use your IMU, on the /imu topic. Then, on the ROS, you can subscribe to the topic to get data that you can use for navigation for example. Some ROS packages are already implemented and up to date:

  • imu_transformer : Package providing a node/nodelet combination that can be used to transform IMU data from one TF frame into another
  • imu_tools :
    • Imu_filter_madgwic : Filter that fuses angular velocities, accelerations and (optionally) magnetic readings from a generic IMU device into an orientation, based on code by Sebastian Madgwick
    • Imu_complementary_filter : Filter that fuses angular velocities, accelerations and (optionally) magnetic readings from a generic IMU device into a quaternion to represent the orientation of the device with regard to the global frame, based on the algorithm by Roberto G. Valenti
    • rviz_imu_plugin: Plugin for rviz that displays sensor_msgs::Imu messages
  • imu_utils : Package for tracking IMU performance on MATLAB

Choosing the right IMU

  • Integrated computations
  • Integrated filters
  • Embedded microcontroller
  • Board library (Arduino, Raspberry Pi, etc.)
  • ROS compatibility
  • Interface

You should choose your IMU according to your project requirements. The cheapest IMU provides only raw values, whereas UM7 filters the processed values and publishes them directly in a ROS message. Performance is quite similar, even with the most expensive IMUs. The difference lies in their additional services and uses:

IMU performance

An IMU sensor is a useful component to add on your robot. It will give you information on attitude, orientation, position, velocity, acceleration and rotation speed if the values are calculated. Nevertheless, you must bear in mind that IMUs are prone to drift errors. Errors accumulate over time, as new values are based on previous ones. Moreover, IMUs, which use the magnetic field to calculate values, can be affected by other magnetic fields (motor, metal structure, etc.), which can result in huge errors.

You can make corrections and use filters to reduce these errors, but an IMU error will continuously drift and increase. One way to solve this problem is to take into account the covariance value (confidence level), which can change over time if it’s dynamic. Another way is to add a GPS sensor. A GPS signal can update an IMU value and correct its drift error.

If you’re looking for real results, check out this online visualisation of IMU and EMG sensor data for assessment of wrist load test , which will give you an idea of IMU errors (parts 2.1 and 3.1). This other article lists and describes all the IMU biases that lead to errors . Here you will find a quick and efficient method for evaluating an IMU.

Conclusion: advantages and disadvantages of IMUs

Benefits of an IMU

  1. An inertial navigation system is not dependent on any external information and does not consume too much energy
  2. An inertial navigation system can provide location, velocity, attitude and angle data, and the resulting navigation information is continuous
  3. It provides high-frequency measurements and is stable

Limitations of an IMU

  1. It uses information from the integrated navigation system, so positioning errors increase over time and long-term accuracy is low
  2. It requires initial alignment before each use, which takes time
  3. It does not provide time information

Our team can help you with your robotics projects – Contact our experts: