Code added/fixed tonight (or if you view 4am morning instead of night…):
- Data Logging is now optional
- Force sensors are added in
- Is board in a safe area to start
- Removed I for the PID control loop
- More compact interface
- Turning code added but not “enabled”
Tomorrow:
- Verify Force sensor code works
- Verify board safety code
- Video tape me running into walls.
- Tweak PD control loop
- Get turning tweaked in
Yet another simple function. This one is for verifying if the board is safe to start riding. Who knew making something safe could be such a pain in the ass?
private void prepBoard()
{
var isUserPrepped = false;
const int safeAngle = 5;
const int safeGyro = 5;
while (!isUserPrepped && IsUserOnSkateboard())
{
var data = imu.GetImuData(PiDividedBySix, PiDividedBySix, PiDividedBySix);
var angle = data.AccelerationCorrected_X;
var gyro = data.GyroCorrected_X;
isUserPrepped = (angle < safeAngle && angle > -safeAngle) && (gyro < safeGyro && gyro > -safeGyro);
}
}
Best of all, my book chapter is done (I hope, right Dan, right?)