Basebot modules: Difference between revisions
From Rsewiki
(Created page with "Back to Basebot == Module description == === Main code === === Support modules === ==== Motor blocks ==== 400px Motor voltage is translated to a PWM at 65kHz where the average value corresponds to the set motor voltage. Current battery voltage is taken into consideration. PWM = motorVoltage * MAX_PWM/(battery_voltage - voltageLoss) The motor controller has a minimum pulse width. If the motor voltage is not zero, a minimum PWM is...") |
|||
Line 7: | Line 7: | ||
=== Support modules === | === Support modules === | ||
==== Motor | ==== Motor ==== | ||
[[file:wiki-bb-motor.png | 400px]] | [[file:wiki-bb-motor.png | 400px]] | ||
Line 20: | Line 20: | ||
(implemented in ''umotor.cpp'' in function ''motorSetAnchorVoltage()'') | (implemented in ''umotor.cpp'' in function ''motorSetAnchorVoltage()'') | ||
==== Gyro and accelerometer ==== | |||
[[file:wiki-bb-MPU9250.png | 400px]] | |||
The sensor chip is an MPU9250. | |||
Sensor values are extracted from the chip at every sample time, but if the sample time is faster than 1ms, values may be repeated. | |||
The values are available as | |||
imu2.gyro[0..2] for rotation velocity around axis x,y,z in degrees per second. | |||
imu2.acc[0..2] for acceleration along x,y,z. X is forward, Y is left, and Z is up. | |||
(implemented in ''uimu2.cpp'') |
Revision as of 10:21, 2 September 2024
Back to Basebot
Module description
Main code
Support modules
Motor
Motor voltage is translated to a PWM at 65kHz where the average value corresponds to the set motor voltage. Current battery voltage is taken into consideration.
PWM = motorVoltage * MAX_PWM/(battery_voltage - voltageLoss)
The motor controller has a minimum pulse width. If the motor voltage is not zero, a minimum PWM is added to compensate. The minimum corresponds to 0.4V motor voltage.
(implemented in umotor.cpp in function motorSetAnchorVoltage())
Gyro and accelerometer
The sensor chip is an MPU9250. Sensor values are extracted from the chip at every sample time, but if the sample time is faster than 1ms, values may be repeated.
The values are available as
imu2.gyro[0..2] for rotation velocity around axis x,y,z in degrees per second. imu2.acc[0..2] for acceleration along x,y,z. X is forward, Y is left, and Z is up.
(implemented in uimu2.cpp)