|
SmartVehicle-Sortic
SmartFactory
|
The Vehicle Controll class contains the FSM for the complete Vehicle. More...
#include <VehicleCtrl.h>

Classes | |
| struct | Vehicle |
| Holds all relevant infos for the Vehicle. More... | |
Public Types | |
| enum | Event { Event::PosReached, Event::HSsucessful, Event::AnswerReceived, Event::NoAnswerReceived, Event::Error, Event::Resume, Event::Reset, Event::NoEvent } |
| Enum holds all possible events. More... | |
Public Member Functions | |
| VehicleCtrl () | |
| Construct a new Vehicle Ctrl object. More... | |
| void | loop () |
| Calls the do-function of the active state and hence generates Events. More... | |
| void | loop (Event currentEvent) |
| procceses the current Event and calls the do-function of the active state More... | |
Public Attributes | |
| struct VehicleCtrl::Vehicle | vehicle |
Private Types | |
| enum | State { State::waitForBox, State::handshake, State::loadVehicle, State::unloadVehicle, State::resetState, State::errorState } |
| Enum holds all possible state's. More... | |
Private Member Functions | |
| void | process (Event e) |
| changes the state of the FSM based on the event More... | |
| void | entryAction_waitForBox () |
| entry action of the waitForBox More... | |
| VehicleCtrl::Event | doAction_waitForBox () |
| main action of the waitForBox More... | |
| void | exitAction_waitForBox () |
| exit action of the waitForBox More... | |
| void | entryAction_handshake () |
| entry action of the handshake More... | |
| VehicleCtrl::Event | doAction_handshake () |
| main action of the handshake More... | |
| void | exitAction_handshake () |
| exit action of the handshake More... | |
| void | entryAction_loadVehicle () |
| entry action of the loadVehicle More... | |
| VehicleCtrl::Event | doAction_loadVehicle () |
| main action of the loadVehicle More... | |
| void | exitAction_loadVehicle () |
| exit action of the loadVehicle More... | |
| void | entryAction_unloadVehicle () |
| entry action of the unloadVehicle More... | |
| VehicleCtrl::Event | doAction_unloadVehicle () |
| main action of the unloadVehicle More... | |
| void | exitAction_unloadVehicle () |
| exit action of the unloadVehicle More... | |
| void | entryAction_errorState () |
| entry action of the errorState More... | |
| VehicleCtrl::Event | doAction_errorState () |
| main action of the errorState More... | |
| void | exitAction_errorState () |
| exit action of the errorState More... | |
| void | entryAction_resetState () |
| entry action of the resetState More... | |
| VehicleCtrl::Event | doAction_resetState () |
| main action of the resetState More... | |
| void | exitAction_resetState () |
| exit action of the resetState More... | |
| String | decodeState (State state) |
| Decodes the State-Enum and returns a description. More... | |
| String | decodeEvent (Event event) |
| Decodes the Event-Enum and returns a description. More... | |
| void | publishState (State state) |
| Update State and Publish actual state. More... | |
| void | publishPosition () |
| Update position and Publish actual position. More... | |
| void | publishTargetPosition () |
| Update position and Publish actual position. More... | |
| void | publishTargetPositionBlockLine () |
| bool | checkForError () |
| Check if a new message with a error is received. More... | |
| void | clearGui () |
| clear node Red gui More... | |
Private Attributes | |
| State | lastStateBevorError |
| holds the last state of the FSM so it's possible to resume after error More... | |
| State | currentState |
| holds the current state of the FSM More... | |
| Event | currentEvent |
| holds the current event of the FSM More... | |
| int | substate = 0 |
| actual Substate of FSM More... | |
| int | pSorticPark [SORTIC_MAX_LINE] = {0} |
| Sortic with 10 diffrent lines. More... | |
| int | pTransferPark [SORTIC_MAX_LINE] = {1} |
| Sortic with 10 diffrent lines. More... | |
| unsigned int | pRandomDelayFactor = 0 |
| some sort of ALOHA stuff More... | |
| Event(VehicleCtrl::* | doActionFPtr )(void) = nullptr |
| Functionpointer to call the current states do-function. More... | |
| NavigationCtrl | pNavCtrl |
| Navigation Controll object. More... | |
| Communication | pComm = Communication(DEFAULT_HOSTNAME) |
| Communication object. More... | |
| HoistCtrl | pHoistCtrl |
| Hoist Controll object. More... | |
| unsigned long | currentMillis = 0 |
| will store current time More... | |
| unsigned long | previousMillis = 0 |
| will store last time published More... | |
| unsigned long | previousMillisPublishToken = 0 |
| will store last time token published More... | |
| unsigned long | previousMillisPublish = 0 |
| will store last publish time More... | |
| unsigned long | previousMillisPublishPos = 0 |
| will store last publish position time More... | |
The Vehicle Controll class contains the FSM for the complete Vehicle.
Definition at line 34 of file VehicleCtrl.h.
|
strong |
Enum holds all possible events.
| Enumerator | |
|---|---|
| PosReached | Vehicle is in position. |
| HSsucessful | Handshake was sucessful. |
| AnswerReceived | Answer received. |
| NoAnswerReceived | No Answer received. |
| Error | Error occured. |
| Resume | Resume after Error occured. |
| Reset | Reset after Error occured. |
| NoEvent | No event generated. |
Definition at line 58 of file VehicleCtrl.h.
|
strongprivate |
Enum holds all possible state's.
https://stackoverflow.com/questions/18335861/why-is-enum-class-preferred-over-plain-enum
| Enumerator | |
|---|---|
| waitForBox | wait for box to transport |
| handshake | handshake |
| loadVehicle | load box |
| unloadVehicle | unload box |
| resetState | reset state |
| errorState | error state |
Definition at line 108 of file VehicleCtrl.h.
| VehicleCtrl::VehicleCtrl | ( | ) |
Construct a new Vehicle Ctrl object.
Definition at line 15 of file VehicleCtrl.cpp.
| void VehicleCtrl::loop | ( | ) |
Calls the do-function of the active state and hence generates Events.
Definition at line 31 of file VehicleCtrl.cpp.
| void VehicleCtrl::loop | ( | Event | currentEvent | ) |
procceses the current Event and calls the do-function of the active state
| currentEvent | - Event |
Definition at line 36 of file VehicleCtrl.cpp.
|
private |
changes the state of the FSM based on the event
| e | - Event |
Definition at line 43 of file VehicleCtrl.cpp.
|
private |
entry action of the waitForBox
Definition at line 128 of file VehicleCtrl.cpp.
|
private |
main action of the waitForBox
Definition at line 149 of file VehicleCtrl.cpp.
|
private |
exit action of the waitForBox
Definition at line 175 of file VehicleCtrl.cpp.
|
private |
entry action of the handshake
Definition at line 182 of file VehicleCtrl.cpp.
|
private |
main action of the handshake
0 check for ack
10 publish ack for Box 5 times
Definition at line 195 of file VehicleCtrl.cpp.
|
private |
exit action of the handshake
Definition at line 250 of file VehicleCtrl.cpp.
|
private |
entry action of the loadVehicle
Definition at line 256 of file VehicleCtrl.cpp.
|
private |
main action of the loadVehicle
0 check position
10 wait for gateway
11 listen if only one in gateway
20 check which gateway to block
21 block Gateway Sortic
22 block gateway Transfer
30 chek if in position
40 raise hoist
Definition at line 278 of file VehicleCtrl.cpp.
|
private |
exit action of the loadVehicle
Definition at line 419 of file VehicleCtrl.cpp.
|
private |
entry action of the unloadVehicle
Definition at line 425 of file VehicleCtrl.cpp.
|
private |
main action of the unloadVehicle
0 check actual sector and subscribe to handover
10 search suitable targetPos Transfer
11 ensure valid target position Transfer
20 search suitable targetPos Sortic
21 ensure valid target position Sortic
50 set targetposition
100 check position
200 wait for free gateway
210 listen if only one in gateway
300 check which gateway to block
310 block gateway Sortic
320 block gateway Transfer
400 chek if in position
500 lower hoist
600 publish position to Box
Definition at line 437 of file VehicleCtrl.cpp.
|
private |
exit action of the unloadVehicle
Definition at line 783 of file VehicleCtrl.cpp.
|
private |
entry action of the errorState
pass Errorevent to Hoist and NavCtrl
Definition at line 788 of file VehicleCtrl.cpp.
|
private |
main action of the errorState
check for reset message
Definition at line 799 of file VehicleCtrl.cpp.
|
private |
exit action of the errorState
Definition at line 822 of file VehicleCtrl.cpp.
|
private |
entry action of the resetState
Definition at line 828 of file VehicleCtrl.cpp.
|
private |
main action of the resetState
check for resume message
Definition at line 844 of file VehicleCtrl.cpp.
|
private |
exit action of the resetState
Definition at line 861 of file VehicleCtrl.cpp.
|
private |
Decodes the State-Enum and returns a description.
| state | - enum State |
Definition at line 873 of file VehicleCtrl.cpp.
|
private |
Decodes the Event-Enum and returns a description.
| event | - enum Event |
Definition at line 899 of file VehicleCtrl.cpp.
|
private |
Update State and Publish actual state.
| state | - state for update |
Definition at line 974 of file VehicleCtrl.cpp.
|
private |
Update position and Publish actual position.
Definition at line 979 of file VehicleCtrl.cpp.
|
private |
Update position and Publish actual position.
Definition at line 990 of file VehicleCtrl.cpp.
|
private |
Definition at line 997 of file VehicleCtrl.cpp.
|
private |
Check if a new message with a error is received.
Definition at line 961 of file VehicleCtrl.cpp.
|
private |
clear node Red gui
Definition at line 1020 of file VehicleCtrl.cpp.
| struct VehicleCtrl::Vehicle VehicleCtrl::vehicle |
|
private |
holds the last state of the FSM so it's possible to resume after error
Definition at line 116 of file VehicleCtrl.h.
|
private |
holds the current state of the FSM
Definition at line 117 of file VehicleCtrl.h.
|
private |
holds the current event of the FSM
Definition at line 118 of file VehicleCtrl.h.
|
private |
actual Substate of FSM
Definition at line 119 of file VehicleCtrl.h.
|
private |
Sortic with 10 diffrent lines.
Definition at line 120 of file VehicleCtrl.h.
|
private |
Sortic with 10 diffrent lines.
Definition at line 121 of file VehicleCtrl.h.
|
private |
some sort of ALOHA stuff
Definition at line 122 of file VehicleCtrl.h.
|
private |
Functionpointer to call the current states do-function.
https://stackoverflow.com/questions/1485983/calling-c-class-methods-via-a-function-pointer
Definition at line 128 of file VehicleCtrl.h.
|
private |
Navigation Controll object.
Definition at line 130 of file VehicleCtrl.h.
|
private |
Communication object.
Definition at line 131 of file VehicleCtrl.h.
|
private |
Hoist Controll object.
Definition at line 132 of file VehicleCtrl.h.
|
private |
will store current time
Definition at line 134 of file VehicleCtrl.h.
|
private |
will store last time published
Definition at line 135 of file VehicleCtrl.h.
|
private |
will store last time token published
Definition at line 136 of file VehicleCtrl.h.
|
private |
will store last publish time
Definition at line 137 of file VehicleCtrl.h.
|
private |
will store last publish position time
Definition at line 138 of file VehicleCtrl.h.