49 DBFUNCCALLln(
"NavigationCtrl::setTargetPosition(Sector sector, const int line)");
55 DBFUNCCALLln(
"NavigationCtrl::setActualPosition(Sector sector, const int line)");
68 return "SorticHandover";
71 return "SorticToHandover";
74 return "SorticWaitForGateway";
77 return "SorticGateway";
80 return "TransitWaitForGatewaySortic";
83 return "TransitToSortic";
86 return "TransitToTransfer";
92 return "TransitWaitForGatewayTransfer";
95 return "TransferGateway";
98 return "TransferWaitForGateway";
101 return "TransferToHandover";
104 return "TransferHandover";
108 return "ERROR: No matching sector";
114 if (String(
"SorticHandover") == sector) {
116 }
else if (String(
"SorticToHandover") == sector) {
118 }
else if (String(
"SorticWaitForGateway") == sector) {
120 }
else if (String(
"TransitWaitForGatewaySortic") == sector) {
122 }
else if (String(
"TransitToSortic") == sector) {
124 }
else if (String(
"TransitToTransfer") == sector) {
126 }
else if (String(
"Parking") == sector) {
128 }
else if (String(
"TransitWaitForGatewayTransfer") == sector) {
130 }
else if (String(
"TransferGateway") == sector) {
132 }
else if (String(
"TransferWaitForGateway") == sector) {
134 }
else if (String(
"TransferToHandover") == sector) {
136 }
else if (String(
"TransferHandover") == sector) {
152 DBSTATUSln(
"Navigation: Already in correct position");
241 DBSTATUSln(
"Navigation Entering State: endPoint");
263 DBSTATUSln(
"Navigation Leaving State: endPoint");
269 DBSTATUSln(
"Navigation Entering State: toGateway");
283 DBINFO1ln(
"Navigation State: toGateway");
287 pDriveCtrl.loop(DriveCtrl::Event::FollowLineBackward);
288 if (
pDriveCtrl.getcurrentState() == DriveCtrl::State::idle) {
293 pDriveCtrl.loop(DriveCtrl::Event::TurnAround);
294 if (
pDriveCtrl.getcurrentState() == DriveCtrl::State::idle) {
299 pDriveCtrl.loop(DriveCtrl::Event::FollowLineForward);
300 if (
pDriveCtrl.getcurrentState() == DriveCtrl::State::idle) {
313 DBSTATUSln(
"Navigation Leaving State: toGateway");
319 DBSTATUSln(
"Navigation Entering State: gateway");
363 DBINFO2ln(
"Substate: drive forward once");
364 pDriveCtrl.loop(DriveCtrl::Event::FollowLineForward);
365 if (
pDriveCtrl.getcurrentState() == DriveCtrl::State::idle) {
370 DBINFO2ln(
"Substate: turn left or right");
386 if (
pDriveCtrl.getcurrentState() == DriveCtrl::State::idle) {
392 DBINFO2(
"Substate: drive forward times: ");
395 pDriveCtrl.loop(DriveCtrl::Event::FollowLineForward);
396 if (
pDriveCtrl.getcurrentState() == DriveCtrl::State::idle) {
406 DBINFO2ln(
"Substate: turn left or right");
416 if (
pDriveCtrl.getcurrentState() == DriveCtrl::State::idle) {
421 DBINFO2ln(
"Substate: drive forward twice");
422 pDriveCtrl.loop(DriveCtrl::Event::FollowLineForward);
423 if (
pDriveCtrl.getcurrentState() == DriveCtrl::State::idle) {
451 DBSTATUSln(
"Navigation Leaving State: gateway");
473 DBSTATUSln(
"Navigation Entering State: crossTransit");
488 DBINFO1ln(
"Navigation State: crossTransit");
490 pDriveCtrl.loop(DriveCtrl::Event::FollowLineForward);
491 if (
pDriveCtrl.getcurrentState() == DriveCtrl::State::idle) {
504 DBSTATUSln(
"Navigation Leaving State: crossTransit");
510 DBSTATUSln(
"Navigation Entering State: toEndPoint");
525 DBINFO1ln(
"Navigation State: toEndPoint");
527 pDriveCtrl.loop(DriveCtrl::Event::FollowLineForward);
528 if (
pDriveCtrl.getcurrentState() == DriveCtrl::State::idle) {
540 DBSTATUSln(
"Navigation Leaving State: toEndPoint");
546 DBSTATUSln(
"Navigation Entering State: errorState");
556 DBINFO1ln(
"Navigation State: errorState");
562 DBSTATUSln(
"Navigation Leaving State: errorState");
567 DBERROR(
"Entering State: resetState");
593 return "State::endPoint";
596 return "State::toGateway";
598 return "State::gateway";
601 return "State::crossTransit";
604 return "State::toEndPoint";
607 return "State::errorState";
610 return "State::resetState";
613 return "ERROR: No matching state";
621 return "Event::MoveToTargetPosition";
624 return "Event::PosEndPointReached";
627 return "Event::PosTransitReached";
630 return "Event::PosReached";
633 return "Event::Error";
636 return "Event::Resume";
639 return "Event::Reset";
642 return "Event::NoEvent";
645 return "ERROR: No matching event";
void entryAction_endPoint()
executes the entry action of the endPoint state.
const Sector getcurrentSector()
Get the current Sector.
Sector startSector
Startpoint from current path.
NavigationCtrl::Event doAction_toEndPoint()
executes the main action of the toEndPoint state.
int pCurrentSubState
Counter for the Current Substate.
Signal: PosTransitReached.
void exitAction_resetState()
exit action of the resetState
void exitAction_endPoint()
executes the exit action of the endPoint state.
void entryAction_errorState()
entry action of the errorState state.
NavigationCtrl::Event doAction_toGateway()
executes the main action of the toGateway state.
Ext.: Reset after Error occured.
NavigationCtrl::Event doAction_errorState()
main action of the errorState state.
DriveCtrl pDriveCtrl
Navigation Object.
Sortic - Wait for Gateway.
void giveToken()
give Token to access the Gateway
State lastStateBevorError
holds the last state of the FSM so it's possible to resume after error
int pLastSubStateBevorError
Holds the last Substate befor an Error occured.
NavigationCtrl()
Construct a new Navigation Ctrl object and initailize the currentState with endPoint state.
Ext: Resume after Error occured.
void entryAction_resetState()
entry action of the resetState
Ext: Start MoveToTargetPosition.
String decodeEvent(Event event)
Decodes the Event-Enum and returns a description.
Transfer - wait for Gateway.
NavigationCtrl::Event doAction_gateway()
executes the main action of the gateway state.
void exitAction_gateway()
executes the exit action of the gateway state.
State currentState
holds the current state of the FSM
void setTargetPosition(Sector sector, const int line)
Set the Target Position object.
Sector sector
actual sector
Transit - Wait for Gateway Transfer.
void exitAction_toGateway()
executes the exit action of the toGateway state.
Event(NavigationCtrl::* doActionFPtr)(void)
Functionpointer to call the current states do-function.
Sector lastSector
last sector
NavigationCtrl::Event doAction_endPoint()
executes the main action of the endPoint state. This is an Idel-state ->NoEvent generated
void loop()
Calls the do-function of the active state and hence generates Events.
bool token
token for gateway accees
Signal: PosEndPointReached.
NavigationCtrl::Event doAction_resetState()
main action of the resetState
struct NavigationCtrl::ActualPos pActual
NavigationCtrl::Event doAction_crossTransit()
executes the main action of the crossTransit state.
const State getcurrentState()
Get the current State.
void entryAction_gateway()
executes the entry action of the gateway state.
void process(Event e)
changes the state of the FSM based on the event
Contains the FSM for the Navigation.
String decodeState(State state)
Decodes the State-Enum and returns a description.
Event
Enum holds all possible events.
State
Enum holds all possible states for the Navigation.
Signal: Position reached.
void exitAction_crossTransit()
executes the exit action of the crossTransit state.
Event currentEvent
holds the current event of the FSM
void exitAction_errorState()
exit action of the errorState state.
The Navigation Controll class contains the FSM for the Navigation.
String decodeSector(Sector sector)
Decodes the Sector-Enum and returns a description.
void entryAction_toGateway()
executes the entry action of the toGateway state.
Transit - Wait for Gateway Sortic.
const int getcurrentLine()
Get the current Line.
int pSubStateLoopInc
Counter so you can call the same substatefunction multiple times.
struct NavigationCtrl::TargetPos pTarget
void setActualPosition(Sector sector, const int line)
Set the actual Position object.
void entryAction_toEndPoint()
executes the entry action of the toEndPoint state.
void exitAction_toEndPoint()
executes the exit action of the toEndPoint state.
DriveCtrl::Event pLastGatewayTurn
Variable which holds the last made turn in gateway.
void entryAction_crossTransit()
executes the entry action of the crossTransit state.
bool tranistonce
prevents an loop between transit and gateway
Sector sector
TargetSector.
Sector
Enum holds all possible sectors.