Qualcomm Robotics RB5 - IMU
IMU
The Qualcomm Robotics RB5 Platform comes with the ICM-42688-P, a 6-axis IMU that combines a 3-axis gyroscope and a 3-axis accelerometer. In this section, we will learn how to extract information on angular velocity, linear acceleration, and timestamp metadata.
Hardware configuration
Before moving forward with the software configuration, ensure you have the proper hardware configuration for your setup. More specifically, check the DIP switch settings for your specific board.
You can verify if the accelerometer is working by using the following binary:
ssc_drva_test -sensor=accel -duration=5 -sample_rate=50
You should see an output similar to the following:
39 ssc_drva_test version 1.13 39 ssc_drva_test -sensor=accel -duration=5 -sample_rate=50 39 handle_event 39 event_cb attribute event for da_test 39 handle_event 39 event_cb attribute event for da_test 39 using da_test name=da_test, suid = [high addeaddeaddeadde, low addeaddeaddeadde 39 enter send_memory_log_req cookie: 39 39 exit send_memory_log_req 39 enter da_test runner 39 handle_event 39 -time_to_first_event=2260387 39 -time_to_last_event=-147433 39 -sample_ts=179117069042 39 -total_samples=248 39 -avg_delta=377490 39 -recvd_phy_config_sample_rate=50 39 -random_seed_used=2927366375 39 -num_request_sent=2 39 -first_sample_timestamp=179023325647 39 handle_event 39 received event: PASS 39 enter send_memory_log_req cookie: 39 39 exit send_memory_log_req 39 PASS
Accelerometer + Gyroscope
If you are running the Qualcomm RB5 software environment, you will already have existing IMU interfaces. First, you will need to check if the imud service is running. You can do so by running the following command:
$ systemctl status imud
The output should look similar to this:
● imud.service - imud Service Loaded: loaded (/etc/imud.sh; static; vendor preset: enabled) Active: active (running) since Wed 2024-03-20 16:35:42 UTC; 2h 50min ago Process: 876 ExecStart=/etc/imud.sh start (code=exited, status=0/SUCCESS) Main PID: 891 (imud) Tasks: 4 (limit: 6291) Memory: 4.9M CGroup: /system.slice/imud.service └─891 /sbin/imud
This service provides an interface for sending commands to the IMU through sockets, specifically the /run/imud_socket.
Initialization
Once you establish the connection to the socket, you can configure your IMU. Each sensor has a specific ID and a configurable sample rate.
Sensor | Sensor ID | Sample rate |
---|---|---|
Accelerometer | 0 | 1-1000 Hz |
Gyroscope | 1 | 1-1000 Hz |
Each message also has a specific ID. The initialization process requires the following commands:
Command | Command ID |
---|---|
START | 2 |
STOP | 3 |
CONFIG RATE | 12 |
CONFIG DATATYPE | 13 |
- To configure the accelerometer
- Send configuration type message with accelerometer ID (0)
- Send configuration message to configure sample rate (1-1000 Hz)
- To configure the gyroscope
- Send configuration type message with gyroscope ID (1)
- Send configuration message to configure sample rate (1-1000 Hz)
- To start streaming data
- Send start command with accelerometer ID
- Send start command with gyroscope ID
Now that we are producing data, the second interface we will need is memory mapping the IMU output. The /run/imu_map acts as an interface to access sensor data. By using memory mapping techniques, we access the sensor's output data. The incoming data is structured as follows:
IMU Output data |
---|
Acceleration X (float) Acceleration Y (float) Acceleration Z (float) Accel timestamp (unsigned int 64) Angular velocity X (float) Angular velocity Y (float) Angular velocity Z (float) Gyro timestamp (unsigned int 64) |