Finish documention until someone change something

This commit is contained in:
2022-02-15 20:12:50 +01:00
parent 3a2e51713b
commit c8e3344b27
50 changed files with 991 additions and 223 deletions
+1 -1
View File
@@ -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
*
+80 -2
View File
@@ -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;
}
}
+55 -2
View File
@@ -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
+2 -1
View File
@@ -1,7 +1,7 @@
/**
* @file driveManager.cpp
* @author Alexander Klein (alex@kleiax.de)
* @brief Implemention of the class driveManager.h.
* @brief Implemention of the class DriveManager
* @version 0.1
* @date 2021-12-14
*
@@ -17,6 +17,7 @@ Modi& operator++(Modi& m, int) {
DriveManager::DriveManager(MoveControl *moveControl) {
this->moveControl = moveControl;
// TODO: Delete magic numbers
this->navigation = new Navigation(17, 16);
}
+64 -1
View File
@@ -30,6 +30,10 @@
#include "driveModi/Modi/ConsolControl/consolControl.h"
#include "driveModi/Modi/TestMode/testMode.h"
/**
* @brief An enum to choose the DriveMode
*
*/
enum class Modi {
Off,
ManualControl,
@@ -41,15 +45,74 @@ enum class Modi {
class DriveManager {
public:
/**
* @brief Construct a new Drive Manager object
*
* Creates a Navigation object
*
* @param moveControl
*/
DriveManager(MoveControl *moveControl);
/**
* @brief Destroy the Drive Manager object
*
*/
~DriveManager();
/**
* @brief Calls all loop functions
*
* Calls the MoveControl, Navigation loop function. The
* loop function from the DriveMode is called if it is set.
*
* This function should be called every main loop.
*
*/
void loop();
/**
* @brief Increment the DriveModi enum
* Than calls changeModus
*
* @see Modi
*/
void nextModus();
/**
* @brief Change the DriveModi to a specific value
*
* Sets MoveControl to a safe state, delete the last
* DriveModi and than set the new DriveModi
*
* @param modus
*/
void changeModus(Modi modus);
/**
* @brief Get the Navigation object
*
* @return Navigation*
*/
Navigation* getNavigation() {return this->navigation;}
/**
* @brief Get the DriveModi Ptr object
*
* This is a pointer to the Object of the current DriveMode.
* If you know which DriveMode is active, you can cast this
* pointer to it.
*
* @see getDriveModi
* @return DriveModi*
*/
DriveModi* getDriveModiPtr() { return this->currentModusPtr; }
/**
* @brief Get the DriveModi enum
*
* @return Modi
*/
Modi getDriveModi() { return this->currentModus; }
private:
@@ -60,4 +123,4 @@ class DriveManager {
};
#endif // DRIVE_MANAGER_H
#endif // DRIVE_MANAGER_H
+14 -1
View File
@@ -14,11 +14,24 @@
#include <Ps3Controller.h>
/**
* @brief Baseclass to build DriveModi
*
* This class must be inherited by other classes which want to be
* act as a DriveModi, because the DriveModi structure uses polymorphism.
*/
class DriveModi {
public:
DriveModi(){}
virtual ~DriveModi(){}
/**
* @brief This function is called by the DriveManager
*
* All actions from a DriveMode have to called from
* this function or the PS3-Controller
*/
virtual void loop() = 0;
};
#endif // DRIVEMODI_H
#endif // DRIVEMODI_H