85 lines
2.0 KiB
C++
85 lines
2.0 KiB
C++
/**
|
|
* @file captureRoute.h
|
|
* @author Alexander Klein (alex@kleiax.de)
|
|
* @brief Contains a class to capture a driven route
|
|
* @version 0.1
|
|
* @date 2022-02-15
|
|
*
|
|
* @copyright Copyright (c) 2022
|
|
*
|
|
*/
|
|
|
|
#ifndef CAPTURE_ROUTE_H
|
|
#define CAPTURE_ROUTE_H
|
|
|
|
#include <iostream>
|
|
|
|
#include "driveModi/Modi/ManualControl/manualControl.h"
|
|
#include "navigation.h"
|
|
|
|
/**
|
|
* @brief A class to capture a driven class
|
|
*
|
|
* This class inherits ManualControl so you can drive
|
|
* normally as in ManualControl. If GPS signal is valid
|
|
* you can add a Point everytime you want.
|
|
*
|
|
*/
|
|
class CaptureRoute : public ManualControl {
|
|
public:
|
|
/**
|
|
* @brief Construct a new Capture Route object
|
|
*
|
|
* @param moveControl for ManualControl
|
|
* @param navigation to add Points
|
|
*/
|
|
CaptureRoute(MoveControl* moveControl, Navigation* navigation);
|
|
|
|
/**
|
|
* @brief Calls runCaptureRoute and ManualControl::loop
|
|
*
|
|
* Calls everytime the other loop but only calls runCaptureRoute
|
|
* if the delay is reached.
|
|
*
|
|
*/
|
|
void loop();
|
|
|
|
/**
|
|
* @brief Checks if a Point should be added to the Route
|
|
*
|
|
*/
|
|
void runCaptureRoute();
|
|
|
|
/**
|
|
* @brief Get the Navigation object
|
|
*
|
|
* @return Navigation*
|
|
*/
|
|
Navigation* getNavigation() const { return this->navigation; }
|
|
|
|
/**
|
|
* @brief Get the Route Info object
|
|
*
|
|
* @return RouteInfo
|
|
*/
|
|
RouteInfo getRouteInfo() const { return this->routeInfo; }
|
|
|
|
/**
|
|
* @brief Tells if there are new informations to display
|
|
*
|
|
* @return true
|
|
* @return false
|
|
*/
|
|
bool shouldUpdate();
|
|
private:
|
|
Navigation* navigation;
|
|
RouteInfo routeInfo;
|
|
|
|
uint32_t last_millis = 0;
|
|
uint16_t delay = 200;
|
|
|
|
bool updateDisplay = false;
|
|
};
|
|
|
|
#endif // CAPTURE_ROUTE_H
|