Open teddyort opened 4 years ago
Also try to recover from these errors:
if(DEBUG){ //TODO integrate these into the alarm system
// check for roboclaw errors
bool valid;
uint32_t error_state = roboclaw.ReadError(address, &valid);
if(valid){
if (error_state == 0x0001) { // M1 OverCurrent Warning
Serial.println("TURN OFF DEVICE");
}
else if (error_state == 0x0008) { // Temperature Error
Serial.println("OVERHEATED");
}
else if (error_state == 0x0100){ // M1 Driver Fault
Serial.println("RESTART DEVICE");
}
else if (error_state == 0x1000) { // Temperature Warning
Serial.println("TEMP HIGH");
}
} else {
Serial.println("RESTART DEVICE");
}
}
Also, it appears setM1PositionPID allows setting of position limits, which could be used as a safety to prevent commanding values to the hardstop.
http://downloads.basicmicro.com/docs/roboclaw_user_manual.pdf
Check for driver disconnection. Recover gracefully.