Finish documention until someone change something
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file autopilot.cpp
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief
|
||||
* @brief Contains the implementation of the class Autopilot
|
||||
* @version 0.1
|
||||
* @date 2022-02-02
|
||||
*
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file autopilot.h
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief
|
||||
* @brief Contains a class which use the navigate class to drive automaticaly
|
||||
* @version 0.1
|
||||
* @date 2022-02-02
|
||||
*
|
||||
@@ -17,20 +17,98 @@
|
||||
#include "moveControl.h"
|
||||
#include "driveModi/Modi/ManualControl/manualControl.h"
|
||||
|
||||
/**
|
||||
* @brief This class use the navigate class to drive automaticaly
|
||||
*
|
||||
* This class get the information from the navigate class. When an
|
||||
* object of this class is constructed the rover can be driven manually.
|
||||
* When the Rover is near to the first position of the Route, you can
|
||||
* switch to automatic drive.
|
||||
*
|
||||
*/
|
||||
class Autopilot : public ManualControl {
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Autopilot object
|
||||
*
|
||||
* @param moveControl for ManualControl
|
||||
* @param navigation for route instructions
|
||||
*/
|
||||
Autopilot(MoveControl* moveControl, Navigation* navigation);
|
||||
|
||||
/**
|
||||
* @brief Calls runAutopilot or ManualControl loop
|
||||
*
|
||||
* This function should be called every main loop. If self
|
||||
* driving is activated the function call run Autopilot. If
|
||||
* the delay is not reached the function returns immediately.
|
||||
*
|
||||
* If self driving is not activated this functions calls the
|
||||
* ManualControl loop additionally.
|
||||
*/
|
||||
void loop();
|
||||
|
||||
/**
|
||||
* @brief Manges the autoipilot
|
||||
*
|
||||
* If the first Point is near to current location you can turn
|
||||
* the autopilot on.
|
||||
* Gets the course correction and decide what to do.
|
||||
*/
|
||||
void runAutopilot();
|
||||
|
||||
/**
|
||||
* @brief Get the Route Info object
|
||||
*
|
||||
* @return RouteInfo
|
||||
*/
|
||||
RouteInfo getRouteInfo() const { return this->routeInfo; }
|
||||
|
||||
/**
|
||||
* @brief Get the Course Correction object
|
||||
*
|
||||
* @return CourseCorrection
|
||||
*/
|
||||
CourseCorrection getCourseCorrection() const { return this->courseCorrection; }
|
||||
|
||||
/**
|
||||
* @brief Get the Navigation Started status
|
||||
*
|
||||
* @return true
|
||||
* @return false
|
||||
*/
|
||||
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; }
|
||||
|
||||
/**
|
||||
* @brief Tells if there are new informations to display
|
||||
*
|
||||
* @return true
|
||||
* @return false
|
||||
*/
|
||||
bool shouldUpdate();
|
||||
|
||||
private:
|
||||
@@ -52,4 +130,4 @@ class Autopilot : public ManualControl {
|
||||
uint8_t delay = 40;
|
||||
};
|
||||
|
||||
#endif // AUTOPILOT_H
|
||||
#endif // AUTOPILOT_H
|
||||
|
||||
@@ -1,3 +1,14 @@
|
||||
/**
|
||||
* @file captureRoute.cpp
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief Contains the implementation of the class CaptureRoute
|
||||
* @version 0.1
|
||||
* @date 2022-02-15
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
|
||||
#include "driveModi/Modi/CaptureRoute/captureRoute.h"
|
||||
|
||||
CaptureRoute::CaptureRoute(MoveControl* moveControl, Navigation* navigation)
|
||||
@@ -31,4 +42,4 @@ bool CaptureRoute::shouldUpdate() {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,14 @@
|
||||
/**
|
||||
* @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
|
||||
|
||||
@@ -6,17 +17,59 @@
|
||||
#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;
|
||||
@@ -28,4 +81,4 @@ class CaptureRoute : public ManualControl {
|
||||
bool updateDisplay = false;
|
||||
};
|
||||
|
||||
#endif // CAPTURE_ROUTE_H
|
||||
#endif // CAPTURE_ROUTE_H
|
||||
|
||||
@@ -1,43 +1,13 @@
|
||||
/**
|
||||
* @file consolControl.cpp
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief
|
||||
* @version 0.1
|
||||
* @date 2022-02-15
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
|
||||
#include "consolControl.h"
|
||||
|
||||
ConsolControl::ConsolControl() {
|
||||
this->debug = new DebugMqtt("ConsolControl");
|
||||
}
|
||||
|
||||
void ConsolControl::init(MoveControl *MoveControl) {
|
||||
this->moveControl = moveControl;
|
||||
}
|
||||
|
||||
void ConsolControl::run() {
|
||||
uint8_t side = -1;
|
||||
|
||||
if (Serial.available()) {
|
||||
char cmd = Serial.read();
|
||||
if (cmd == 'l') {
|
||||
side = 0;
|
||||
} else if (cmd == 'r') {
|
||||
side = 1;
|
||||
}
|
||||
|
||||
double p = Serial.parseFloat();
|
||||
double i = Serial.parseFloat();
|
||||
double d = Serial.parseFloat();
|
||||
double s = Serial.parseFloat();
|
||||
double r = Serial.parseFloat();
|
||||
|
||||
if (p && i && d && s && r) {
|
||||
Serial.println("ConsolControl changeDate");
|
||||
this->moveControl->setPidTunings(side, p, i, d);
|
||||
this->moveControl->setSpeed(s);
|
||||
this->moveControl->setRotationspeed(r);
|
||||
} else {
|
||||
this->moveControl->setDrivingStatus(DrivingStatus::stop);
|
||||
printManual();
|
||||
debug->sendMsg(Loglevel::error, "not all double are not zero");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ConsolControl::printManual() {
|
||||
Serial.println("r 12.0 13.0 4.0 1.0 1.0 // site p i d s r");
|
||||
}
|
||||
@@ -1,24 +1,20 @@
|
||||
/**
|
||||
* @file consolControl.h
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief
|
||||
* @version 0.1
|
||||
* @date 2022-02-15
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CONSOL_CONTROL_H
|
||||
#define CONSOL_CONTROL_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "moveControl.h"
|
||||
#include "driveModi/driveModi.h"
|
||||
#include "debugMqtt.h"
|
||||
|
||||
class ConsolControl : DriveModi{
|
||||
public:
|
||||
ConsolControl();
|
||||
void init(MoveControl *moveControl);
|
||||
void run();
|
||||
|
||||
private:
|
||||
void printManual();
|
||||
|
||||
MoveControl *moveControl;
|
||||
DebugMqtt *debug;
|
||||
|
||||
};
|
||||
|
||||
#endif // CONSOL_CONTROL_H
|
||||
#endif // CONSOL_CONTROL_H
|
||||
|
||||
@@ -51,7 +51,7 @@ class ManualControl : public DriveModi{
|
||||
/**
|
||||
* @brief Set the min delay between each loop
|
||||
*
|
||||
* @param delay time in Milliseconds
|
||||
* @param delay_ time in Milliseconds
|
||||
*/
|
||||
void setDelay(uint8_t delay_) { delay = delay_; }
|
||||
|
||||
@@ -79,4 +79,4 @@ class ManualControl : public DriveModi{
|
||||
double max_rotation = 7;
|
||||
};
|
||||
|
||||
#endif // MANUAL_CONTROL_H
|
||||
#endif // MANUAL_CONTROL_H
|
||||
|
||||
Reference in New Issue
Block a user