refactor all autopilot stuff
This commit is contained in:
@@ -29,6 +29,17 @@
|
||||
*/
|
||||
class Autopilot : public ManualControl {
|
||||
public:
|
||||
enum State {
|
||||
NoNtrip = -2,
|
||||
NoRoute = -1,
|
||||
None = 0,
|
||||
NavigationStarted,
|
||||
GetToStartPoint,
|
||||
SelfDrivingAvailable,
|
||||
SelfDriving,
|
||||
TargetReached
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Construct a new Autopilot object
|
||||
*
|
||||
@@ -37,6 +48,13 @@ class Autopilot : public ManualControl {
|
||||
*/
|
||||
Autopilot(MoveControl* moveControl, const ControlPadInput *input, Navigation* navigation);
|
||||
|
||||
/**
|
||||
* @brief Destroy the Autopilot object
|
||||
*
|
||||
* Disconnect the NTRIP-Client
|
||||
*/
|
||||
~Autopilot();
|
||||
|
||||
/**
|
||||
* @brief Calls runAutopilot or ManualControl loop
|
||||
*
|
||||
@@ -73,36 +91,11 @@ class Autopilot : public ManualControl {
|
||||
CourseCorrection getCourseCorrection() const { return this->courseCorrection; }
|
||||
|
||||
/**
|
||||
* @brief Get the Navigation Started status
|
||||
* @brief Get the State object
|
||||
*
|
||||
* @return true
|
||||
* @return false
|
||||
* @return State
|
||||
*/
|
||||
bool getNavigationStarted() const { return this->navigationStarted; }
|
||||
|
||||
/**
|
||||
* @brief Get the Navigation Ended status
|
||||
*
|
||||
* @return true
|
||||
* @return false
|
||||
*/
|
||||
bool getNavigationEnded() const { return this->navigationEnded; }
|
||||
|
||||
/**
|
||||
* @brief Get the Self Driving status
|
||||
*
|
||||
* @return true
|
||||
* @return false
|
||||
*/
|
||||
bool getSelfDriving() const { return this->selfDriving; }
|
||||
|
||||
/**
|
||||
* @brief Get the Self Driving Available status
|
||||
*
|
||||
* @return true
|
||||
* @return false
|
||||
*/
|
||||
bool getSelfDrivingAvailable() const { return this->selfDrivingAvailable; }
|
||||
State getState() const { return this->state; }
|
||||
|
||||
/**
|
||||
* @brief Tells if there are new informations to display
|
||||
@@ -113,24 +106,26 @@ class Autopilot : public ManualControl {
|
||||
bool shouldUpdate();
|
||||
|
||||
private:
|
||||
void setSelfDriving(bool val);
|
||||
void checkNtrip();
|
||||
void setSpeedInRelToDistance(double distance);
|
||||
void setRotInRelToDistance(int16_t course);
|
||||
|
||||
Navigation* navigation;
|
||||
CourseCorrection courseCorrection;
|
||||
RouteInfo routeInfo;
|
||||
State state = State::None;
|
||||
NTRIPClientStates lastState;
|
||||
|
||||
bool navigationStarted = false;
|
||||
bool navigationEnded = false;
|
||||
bool selfDriving = false;
|
||||
bool selfDrivingAvailable = false;
|
||||
bool updateDisplay = false;
|
||||
|
||||
uint8_t loopDelayMillis = 40;
|
||||
uint8_t ntripReconnectAttemps = 0;
|
||||
uint8_t ntripReconnectMaxAttemps = 10;
|
||||
uint16_t displayUpdateDelayMillis = 1000;
|
||||
uint16_t reconnectNtripDelayMillis = 1000;
|
||||
uint32_t displayUpdateLastMillis = 0;
|
||||
uint32_t loopLastMillis = 0;
|
||||
uint32_t reconnectNtripLastMillis = 0;
|
||||
};
|
||||
|
||||
#endif // AUTOPILOT_H
|
||||
|
||||
Reference in New Issue
Block a user