@@ -55,13 +55,13 @@ bool PodState::isNodeSensorCritical(uint32_t sensorIndex) {
55
55
}
56
56
57
57
bool PodState::isConnectionFlagCritical (uint32_t sensorIndex) {
58
- uint32_t criticalMask = CONNECTION_FLAGS::BRAKE_NODE_HEARTBEAT_INDEX |
59
- CONNECTION_FLAGS::LVDC_NODE_HEARTBEAT_INDEX |
60
- CONNECTION_FLAGS::BMS_HEARTBEAT_INDEX |
61
- CONNECTION_FLAGS::INTERFACE_HEARTBEAT_INDEX |
62
- CONNECTION_FLAGS::ENCLOSURE_HEARTBEAT_INDEX |
63
- CONNECTION_FLAGS::NAVIGATION_HEARTBEAT_INDEX;
64
- return sensorIndex & criticalMask ;
58
+ std::vector< int > criticalSensors = { CONNECTION_FLAGS::BRAKE_NODE_HEARTBEAT_INDEX,
59
+ CONNECTION_FLAGS::LVDC_NODE_HEARTBEAT_INDEX,
60
+ CONNECTION_FLAGS::BMS_HEARTBEAT_INDEX,
61
+ CONNECTION_FLAGS::INTERFACE_HEARTBEAT_INDEX,
62
+ CONNECTION_FLAGS::ENCLOSURE_HEARTBEAT_INDEX,
63
+ CONNECTION_FLAGS::NAVIGATION_HEARTBEAT_INDEX} ;
64
+ return std::find (criticalSensors. begin (), criticalSensors. end (), sensorIndex) != criticalSensors. end () ;
65
65
}
66
66
67
67
bool PodState::isInverterSensorCritical (uint32_t sensorIndex) {
@@ -148,7 +148,6 @@ void PodState::armedChecks(){
148
148
std::string error = " Failed on inverter fault, see pod messages" ;
149
149
throw std::runtime_error (error);
150
150
}
151
-
152
151
}
153
152
154
153
bool PodState::brakingCriteriaMet () {
@@ -163,6 +162,7 @@ bool PodState::brakingCriteriaMet() {
163
162
pod->sendUpdate (" Braking at maximum strip count" );
164
163
return true ;
165
164
}
165
+
166
166
return false ;
167
167
}
168
168
@@ -440,6 +440,10 @@ bool Acceleration::testTransitions() {
440
440
this ->setupTransition (psBraking, (std::string)" Flight Timout of " + std::to_string (this ->timeInStateSeconds ()) + " reached. Pod --> Braking" );
441
441
return true ;
442
442
}
443
+
444
+ if (this ->pod ->telemetry ->motorSpeed >= pod->telemetry ->maxRPM ){
445
+ this ->setupTransition (psCoasting, " Acceleration->Coasting from maximum speed" );
446
+ }
443
447
return false ;
444
448
}
445
449
@@ -450,7 +454,8 @@ Coasting::Coasting(TelemetryManager* pod) : PodState(pod) {
450
454
this ->pod ->telemetry ->commandedTorque = 0 ;
451
455
}
452
456
453
- bool Coasting::testTransitions () {
457
+ bool Coasting::testTransitions () {
458
+ this ->pod ->telemetry ->commandedTorque = 0 ;
454
459
if (this ->pod ->getControlsInterfaceState () == ciEmergencyStop){
455
460
this ->setupTransition (psBraking, " Emergency Stop. Pod --> Braking" );
456
461
return true ;
0 commit comments