Update doxygen comments
This commit is contained in:
@@ -23,7 +23,13 @@
|
||||
*/
|
||||
#define NO_GLOBAL_INSTANCES
|
||||
|
||||
/**
|
||||
* @name SPI-Pins
|
||||
* @brief Pins for SPI communication with the gnss module
|
||||
*/
|
||||
///@{
|
||||
#define UBLOX_GNSS_SPI_CS 17
|
||||
#define UBLOX_GNSS_SPI_COPI 16
|
||||
#define UBLOX_GNSS_SPI_CIPO 4
|
||||
#define UBLOX_GNSS_SPI_SCK 5
|
||||
///@}
|
||||
|
||||
@@ -98,7 +98,22 @@ class MoveControl {
|
||||
*/
|
||||
void setRotationSpeed(double speed);
|
||||
|
||||
/**
|
||||
* @brief Set Raw Power Left
|
||||
*
|
||||
* This value has only an effect if DrivingStatus is raw.
|
||||
*
|
||||
* @param power between -100 and 100
|
||||
*/
|
||||
void setRawPowerLeft(int16_t power);
|
||||
|
||||
/**
|
||||
* @brief Set the Raw Power Right
|
||||
*
|
||||
* This value has only an effect if DrivingStatus is raw.
|
||||
*
|
||||
* @param power between -100 and 100
|
||||
*/
|
||||
void setRawPowerRight(int16_t power);
|
||||
|
||||
/**
|
||||
@@ -118,7 +133,19 @@ class MoveControl {
|
||||
* @return PID*
|
||||
*/
|
||||
PID* getPID(uint8_t side);
|
||||
|
||||
/**
|
||||
* @brief Get the Speedometer Left object
|
||||
*
|
||||
* @return Speedometer*
|
||||
*/
|
||||
Speedometer* getSpeedometerLeft() const { return this->left_speedometer; }
|
||||
|
||||
/**
|
||||
* @brief Get the Speedometer Right object
|
||||
*
|
||||
* @return Speedometer*
|
||||
*/
|
||||
Speedometer* getSpeedometerRight() const { return this->right_speedometer; }
|
||||
|
||||
/**
|
||||
|
||||
@@ -57,7 +57,6 @@ void Navigation::init(Route* route) {
|
||||
else
|
||||
this->route = new Route();
|
||||
|
||||
this->ntripClient = new NTRIPClient();
|
||||
this->compass = new QMC5883LCompass();
|
||||
|
||||
// Init Compass
|
||||
@@ -77,7 +76,7 @@ Navigation::~Navigation() {
|
||||
}
|
||||
|
||||
void Navigation::initNtrip(String host, uint16_t port, String mountPoint, String user, String password) {
|
||||
this->ntripClient->init(this->gps, host.c_str(), port, mountPoint.c_str(), user.c_str(), password.c_str());
|
||||
this->ntripClient = new NTRIPClient(this->gps, host.c_str(), port, mountPoint.c_str(), user.c_str(), password.c_str());
|
||||
this->ntripClient->gpsConfiguration();
|
||||
this->ntripClient->loop();
|
||||
this->ntripClient->setActivated(false);
|
||||
@@ -93,7 +92,7 @@ void Navigation::loop() {
|
||||
Navigation::newData = false;
|
||||
}
|
||||
|
||||
if (this->isNtripInit)
|
||||
if (this->ntripClient)
|
||||
this->ntripClient->loop();
|
||||
|
||||
if (millis() - this->lastMillis > AZIMUTH_UPDATE_DELAY) {
|
||||
@@ -169,12 +168,12 @@ bool Navigation::addCurrentPosToRoute() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Navigation::setPointBeforeTurn() {
|
||||
if (millis() - this->currentPosition.getCreationTime() > 1000)
|
||||
return false;
|
||||
this->beforeTurnPoint = this->currentPosition;
|
||||
return true;
|
||||
}
|
||||
// bool Navigation::setPointBeforeTurn() {
|
||||
// if (millis() - this->currentPosition.getCreationTime() > 1000)
|
||||
// return false;
|
||||
// this->beforeTurnPoint = this->currentPosition;
|
||||
// return true;
|
||||
// }
|
||||
|
||||
void Navigation::updateCurrentLocation() {
|
||||
if (Navigation::ubxUpdateTimeStatic == this->ubxUpdateTime)
|
||||
|
||||
@@ -128,14 +128,8 @@ class Navigation {
|
||||
*/
|
||||
bool addCurrentPosToRoute();
|
||||
|
||||
bool setPointBeforeTurn();
|
||||
|
||||
// /**
|
||||
// * @brief Returns the GPS object
|
||||
// *
|
||||
// * @return SFE_UBLOX_GNSS*
|
||||
// */
|
||||
// SFE_UBLOX_GNSS* getGPS() { return this->gps; }
|
||||
// TODO: can be deleted?
|
||||
// bool setPointBeforeTurn();
|
||||
|
||||
/**
|
||||
* @brief Get the Ubx Data object
|
||||
@@ -163,8 +157,25 @@ class Navigation {
|
||||
*/
|
||||
RouteInfo getRouteInfo() const { return this->route->getRouteInfo(); }
|
||||
Route* getRoute() const { return this->route; }
|
||||
|
||||
/**
|
||||
* @brief Get azimuth
|
||||
*
|
||||
* This value represents the angle between north and
|
||||
* the line of sight. Clockwise.
|
||||
*
|
||||
* @return uint16_t degree
|
||||
*/
|
||||
uint16_t getAzimuth() const { return this->azimuth; }
|
||||
|
||||
/**
|
||||
* @brief Set the output status for PVTdata.
|
||||
*
|
||||
* If this is true, a lot of information from the gnss module will be printed in
|
||||
* the interval of navigation frequency.
|
||||
*
|
||||
* @param status
|
||||
*/
|
||||
static void setOutputStatusPrintPVTdata(bool status);
|
||||
|
||||
private:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file route.cpp
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief Implements the class Route
|
||||
* @brief Implements the class Route and Point
|
||||
* @version 0.1
|
||||
* @date 2022-01-31
|
||||
*
|
||||
|
||||
+76
-8
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file route.h
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief Contains a class which hold multiple Points
|
||||
* @brief Contains the class Point and Route
|
||||
* @version 0.1
|
||||
* @date 2022-01-31
|
||||
*
|
||||
@@ -30,6 +30,10 @@
|
||||
*/
|
||||
class Point{
|
||||
public:
|
||||
/**
|
||||
* @brief Hold the data longitude and latitude
|
||||
*
|
||||
*/
|
||||
struct Coordinates {
|
||||
double lon;
|
||||
double lat;
|
||||
@@ -39,6 +43,10 @@ class Point{
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The Accuracy is set by the constructor
|
||||
*
|
||||
*/
|
||||
enum PointAccuracy {
|
||||
none,
|
||||
fourDigOfCM,
|
||||
@@ -54,6 +62,9 @@ class Point{
|
||||
*
|
||||
* @param lat latitude
|
||||
* @param lon longitude
|
||||
* @param horizontalAccuracy mm
|
||||
* @param coords Coordinates
|
||||
* @param imported if true than highest accuracy
|
||||
*/
|
||||
Point(double lat, double lon, uint32_t horizontalAccuracy = 0);
|
||||
Point(int32_t lat, int32_t lon, uint32_t horizontalAccuracy = 0);
|
||||
@@ -62,7 +73,7 @@ class Point{
|
||||
Point();
|
||||
|
||||
/**
|
||||
* @brief checks if to points are equal
|
||||
* @brief Checks if to points are equal.
|
||||
*
|
||||
* @param rhs
|
||||
* @return true
|
||||
@@ -71,16 +82,38 @@ class Point{
|
||||
bool operator==(const Point& rhs) const;
|
||||
|
||||
/**
|
||||
* @brief Checks if the Point is initalized.
|
||||
* @brief Checks if the point is initalized.
|
||||
*
|
||||
* @return true
|
||||
* @return false
|
||||
*/
|
||||
bool isInit() const { return this->coordinates.lat + this->coordinates.lon; }
|
||||
|
||||
/**
|
||||
* @brief Checks if the point is valid.
|
||||
*
|
||||
* If the accuracy is higher than zero, true will be returned.
|
||||
*
|
||||
* @return true
|
||||
* @return false
|
||||
*/
|
||||
bool isValid() const { return (this->accuracy > 0) ? true : false; }
|
||||
|
||||
/**
|
||||
* @brief Calculates the distance between to points.
|
||||
*
|
||||
* @param point
|
||||
* @return double meter
|
||||
*/
|
||||
double distanceTo(const Coordinates& point) const;
|
||||
double distanceTo(const Point& point) const;
|
||||
|
||||
/**
|
||||
* @brief Calculates the course to an other point.
|
||||
*
|
||||
* @param point
|
||||
* @return int16_t degree
|
||||
*/
|
||||
int16_t courseTo(const Coordinates& point) const;
|
||||
int16_t courseTo(const Point& point) const;
|
||||
|
||||
@@ -89,6 +122,14 @@ class Point{
|
||||
double getLatitude() const { return this->coordinates.lat; }
|
||||
Coordinates getCoordinates() const { return this->coordinates; }
|
||||
|
||||
/**
|
||||
* @brief Get the Accuracy object
|
||||
*
|
||||
* The higher the value, the greater the accuracy.
|
||||
* You can check it by PointAccuracy.
|
||||
*
|
||||
* @return PointAccuracy
|
||||
*/
|
||||
PointAccuracy getAccuracy() { return this->accuracy; }
|
||||
|
||||
private:
|
||||
@@ -124,32 +165,49 @@ struct RouteInfo{
|
||||
class Route {
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Route object
|
||||
* @brief Construct a new Route object.
|
||||
*/
|
||||
Route();
|
||||
|
||||
/**
|
||||
* @brief Adds a point to the list
|
||||
* @brief Adds a point to the list.
|
||||
*
|
||||
* @param point
|
||||
*/
|
||||
void addPointToRoute(Point point);
|
||||
|
||||
/**
|
||||
* @brief Delete all points.
|
||||
*
|
||||
*/
|
||||
void clear();
|
||||
|
||||
/**
|
||||
* @brief Select the first point as target
|
||||
* @brief Select the first point as target.
|
||||
*
|
||||
* @return Point
|
||||
*/
|
||||
Point startRoute();
|
||||
|
||||
/**
|
||||
* @brief Select the last point as target.
|
||||
*
|
||||
* @return Point
|
||||
*/
|
||||
Point endRoute();
|
||||
|
||||
/**
|
||||
* @brief Get the next point and set it as target
|
||||
* @brief Get the next point and set it as target.
|
||||
*
|
||||
* @return Point is zero if there are no more Points
|
||||
* @return Point is zero if there are no more Points.
|
||||
*/
|
||||
Point getNextPoint();
|
||||
|
||||
/**
|
||||
* @brief Get the previous point and set it as target.
|
||||
*
|
||||
* @return Point
|
||||
*/
|
||||
Point getPreviousPoint();
|
||||
|
||||
/**
|
||||
@@ -158,6 +216,16 @@ class Route {
|
||||
* @return RouteInfo
|
||||
*/
|
||||
RouteInfo getRouteInfo();
|
||||
|
||||
/**
|
||||
* @brief Get the Started object
|
||||
*
|
||||
* The Route will be marked as started when startRoute or
|
||||
* endRoute has been called.
|
||||
*
|
||||
* @return true
|
||||
* @return false
|
||||
*/
|
||||
bool getStarted() const { return this->started; }
|
||||
|
||||
private:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file NTRIPClient.cpp
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief
|
||||
* @brief Contains the implementation of the class NTRIPClient.
|
||||
* @version 0.1
|
||||
* @date 2022-09-18
|
||||
*
|
||||
@@ -11,15 +11,8 @@
|
||||
|
||||
#include "ntripClient.h"
|
||||
|
||||
NTRIPClient::NTRIPClient() {
|
||||
|
||||
}
|
||||
|
||||
NTRIPClient::~NTRIPClient() {
|
||||
delete this->ntripClient;
|
||||
}
|
||||
|
||||
void NTRIPClient::init(SFE_UBLOX_GNSS* gps, const char* host, uint16_t port, const char* mountPoint, const char* user, const char* password) {
|
||||
NTRIPClient::NTRIPClient(SFE_UBLOX_GNSS* gps, const char* host, uint16_t port, const char* mountPoint, const char* user, const char* password) {
|
||||
this->gps = gps;
|
||||
strcpy(this->host, host);
|
||||
this->port = port;
|
||||
@@ -31,6 +24,10 @@ void NTRIPClient::init(SFE_UBLOX_GNSS* gps, const char* host, uint16_t port, con
|
||||
this->state = NTRIPClientStates::closeConnection;
|
||||
}
|
||||
|
||||
NTRIPClient::~NTRIPClient() {
|
||||
delete this->ntripClient;
|
||||
}
|
||||
|
||||
void NTRIPClient::loop() {
|
||||
if (millis() - this->lastLoopTime < this->delayTime)
|
||||
return;
|
||||
|
||||
@@ -1,3 +1,14 @@
|
||||
/**
|
||||
* @file ntripClient.h
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief Contains the class NTRIPClient
|
||||
* @version 0.1
|
||||
* @date 2023-02-13
|
||||
*
|
||||
* @copyright Copyright (c) 2023
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NTRIP_CLIENT
|
||||
#define NTRIP_CLIENT
|
||||
|
||||
@@ -9,6 +20,10 @@
|
||||
|
||||
#include "debugTimes.h"
|
||||
|
||||
/**
|
||||
* @brief States for the state machine.
|
||||
*
|
||||
*/
|
||||
enum NTRIPClientStates {
|
||||
openConnection,
|
||||
pushData,
|
||||
@@ -16,24 +31,73 @@ enum NTRIPClientStates {
|
||||
wait,
|
||||
notAvailable
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Ntrip Client
|
||||
*
|
||||
* This class can connect to a ntrip server to pull correction
|
||||
* data and push it to a given gnss module. This module have to be compatible
|
||||
* with the SparkFun u-blox GNSS Arduino Library.
|
||||
*/
|
||||
class NTRIPClient {
|
||||
public:
|
||||
NTRIPClient();
|
||||
/**
|
||||
* @brief Construct a new NTRIPClient object
|
||||
*
|
||||
* @param gps The Gnss module
|
||||
* @param host
|
||||
* @param port
|
||||
* @param mountPoint
|
||||
* @param user
|
||||
* @param password
|
||||
*/
|
||||
NTRIPClient(SFE_UBLOX_GNSS* gps, const char* host, uint16_t port, const char* mountPoint, const char* user, const char* password);
|
||||
~NTRIPClient();
|
||||
|
||||
void init(SFE_UBLOX_GNSS* gps, const char* host, uint16_t port, const char* mountPoint, const char* user, const char* password);
|
||||
/**
|
||||
* @brief Runs the state machine.
|
||||
*
|
||||
* See NTRIPClientStates for more information.
|
||||
* Should be called ever main loop.
|
||||
*/
|
||||
void loop();
|
||||
|
||||
/**
|
||||
* @brief Configure the Gnss module to accept correction data
|
||||
*
|
||||
*/
|
||||
void gpsConfiguration();
|
||||
|
||||
/**
|
||||
* @brief Activate or deactivate the location transmission
|
||||
*
|
||||
* Some server need the position of the Gnss module to send the
|
||||
* right correction data.
|
||||
*
|
||||
* @param b
|
||||
*/
|
||||
void setTransmitLocation(bool b) { this->transmitLocation = b; }
|
||||
|
||||
/**
|
||||
* @brief Activate or deactivate the connection to the server.
|
||||
*
|
||||
* @param b
|
||||
* @return true success
|
||||
* @return false failure
|
||||
*/
|
||||
bool setActivated(bool b);
|
||||
|
||||
bool isConnected();
|
||||
|
||||
/**
|
||||
* @brief Get the Client State object
|
||||
*
|
||||
* Returns the state of the State machine
|
||||
*
|
||||
* @return NTRIPClientStates
|
||||
*/
|
||||
NTRIPClientStates getClientState() { return this->state; }
|
||||
|
||||
|
||||
|
||||
private:
|
||||
void pushGPGGA(NMEA_GGA_data_t *nmeaData);
|
||||
bool beginClient();
|
||||
|
||||
@@ -100,7 +100,22 @@ class Speedometer {
|
||||
*/
|
||||
double getSpeed();
|
||||
|
||||
/**
|
||||
* @brief Start calibration
|
||||
*
|
||||
* This functions stops the loop. So that steps of one manual wheel turn
|
||||
* can measured. Call calibrationMeasurementStop to start the loop and get
|
||||
* the result.
|
||||
*/
|
||||
void calibrationMeasurementStart();
|
||||
|
||||
/**
|
||||
* @brief Stop calibration
|
||||
*
|
||||
* Start the loop function and read the past steps.
|
||||
*
|
||||
* @return uint16_t steps since calibrationMeasurementStart was called
|
||||
*/
|
||||
uint16_t calibrationMeasurementStop();
|
||||
|
||||
|
||||
|
||||
@@ -59,6 +59,11 @@ class DebugTimes {
|
||||
*/
|
||||
uint16_t stopConsol(const char* name, uint16_t minTime = 0);
|
||||
|
||||
/**
|
||||
* @brief Sets if the result should be printed.
|
||||
*
|
||||
* @param enable
|
||||
*/
|
||||
static void setConsolOutput(bool enable);
|
||||
|
||||
private:
|
||||
|
||||
@@ -27,6 +27,7 @@ lib_deps =
|
||||
marian-craciunescu/ESP32Ping@^1.7
|
||||
bblanchon/ArduinoJson@^6.20.0
|
||||
mprograms/QMC5883LCompass@^1.1.1
|
||||
https://git.kleiax.de/PlatformIO-Libs/Menu.git
|
||||
upload_port = COM3
|
||||
|
||||
[env:release]
|
||||
|
||||
@@ -40,7 +40,25 @@ class OutputBuf : public std::streambuf {
|
||||
* @param debugMqtt
|
||||
*/
|
||||
OutputBuf(DebugMqtt* debugMqtt = nullptr, BluetoothSerial* serialBT = nullptr);
|
||||
|
||||
/**
|
||||
* @brief Activate the mqtt output
|
||||
*
|
||||
* This only works if the DebugMqtt is set by
|
||||
* setDebugMqtt.
|
||||
*
|
||||
* @param status
|
||||
*/
|
||||
void activateMqtt(bool status);
|
||||
|
||||
/**
|
||||
* @brief Active the output over the bluetooth serial consol
|
||||
*
|
||||
* This only works if BluetoothSerial is set by
|
||||
* setSerialBT.
|
||||
*
|
||||
* @param status
|
||||
*/
|
||||
void activateSerialBT(bool status);
|
||||
|
||||
void setDebugMqtt(DebugMqtt* debugMqtt);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file menuRoute.cpp
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief
|
||||
* @brief Contains the implementation of the classes MenuActionRoute, MenuRoute and MenuRouteWrapper.
|
||||
* @version 0.1
|
||||
* @date 2022-12-28
|
||||
*
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file menuRoute.h
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief
|
||||
* @brief Contains a classes to handles routes with the user input.
|
||||
* @version 0.1
|
||||
* @date 2022-12-28
|
||||
*
|
||||
@@ -28,9 +28,25 @@
|
||||
class MenuRoute;
|
||||
typedef void (MenuRoute::*DataFunction)(uint8_t);
|
||||
|
||||
/**
|
||||
* @brief MenuActionWrapper to call DataFunctions
|
||||
*
|
||||
* This class should be used to call importRoute,
|
||||
* exportRoute and clearRoute over the Menu.
|
||||
*/
|
||||
class MenuActionRoute : public MenuActionWrapper {
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Menu Action Route object
|
||||
*
|
||||
* @param menuRoute
|
||||
* @param dataFunction like exportRoute
|
||||
*/
|
||||
MenuActionRoute(MenuRoute* menuRoute, DataFunction dataFunction);
|
||||
|
||||
/**
|
||||
* @brief Runs the given DataFunction
|
||||
*/
|
||||
void action() override;
|
||||
|
||||
private:
|
||||
@@ -38,21 +54,66 @@ class MenuActionRoute : public MenuActionWrapper {
|
||||
DataFunction dataFunction;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Handles routes
|
||||
*
|
||||
* With this menu the user can import, export and delete routes.
|
||||
*/
|
||||
class MenuRoute : public MenuControl {
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Menu Route object
|
||||
*
|
||||
* @param route
|
||||
*/
|
||||
MenuRoute(Route* route);
|
||||
~MenuRoute();
|
||||
|
||||
/**
|
||||
* @brief Prints the last informations
|
||||
*
|
||||
* On first call this function calls the init function.
|
||||
* On every call this functions call the printMenu function from
|
||||
* the mainMenu of this class.
|
||||
*/
|
||||
void printMenu() override;
|
||||
|
||||
/**
|
||||
* @name User Inputs
|
||||
* @brief Inputs given by the parentMenu
|
||||
*/
|
||||
///@{
|
||||
void down() override;
|
||||
void up() override;
|
||||
void right() override;
|
||||
void left() override;
|
||||
void yes() override;
|
||||
void no() override;
|
||||
///@}
|
||||
|
||||
/**
|
||||
* @brief Import a Route.
|
||||
*
|
||||
* The functions tries to pull the given route id from the RoverApi.
|
||||
*
|
||||
* @param routeNumber id
|
||||
*/
|
||||
void importRoute(uint8_t routeNumber);
|
||||
|
||||
/**
|
||||
* @brief Export a Route.
|
||||
*
|
||||
* The functions tries to push the current route to the RoverApi.
|
||||
*
|
||||
* @param routeNumber id
|
||||
*/
|
||||
void exportRoute(uint8_t routeNumber);
|
||||
|
||||
/**
|
||||
* @brief Delete the current Route.
|
||||
*
|
||||
* @param none this param is not be used.
|
||||
*/
|
||||
void clearRoute(uint8_t none);
|
||||
|
||||
private:
|
||||
@@ -65,11 +126,26 @@ class MenuRoute : public MenuControl {
|
||||
bool blockInput = false;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief MenuRouteWrapper to call DataFunctions with numeric user input
|
||||
*
|
||||
*/
|
||||
class MenuRouteWrapper : public MenuIntInputWrapper {
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Menu Route Wrapper object.
|
||||
*
|
||||
* @param menuRoute
|
||||
* @param dataFunction
|
||||
*/
|
||||
MenuRouteWrapper(MenuRoute* menuRoute, DataFunction dataFunction);
|
||||
|
||||
/**
|
||||
* @brief Calls the given DataFunction.
|
||||
*
|
||||
* @param values The value to be given to the DataFunction.
|
||||
* @param length Number of values, should be 1.
|
||||
*/
|
||||
void action(int16_t* values, uint8_t length) override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file menuRoutePoints.cpp
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief
|
||||
* @brief Contains the implementation of the class MenuRoutePoints.
|
||||
* @version 0.1
|
||||
* @date 2022-12-28
|
||||
*
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file menuRoutePoints.h
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief
|
||||
* @brief Contains a class to print the coordinates of a Route.
|
||||
* @version 0.1
|
||||
* @date 2022-12-28
|
||||
*
|
||||
@@ -16,11 +16,29 @@
|
||||
#include "route.h"
|
||||
#include "menuInformationSites.h"
|
||||
|
||||
/**
|
||||
* @brief Prints coordinates of Route side by side.
|
||||
*
|
||||
*/
|
||||
class MenuRoutePoints : public MenuInformationSites {
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Menu Route Points object
|
||||
*
|
||||
* @param route
|
||||
*/
|
||||
MenuRoutePoints(Route *route);
|
||||
|
||||
/**
|
||||
* @brief Configure the base class MenuInformationSites
|
||||
*
|
||||
* Set the amount of pages.
|
||||
*/
|
||||
void init () override;
|
||||
|
||||
/**
|
||||
* @brief Prints the the coordinates of the current Point.
|
||||
*/
|
||||
void printPage() const override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -18,8 +18,19 @@
|
||||
#include "menuInformationSites.h"
|
||||
#include "battery.h"
|
||||
|
||||
/**
|
||||
* @brief Prints information about the current system status.
|
||||
*
|
||||
* The informations are about the batteries, memory and uptime.
|
||||
*/
|
||||
class MenuSysteminformation : public MenuInformationSites {
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Menu Systeminformation object
|
||||
*
|
||||
* @param mainBattery
|
||||
* @param gamepad
|
||||
*/
|
||||
MenuSysteminformation(Battery* mainBattery, Ps3Controller* gamepad);
|
||||
|
||||
private:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file menuTestMode.cpp
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief
|
||||
* @brief Contains the implementation of the class MenuTestMode.
|
||||
* @version 0.1
|
||||
* @date 2022-09-08
|
||||
*
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file menuTestMode.h
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief
|
||||
* @brief Contains a class to use and print information about the TestMode.
|
||||
* @version 0.1
|
||||
* @date 2022-09-08
|
||||
*
|
||||
@@ -17,11 +17,35 @@
|
||||
#include "menuAction.h"
|
||||
#include "menuIntInput.h"
|
||||
|
||||
/**
|
||||
* @brief Interact with the TestMode
|
||||
*
|
||||
*/
|
||||
class MenuTestMode : public MenuDriveMode {
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Menu Test Mode object
|
||||
*
|
||||
* @param driveManager
|
||||
*/
|
||||
MenuTestMode(DriveManager *driveManager);
|
||||
~MenuTestMode();
|
||||
void printMenu();
|
||||
|
||||
/**
|
||||
* @brief Prints the last informations
|
||||
*
|
||||
* On first call this function calls the init function.
|
||||
* On every call this functions call the printMenu function from
|
||||
* the mainMenu of this class.
|
||||
*/
|
||||
void printMenu() override;
|
||||
|
||||
/**
|
||||
* @brief Prints maneuver Timer
|
||||
*
|
||||
* Aside from that the function looks if the maneuver is done and
|
||||
* give the user input free.
|
||||
*/
|
||||
void printManeuverTime();
|
||||
|
||||
void down() override;
|
||||
@@ -31,6 +55,10 @@ class MenuTestMode : public MenuDriveMode {
|
||||
void yes() override;
|
||||
void no() override;
|
||||
|
||||
/**
|
||||
* @brief Calls the printManeuverTime function if a maneuver is in process.
|
||||
*
|
||||
*/
|
||||
void update() override;
|
||||
|
||||
TestMode* getTestMode() const { return this->testMode; }
|
||||
|
||||
@@ -30,8 +30,17 @@ class MenuDriveMode : public MenuControl {
|
||||
void down() override {}
|
||||
void up() override {}
|
||||
void right() override {}
|
||||
|
||||
/**
|
||||
* @brief Goes back to the parentMenu.
|
||||
*/
|
||||
void left() override;
|
||||
|
||||
/**
|
||||
* @brief Calls left.
|
||||
*/
|
||||
void no() override;
|
||||
|
||||
void yes() override {}
|
||||
|
||||
virtual void printMenu() = 0;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file testMode.cpp
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief
|
||||
* @brief Contains the implementation of the class TestMode.
|
||||
* @version 0.1
|
||||
* @date 2022-09-08
|
||||
*
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file testMode.h
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief
|
||||
* @brief Contains a class to test different functions from the rover.
|
||||
* @version 0.1
|
||||
* @date 2022-09-08
|
||||
*
|
||||
@@ -17,8 +17,18 @@
|
||||
#include "navigation.h"
|
||||
#include "driveModi/driveModi.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief Test different functions from the rover.
|
||||
*
|
||||
* You can test engine, engine controller, light and speed meter.
|
||||
*/
|
||||
class TestMode : public DriveModi {
|
||||
public:
|
||||
/**
|
||||
* @brief Different states to test the engine
|
||||
*
|
||||
*/
|
||||
enum Maneuver {
|
||||
None,
|
||||
LeftEngine,
|
||||
@@ -28,23 +38,87 @@ class TestMode : public DriveModi {
|
||||
Drive
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Construct a new Test Mode object
|
||||
*
|
||||
* @param moveControl
|
||||
* @param navigation
|
||||
*/
|
||||
TestMode(MoveControl *moveControl, Navigation* navigation);
|
||||
~TestMode();
|
||||
|
||||
/**
|
||||
* @brief Controls the maneuver.
|
||||
*
|
||||
* Needed for actions which take a longer time.
|
||||
* Should be called ever main loop.
|
||||
*/
|
||||
void loop() override;
|
||||
|
||||
/**
|
||||
* @brief Set the speed for the Maneuver Drive
|
||||
*
|
||||
* @param speed m/s / 100
|
||||
*/
|
||||
void setSpeed(int16_t speed);
|
||||
|
||||
/**
|
||||
* @brief Set the rotation speed for the Maneuver Drive
|
||||
*
|
||||
* @param speed rad/s / 100
|
||||
*/
|
||||
void setRotationSpeed(int16_t speed);
|
||||
|
||||
bool drive(int16_t cm = 0, int16_t degree = 0);
|
||||
|
||||
/**
|
||||
* @brief Sets the left Engine to a specific power value.
|
||||
*
|
||||
* This start a maneuver with the given time.
|
||||
*
|
||||
* @param powerPercentage from 0% to 100%
|
||||
* @param seconds time to run the engine
|
||||
* @return true success
|
||||
* @return false failure
|
||||
*/
|
||||
bool leftEngine(int16_t powerPercentage, int16_t seconds);
|
||||
|
||||
/**
|
||||
* @brief See leftEngine
|
||||
*
|
||||
* @param powerPercentage
|
||||
* @param seconds
|
||||
* @return true
|
||||
* @return false
|
||||
*/
|
||||
bool rightEngine(int16_t powerPercentage, int16_t seconds);
|
||||
|
||||
/**
|
||||
* @brief See leftEngine
|
||||
*
|
||||
* @param powerPercentage
|
||||
* @param seconds
|
||||
* @return true
|
||||
* @return false
|
||||
*/
|
||||
bool bothEngine(int16_t powerPercentage, int16_t seconds);
|
||||
|
||||
/**
|
||||
* @brief Abort the running maneuver.
|
||||
*
|
||||
* Stops all movement. This is the only possibility to cancel a maneuver
|
||||
* before the time is up.
|
||||
*/
|
||||
void abortManeuver();
|
||||
|
||||
uint8_t getRemainingManeuverTime();
|
||||
|
||||
/**
|
||||
* @brief Returns true if a maneuver is running
|
||||
*
|
||||
* @return true
|
||||
* @return false
|
||||
*/
|
||||
bool getBusy() const { return this->busy; }
|
||||
Maneuver getManeuver() const { return this->maneuver; }
|
||||
|
||||
|
||||
+21
-21
@@ -50,7 +50,7 @@ MoveControl moveController;
|
||||
DriveManager* driveManager;
|
||||
Menu* main_m;
|
||||
LiquidCrystal_I2C* lcd;
|
||||
DisplayWrapper* lcdWrapper;
|
||||
LcdWrapper* lcdWrapper;
|
||||
OutputBuf* outputBuf;
|
||||
DebugMqtt* debugMqtt = nullptr;
|
||||
Battery* mainBattery;
|
||||
@@ -125,7 +125,7 @@ void setup() {
|
||||
lcd->printf("%c Kleiax-Rover %c", wifiIndicator, wifiIndicator);
|
||||
lcd->setCursor(0, 1);
|
||||
lcd->print("Press PS-Button");
|
||||
lcdWrapper = new DisplayWrapper(lcd);
|
||||
lcdWrapper = new LcdWrapper(lcd);
|
||||
|
||||
makeMenu();
|
||||
|
||||
@@ -280,17 +280,17 @@ void makeMenu() {
|
||||
// Set Menus on LCD
|
||||
main_m->setLcd(lcdWrapper);
|
||||
mode_m->setLcd(lcdWrapper);
|
||||
pid_m->setLcd(lcdWrapper);
|
||||
pidl_m->setLcd(lcdWrapper);
|
||||
pidr_m->setLcd(lcdWrapper);
|
||||
man_m->setLcd(lcdWrapper);
|
||||
cap_m->setLcd(lcdWrapper);
|
||||
auto_m->setLcd(lcdWrapper);
|
||||
testM_m->setLcd(lcdWrapper);
|
||||
gps_m->setLcd(lcdWrapper);
|
||||
sys_m->setLcd(lcdWrapper);
|
||||
rout_m->setLcd(lcdWrapper);
|
||||
test_m->setLcd(lcdWrapper);
|
||||
pid_m->setLcd(LcdWrapper);
|
||||
pidl_m->setLcd(LcdWrapper);
|
||||
pidr_m->setLcd(LcdWrapper);
|
||||
man_m->setLcd(LcdWrapper);
|
||||
cap_m->setLcd(LcdWrapper);
|
||||
auto_m->setLcd(LcdWrapper);
|
||||
testM_m->setLcd(LcdWrapper);
|
||||
gps_m->setLcd(LcdWrapper);
|
||||
sys_m->setLcd(LcdWrapper);
|
||||
rout_m->setLcd(LcdWrapper);
|
||||
test_m->setLcd(LcdWrapper);
|
||||
|
||||
|
||||
// Entry for the main menu
|
||||
@@ -342,17 +342,17 @@ void makeMenu() {
|
||||
}
|
||||
|
||||
void restart(void) {
|
||||
lcdWrapper->clear();
|
||||
lcdWrapper->setCursor(0, 0);
|
||||
lcdWrapper->print("Rebooting ...");
|
||||
LcdWrapper->clear();
|
||||
LcdWrapper->setCursor(0, 0);
|
||||
LcdWrapper->print("Rebooting ...");
|
||||
ESP.restart();
|
||||
}
|
||||
|
||||
void disconnectController(void) {
|
||||
disconnectPs3 = true;
|
||||
lcdWrapper->clear();
|
||||
lcdWrapper->setCursor(0, 0);
|
||||
lcdWrapper->print("Controller is");
|
||||
lcdWrapper->setCursor(0, 1);
|
||||
lcdWrapper->print("disconnected.");
|
||||
LcdWrapper->clear();
|
||||
LcdWrapper->setCursor(0, 0);
|
||||
LcdWrapper->print("Controller is");
|
||||
LcdWrapper->setCursor(0, 1);
|
||||
LcdWrapper->print("disconnected.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user