Repository navigation
Description
This task is split from pybricks/pybricks-micropython#156 so we can look at it separately.
We probably need to verify what the actual sampling rate is, or measure it as we go. Similarly, we'll want to check if we are occasionally missing a few samples or not.
We'll also need to check this on Technic Hub, where the I2C setup is slightly different, in case there are any difference.
Once that is settled, we may need to experimentally verify
lsm6ds3tr_c_from_fs2000dps_to_mdpsand adjust as needed. Possibly per axis, see also below.
There is currently no adjustment for misalignment of the chip within the hub. This is possible using a calibration routine (see #943), but the benefit is fairly small for everyday users.
However, it may be useful to do this locally when we test for sample rates as above, to ensure we register the full Z measurement when tweaking
lsm6ds3tr_c_from_fs2000dps_to_mdps.
In
pbio, there is currently not a globalpbio_imuinstance that gets passed around, since there is only oneimuinstance. It may still be useful to make the code easier to follow.
Originally posted by @laurensvalk in pybricks/pybricks-micropython#156 (comment)
Activity
laurensvalk commentedon Apr 1, 2023
Originally posted by @dlech in pybricks/pybricks-micropython#156 (comment)
[-][Feature] Review IMU sample rate[/-][+][Feature] IMU cleanups[/+]laurensvalk commentedon Apr 1, 2023
Originally posted by @dlech in pybricks/pybricks-micropython#156 (comment)
Originally posted by @dlech in pybricks/pybricks-micropython#156 (comment)
Originally posted by @dlech in pybricks/pybricks-micropython#156 (comment)
Intuitive drivebase integration still needs a bit of work. The
COUNTERCLOCKWISEdirection should probably also be done at thepbiolevel, not the module as we do know.laurensvalk commentedon Apr 1, 2023
Originally posted by @dlech in pybricks/pybricks-micropython#156 (comment)
laurensvalk commentedon Apr 1, 2023
On Technic Hub, it never becomes stationary with the default settings. So as per OP, we need to dig into the sensor configuration a bit more. It does become stationary if you double them to:
EDIT: Solved in #1026
laurensvalk commentedon Apr 1, 2023
I wonder if the scale varies slightly per hub. One one hub, the heading seems to be off by a few degrees after one full rotation.
dlech commentedon Apr 1, 2023
orientation.htoimu.h#include <pbdrv/imu.h>and fix copyright date in abovepbio_orientation_set_base_orientation()topbio_imu_set_base_orientation()pbio_imu_init()as internal (doxygen `@condition INTERNAL``) or move to separate header file.laurensvalk commentedon Apr 2, 2023
Yeah, those are already done and pushed, just not merged to master yet.
laurensvalk commentedon Apr 4, 2023
It turns out the sampling rate of the
pbdrv_imu_lsm6ds3tr_c_stm32_processis quite different even between two Prime Hubs (826 Hz, vs 844 Hz). Once running on a particular hub, it is very constant.It would be easy enough to compensate by measuring the frequency at runtime, but is there an explanation for this?
laurensvalk commentedon Apr 4, 2023
Done via pybricks/pybricks-micropython@1dbc334
dlech commentedon Apr 4, 2023
Since the IMU doesn't have an external crystal oscillator, there is never going to be an accurate (as noted) or stable (e.g. could change with temperature) clock on the IMU chip.
laurensvalk commentedon Apr 7, 2023
laurensvalk commentedon Apr 7, 2023
The most critical parts here are now done and the implementation now matches the API proposal in pybricks/pybricks-api#137
laurensvalk commentedon Oct 17, 2024
This is done.