Robot Control Library
rc_mpu_config_t Struct Reference

configuration of the mpu sensor More...

#include <rc/mpu.h>

Data Fields

physical connection configuration
int gpio_interrupt_pin_chip
 gpio pin, default 3 on Robotics Cape and BB Blue More...
 
int gpio_interrupt_pin
 gpio pin, default 21 on Robotics Cape and BB Blue More...
 
int i2c_bus
 which bus to use, default 2 on Robotics Cape and BB Blue More...
 
uint8_t i2c_addr
 default is 0x68, pull pin ad0 high to make it 0x69 More...
 
int show_warnings
 set to 1 to print i2c_bus warnings for debug More...
 
accelerometer, gyroscope, and magnetometer configuration
rc_mpu_accel_fsr_t accel_fsr
 accelerometer full scale range, default ACCEL_FSR_8G More...
 
rc_mpu_gyro_fsr_t gyro_fsr
 gyroscope full scale range, default GYRO_FSR_2000DPS More...
 
rc_mpu_accel_dlpf_t accel_dlpf
 internal low pass filter cutoff, default ACCEL_DLPF_184 More...
 
rc_mpu_gyro_dlpf_t gyro_dlpf
 internal low pass filter cutoff, default GYRO_DLPF_184 More...
 
int enable_magnetometer
 magnetometer use is optional, set to 1 to enable, default 0 (off) More...
 
DMP settings, only used with DMP mode
int dmp_sample_rate
 sample rate in hertz, 200,100,50,40,25,20,10,8,5,4 More...
 
int dmp_fetch_accel_gyro
 set to 1 to optionally raw accel/gyro when reading DMP quaternion, default: 0 (off) More...
 
int dmp_auto_calibrate_gyro
 set to 1 to let DMP auto calibrate the gyro while in use, default: 0 (off) More...
 
rc_mpu_orientation_t orient
 DMP orientation matrix, see rc_mpu_orientation_t. More...
 
double compass_time_constant
 time constant (seconds) for filtering compass with gyroscope yaw value, default 25 More...
 
int dmp_interrupt_sched_policy
 Scheduler policy for DMP interrupt handler and user callback, default SCHED_OTHER. More...
 
int dmp_interrupt_priority
 scheduler priority for DMP interrupt handler and user callback, default 0 More...
 
int read_mag_after_callback
 reads magnetometer after DMP callback function to improve latency, default 1 (true) More...
 
int mag_sample_rate_div
 magnetometer_sample_rate = dmp_sample_rate/mag_sample_rate_div, default: 4 More...
 
int tap_threshold
 threshold impulse for triggering a tap in units of mg/ms More...
 

Detailed Description

configuration of the mpu sensor

Configuration struct passed to rc_mpu_initialize and rc_mpu_initialize_dmp. It is best to get the default config with rc_mpu_default_config() function first and modify from there.

Examples:
rc_altitude.c, rc_balance.c, rc_calibrate_accel.c, rc_calibrate_gyro.c, rc_calibrate_mag.c, rc_test_dmp.c, rc_test_dmp_tap.c, and rc_test_mpu.c.

Field Documentation

◆ gpio_interrupt_pin_chip

int gpio_interrupt_pin_chip

gpio pin, default 3 on Robotics Cape and BB Blue

Examples:
rc_test_dmp.c.

◆ gpio_interrupt_pin

int gpio_interrupt_pin

gpio pin, default 21 on Robotics Cape and BB Blue

Examples:
rc_test_dmp.c.

◆ i2c_bus

int i2c_bus

which bus to use, default 2 on Robotics Cape and BB Blue

Examples:
rc_calibrate_accel.c, rc_calibrate_gyro.c, rc_calibrate_mag.c, rc_test_dmp.c, rc_test_dmp_tap.c, and rc_test_mpu.c.

◆ i2c_addr

uint8_t i2c_addr

default is 0x68, pull pin ad0 high to make it 0x69

◆ show_warnings

int show_warnings

set to 1 to print i2c_bus warnings for debug

Examples:
rc_test_dmp.c, and rc_test_mpu.c.

◆ accel_fsr

rc_mpu_accel_fsr_t accel_fsr

accelerometer full scale range, default ACCEL_FSR_8G

◆ gyro_fsr

gyroscope full scale range, default GYRO_FSR_2000DPS

◆ accel_dlpf

rc_mpu_accel_dlpf_t accel_dlpf

internal low pass filter cutoff, default ACCEL_DLPF_184

◆ gyro_dlpf

rc_mpu_gyro_dlpf_t gyro_dlpf

internal low pass filter cutoff, default GYRO_DLPF_184

◆ enable_magnetometer

int enable_magnetometer

magnetometer use is optional, set to 1 to enable, default 0 (off)

Examples:
rc_test_dmp.c, and rc_test_mpu.c.

◆ dmp_sample_rate

int dmp_sample_rate

sample rate in hertz, 200,100,50,40,25,20,10,8,5,4

Examples:
rc_altitude.c, rc_balance.c, and rc_test_dmp.c.

◆ dmp_fetch_accel_gyro

int dmp_fetch_accel_gyro

set to 1 to optionally raw accel/gyro when reading DMP quaternion, default: 0 (off)

Examples:
rc_altitude.c, and rc_test_dmp.c.

◆ dmp_auto_calibrate_gyro

int dmp_auto_calibrate_gyro

set to 1 to let DMP auto calibrate the gyro while in use, default: 0 (off)

◆ orient

DMP orientation matrix, see rc_mpu_orientation_t.

Examples:
rc_balance.c, and rc_test_dmp.c.

◆ compass_time_constant

double compass_time_constant

time constant (seconds) for filtering compass with gyroscope yaw value, default 25

◆ dmp_interrupt_sched_policy

int dmp_interrupt_sched_policy

Scheduler policy for DMP interrupt handler and user callback, default SCHED_OTHER.

Examples:
rc_test_dmp.c.

◆ dmp_interrupt_priority

int dmp_interrupt_priority

scheduler priority for DMP interrupt handler and user callback, default 0

Examples:
rc_test_dmp.c.

◆ read_mag_after_callback

int read_mag_after_callback

reads magnetometer after DMP callback function to improve latency, default 1 (true)

Examples:
rc_test_dmp.c.

◆ mag_sample_rate_div

int mag_sample_rate_div

magnetometer_sample_rate = dmp_sample_rate/mag_sample_rate_div, default: 4

◆ tap_threshold

int tap_threshold

threshold impulse for triggering a tap in units of mg/ms


The documentation for this struct was generated from the following file: