SmartWheels self-driving race car. Designed for NXP Cup. Uses FRDM-KL25Z, area-scan camera, and simple image processing to detect and navigate any NXP spec track.
Dependencies: TSI USBDevice mbed-dev
Fork of SmartWheels by
Diff: StateMachine/RunningState.cpp
- Branch:
- Drift
- Revision:
- 85:f3911aab41d9
- Parent:
- 83:b2c7c6f76575
- Child:
- 86:51048c1f132f
--- a/StateMachine/RunningState.cpp Tue Apr 18 22:10:17 2017 +0000 +++ b/StateMachine/RunningState.cpp Tue Apr 18 22:27:14 2017 +0000 @@ -15,7 +15,8 @@ m_lastAngle(0.0f), m_lastAngleAbs(0.0f), m_cornerRatio(1.0f), - m_lastLineFound(BOTH_FOUND) + m_lastLineFound(BOTH_FOUND), + m_shouldTerminate(0) {} RunningState::~RunningState() @@ -36,8 +37,9 @@ image_processing(); uint8_t shouldTerminate = ardu_cam_get_is_encounter_terminate(); - if(shouldTerminate) + if(shouldTerminate || m_shouldTerminate) { + m_shouldTerminate = 0; TerminateProcess(); return; } @@ -159,7 +161,8 @@ void RunningState::TouchIrqCallback() { - TerminateProcess(); + //TerminateProcess(); + m_shouldTerminate = 1; } void RunningState::TerminateProcess()