61 "data is returned each time get() is called, hence timing may not be very "
62 "accurate depending on how regularly get() is called. FIFO collects accel and gyro data "
63 "at the exact rates specified by parameters arate, grate into a 1kb FIFO queue, and "
64 "get() takes that data back from the FIFO. DMP runs the embedded "
65 "digital motion processor on raw data, and accumulates resulting output "
66 "data into the IMU's internal FIFO buffer at a precise, fixed rate. This "
67 "parameter can only be set in a module's params.cfg file.",
68 Mode::RAW, Mode_Values, ParamCateg);
72 "Use any string of letters including:"
75 "M=magnetometer (compass), "
76 "R=quaternion 6 (uses accel + gyro), "
77 "Q=quaternion 9 (uses accel + gyro + compass), "
78 "E=geomag (uses accel + compass), "
79 "P=flip/pickup detection, "
81 "T=activity recognition, "
82 "F=frame sync from video sensor, "
83 "w=configure activity recognition for wearable, "
84 "g=gyro calibration (always on when gyro used), "
85 "m=compass calibration (always on when compass used), "
86 "b=accel accuracy (always on when accel used), "
87 "h=gyro accuracy (always on when gyro used), "
88 "n=compass accuracy (always on when compass used).",
97 "accelerometer. Actual sample rate may differ because of finite and "
98 "discrete divider settings. In FIFO mode, grate controls the data rate.",
103 "gyroscope. Actual sample rate may differ because of finite and "
104 "discrete divider settings. In FIFO mode, grate controls the data rate.",
112 "magnetometer, or Once to only get one measurement. You can repeatedly "
113 "set this parameter to Once to obtain repeated measurements "
114 "at your own pace. In JeVois Inventor, you need to alternate between "
115 "Off and Once. In FIFO mode, grate controls the data rate.",
116 MagRate::M50Hz, MagRate_Values, ParamCateg);
120 "low-pass filter on accelerometer data.",
121 50, { 0, 6, 12, 24, 50, 111, 246, 470, 1210 }, ParamCateg);
125 "filter on gyroscope data.",
126 51, { 0, 6, 12, 24, 51, 120, 150, 200, 360, 12100 }, ParamCateg);
130 "temperature sensor. Temperature sampling rate is always 1125Hz unless "
131 "tbw is 7932, in which case sampling is at 9kHz.",
132 34, { 0, 9, 17, 34, 66, 123, 218, 7932 }, ParamCateg);
137 4, { 2, 4, 8, 16 }, ParamCateg);
141 "500 means +/-500 degrees per second)).",
142 500, { 250, 500, 1000, 2000 }, ParamCateg);
200 public Parameter<imu::mode, imu::dmp, imu::arate, imu::grate, imu::mrate, imu::abw, imu::gbw,
201 imu::tbw, imu::arange, imu::grange, imu::pktdbg>
205 ICM20948(std::string
const & instance);
245 void sleep(
bool enable);
246 void cycle(
bool enable);
250 std::shared_ptr<IMU> itsIMU;
252 void onParamChange(imu::arate
const & param,
float const & newval)
override;
253 void onParamChange(imu::grate
const & param,
float const & newval)
override;
254 void onParamChange(imu::mrate
const & param, imu::MagRate
const & newval)
override;
255 void onParamChange(imu::abw
const & param,
unsigned int const & newval)
override;
256 void onParamChange(imu::gbw
const & param,
unsigned int const & newval)
override;
257 void onParamChange(imu::tbw
const & param,
unsigned int const & newval)
override;
258 void onParamChange(imu::arange
const & param,
unsigned int const & newval)
override;
259 void onParamChange(imu::grange
const & param,
unsigned int const & newval)
override;
260 void onParamChange(imu::dmp
const & param, std::string
const & newval)
override;
262 unsigned char readMagRegister(
unsigned char magreg);
263 void writeMagRegister(
unsigned char magreg,
unsigned char val);
264 void waitForSlave4();
265 void computeFIFOpktSize(
float ar,
float gr,
int mm);
266 size_t getDMPsome(
bool blocking,
size_t desired);
268 unsigned short itsFIFOpktSiz = 0;
270 unsigned char itsDMPpacket[1024];
A component of a model hierarchy.
TDK InvenSense ICM-20948 9DOF IMU high-level driver.
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(gbw, unsigned int, "Gyroscope bandwidth rate (Hz), or 0 for no low-pass " "filter on gyroscope data.", 51, { 0, 6, 12, 24, 51, 120, 150, 200, 360, 12100 }, ParamCateg)
Parameter.
void sleep(bool enable)
Turn on/off sleep mode.
DMPdata getDMP(bool blocking=true)
Get one packet of DMP data.
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(tbw, unsigned int, "Temperature bandwidth rate (Hz), or 0 to turn off " "temperature sensor. Temperature sampling rate is always 1125Hz unless " "tbw is 7932, in which case sampling is at 9kHz.", 34, { 0, 9, 17, 34, 66, 123, 218, 7932 }, ParamCateg)
Parameter.
void cycle(bool enable)
Turn on/off cycle mode vs continuous for accel, gyro and compass.
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(grange, unsigned int, "Gyroscope full-scale range (+/-dps for example, " "500 means +/-500 degrees per second)).", 500, { 250, 500, 1000, 2000 }, ParamCateg)
Parameter.
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(grate, float, "Gyroscope sampling rate (Hz), or 0.0 to disable " "gyroscope. Actual sample rate may differ because of finite and " "discrete divider settings. In FIFO mode, grate controls the data rate.", 30.0F, jevois::Range< float >(0.0F, 1125.0F), ParamCateg)
Parameter.
void reset()
Reset the IMU chip - not recommended in normal operation.
virtual ~ICM20948()
Virtual destructor for safe inheritance.
JEVOIS_DEFINE_ENUM_CLASS(MagRate,(Off)(Once)(M10Hz)(M20Hz)(M50Hz)(M100Hz))
Enum for Parameter.
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(arange, unsigned int, "Accelerometer full-scale range (+/-g for example, " "2 means +/-2g)).", 4, { 2, 4, 8, 16 }, ParamCateg)
Parameter.
bool ready()
Returns true if this camera indeed has a working ICM20948.
JEVOIS_DEFINE_ENUM_CLASS(Mode,(RAW)(FIFO)(DMP))
Enum for Parameter.
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(dmp, std::string, "Requested DMP data. Only valid when mode is DMP. " "Use any string of letters including:" "A=acceleration, " "G=gyro, " "M=magnetometer (compass), " "R=quaternion 6 (uses accel + gyro), " "Q=quaternion 9 (uses accel + gyro + compass), " "E=geomag (uses accel + compass), " "P=flip/pickup detection, " "S=step detection, " "T=activity recognition, " "F=frame sync from video sensor, " "w=configure activity recognition for wearable, " "g=gyro calibration (always on when gyro used), " "m=compass calibration (always on when compass used), " "b=accel accuracy (always on when accel used), " "h=gyro accuracy (always on when gyro used), " "n=compass accuracy (always on when compass used).", "QSPT", ParamCateg)
Parameter.
void preInit() override
Connect to and initialize the IMU chip.
void postInit() override
Configure RAW vs DMP mode:
JEVOIS_DECLARE_PARAMETER(mode, Mode, "Data collection mode. RAW means that the latest available raw " "data is returned each time get() is called, hence timing may not be very " "accurate depending on how regularly get() is called. FIFO collects accel and gyro data " "at the exact rates specified by parameters arate, grate into a 1kb FIFO queue, and " "get() takes that data back from the FIFO. DMP runs the embedded " "digital motion processor on raw data, and accumulates resulting output " "data into the IMU's internal FIFO buffer at a precise, fixed rate. This " "parameter can only be set in a module's params.cfg file.", Mode::RAW, Mode_Values, ParamCateg)
Parameter.
IMUdata get(bool blocking=true)
Get one round of scaled raw data.
uint32_t devid()
Read device ID.
IMUrawData getRaw(bool blocking=true)
Get one round of raw data.
void preUninit() override
Unfreeze any previously frozen parameters.
JEVOIS_DECLARE_PARAMETER(pktdbg, bool, "Send raw FIFO or DMP packets to console for debug/hacking purposes.", false, ParamCateg)
Parameter.
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(abw, unsigned int, "Accelerometer bandwidth rate (Hz), or 0 for no " "low-pass filter on accelerometer data.", 50, { 0, 6, 12, 24, 50, 111, 246, 470, 1210 }, ParamCateg)
Parameter.
int dataReady()
Returns the amount of new data that had not previously been obtained.
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(arate, float, "Accelerometer sampling rate (Hz), or 0.0 to disable " "accelerometer. Actual sample rate may differ because of finite and " "discrete divider settings. In FIFO mode, grate controls the data rate.", 30.0F, jevois::Range< float >(0.0F, 1125.0F), ParamCateg)
Parameter.
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(mrate, MagRate, "Magnetometer sampling rate (Hz), or Off to disable " "magnetometer, or Once to only get one measurement. You can repeatedly " "set this parameter to Once to obtain repeated measurements " "at your own pace. In JeVois Inventor, you need to alternate between " "Off and Once. In FIFO mode, grate controls the data rate.", MagRate::M50Hz, MagRate_Values, ParamCateg)
Parameter.
Main namespace for all JeVois classes and functions.
DMP data (Digital Motion Processor)
A category to which multiple ParameterDef definitions can belong.