Python RazorIMU class designed for reading data via Serial communication, with any board mimicking SparkFun 9DoF Razor communication format.
RazorIMU( [config_path] )
- Constructor for RazorIMU, configures board and writes calibration values provided in config_path.yaml
file.
start()
- starts polling the data from Serial, can call as soon as created RazorIMU object.
shutdown()
- stops the polling, not mendatory, but please shutdown the IMU when done.
* No need to use any other methods, those are enough for full use, see example code in in __main__
section at bottom of imu.py
orient[<axis>]
- angular orientation of device across <axis>
in
accel[<axis>]
- linear acceleratio across <axis>
in
gyro[<axis>]
- angular velocity across <axis>
in
Overview of how to properly setup a configuration file.
device
- name of device to be connected, must match with Calib
name for proper execution of calibration commands.
port
- path to serial to which device is connected (ex. /dev/ttyUSB0
).
boundrate
- boundrate of device.
boot_time
- amount of time before device execution starts after boot beyond regular boot time, extra to ensure proper load of calibration values.
orin_scale/acel_scale/gyro_scale
- unit conversion constant, in case if firmware uses differnt units from expected.
A section which defines set of commands to set up calibration parameters to device and it's values. Follow the template to create your own calibration sequence for device:
DEVICE_NAME:
Val:
value1: [value to be written]
value2: [value to be written]
value3: [value to be written]
Cmd:
value1: [serial command used to write value1]
value2: [serial command used to write value2]
value3: [serial command used to write value3]
* Ensure that DEVICE_NAME
mathes Serial.device
value, so alibration will use specified calibration sequence.
* Ensure that Val.[your_varible]
and Cmd.[your_varible]
have same [your_varible]
name, for propper mapping of commands to written values.
Folder firmwares
should include some common of the IMU sensors avaliable.
SparkFunRazor
- Central device which was foundation for the project, firmware used was provided by Triton-AI repository.
- Calibration information can be found on ROS Wiki.
SeeedXIAO
- Test firmware for SeeedXIAO board to work as an IMU sensor.
- Calibration instruction can be found in SeeedXIAO firmware folder.
Be carreffuly after calling start()
with interval of few seconds after creating RazorIMU
object, Due to the way how serial read works, tty*
might build up ~8k of data over the interval betwenn construction and start of the thread.
It shouldn't cause any issues, since dumping will be automatic and as quick as your executing device lets it, and as soon as it catches up with current data will work as intended.