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
+15 -2
View File
@@ -78,5 +78,18 @@
"streambuf": "cpp",
"functional": "cpp",
"cmath": "cpp"
}
}
},
"cSpell.words": [
"Ahnung",
"akku",
"gast",
"Huus",
"Keine",
"kleiax",
"Lebennig",
"Punica",
"RHEDE",
"TPMOBIL",
"ZLPJ"
]
}
+10 -10
View File
@@ -483,7 +483,7 @@ EXTRACT_ALL = YES
# be included in the documentation.
# The default value is: NO.
EXTRACT_PRIVATE = NO
EXTRACT_PRIVATE = YES
# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual
# methods of a class will be included in the documentation.
@@ -501,7 +501,7 @@ EXTRACT_PACKAGE = NO
# included in the documentation.
# The default value is: NO.
EXTRACT_STATIC = NO
EXTRACT_STATIC = YES
# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined
# locally in source files will be included in the documentation. If set to NO,
@@ -793,7 +793,7 @@ CITE_BIB_FILES =
# messages are off.
# The default value is: NO.
QUIET = NO
QUIET = YES
# The WARNINGS tag can be used to turn on/off the warning messages that are
# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES
@@ -834,7 +834,7 @@ WARN_IF_INCOMPLETE_DOC = YES
# WARN_IF_INCOMPLETE_DOC
# The default value is: NO.
WARN_NO_PARAMDOC = NO
WARN_NO_PARAMDOC = YES
# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS
@@ -932,7 +932,6 @@ FILE_PATTERNS = *.c \
*.md \
*.mm \
*.dox \
*.py \
*.pyw \
*.f90 \
*.f95 \
@@ -945,7 +944,8 @@ FILE_PATTERNS = *.c \
*.vhdl \
*.ucf \
*.qsf \
*.ice
*.ice \
*.cpp
# The RECURSIVE tag can be used to specify whether or not subdirectories should
# be searched for input files as well.
@@ -2358,7 +2358,7 @@ EXTERNAL_PAGES = YES
# powerful graphs.
# The default value is: YES.
CLASS_DIAGRAMS = YES
CLASS_DIAGRAMS = NO
# You can include diagrams made with dia in doxygen documentation. Doxygen will
# then run dia to produce the diagram and insert it in the documentation. The
@@ -2380,7 +2380,7 @@ HIDE_UNDOC_RELATIONS = YES
# set to NO
# The default value is: NO.
HAVE_DOT = NO
HAVE_DOT = YES
# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
# to run in parallel. When set to 0 doxygen will base this on the number of
@@ -2519,7 +2519,7 @@ INCLUDED_BY_GRAPH = YES
# The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES.
CALL_GRAPH = NO
CALL_GRAPH = YES
# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
# dependency graph for every global function or class method.
@@ -2531,7 +2531,7 @@ CALL_GRAPH = NO
# The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES.
CALLER_GRAPH = NO
CALLER_GRAPH = YES
# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
# hierarchy of all classes instead of a textual one.
+2 -1
View File
@@ -1,2 +1,3 @@
Menu hat manchmal speicher leaks :/
-> Document the Akku lib
-> Program underfloorLighting
+16 -1
View File
@@ -1,2 +1,17 @@
// PS3 Controller
/**
* @file config.h
* @author Alexander Klein (alex@kleiax.de)
* @brief Some defines to configere the project.
* @version 0.1
* @date 2022-02-15
*
* @copyright Copyright (c) 2022
*
*/
/**
* @brief The MAC-Address saved in PS3-Controller
*
* The PS3-Controller only connects to the address which is saved in it.
*/
#define CONTROLLER_MAC "24:62:AB:F2:4B:3A"
+6 -8
View File
@@ -1,7 +1,7 @@
/**
* @file moveControl.h
* @author Alexander Klein (alex@kleiax.de)
* @brief Contrains the MoveControl class
* @brief Contains the MoveControl class
* @version 0.1
* @date 2021-12-14
*
@@ -32,7 +32,7 @@ enum DrivingStatus {stop,
/**
* @brief This class manages the motors and the encoders
*
* The controler uses two PIDs to control the motors. The PIDs
* The class uses two PIDs to control the motors. The PIDs
* use the Speedometer class to get the current speed and the
* given target speed to calculate a new duty cycle for the motors.
*
@@ -42,7 +42,7 @@ class MoveControl {
/**
* @brief Construct a new Move Control object
*
* Initalize the motors, encoders and PIDs with given
* Initialize the motors, encoders and PIDs with given
* values in moveControlConfig.h
*/
MoveControl();
@@ -66,14 +66,14 @@ class MoveControl {
void loop();
/**
* @brief Noramly called repeatedly by loop() to calcluate new values.
* @brief Normally called repeatedly by loop() to calculate new values.
*/
void runMoveControl();
/**
* @brief Set the DrivingStatus
*
* @see DrDrivingStatus
* @see DrivingStatus
* @param status
*/
void setDrivingStatus(DrivingStatus status);
@@ -99,8 +99,6 @@ class MoveControl {
/**
* @brief Set the pid tunings
*
* TODO: check if the function is working or indicates seg fault
*
* @param side 0 -> left, 1 -> right
* @param p
* @param i
@@ -119,7 +117,7 @@ class MoveControl {
/**
* @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_; }
+2 -2
View File
@@ -1,7 +1,7 @@
/**
* @file moveControlConfig.h
* @author Alexander Klein (alex@kleiax.de)
* @brief This file inherits some configuartion for moveControl.h
* @brief This file inherits some configurations for moveControl.h
* @version 0.1
* @date 2021-12-14
*
@@ -41,4 +41,4 @@
// SPEEDOMETER
#define WHEEL_DIAMETER 0.1263
#define ENC_STEPS 1024
#define ENC_STEPS 1024
+40 -4
View File
@@ -1,7 +1,7 @@
/**
* @file network.h
* @author Alexander Klein (alex@kleiax.de)
* @brief TODO: write some stuff here too
* @brief Contains the Network class.
* @version 0.1
* @date 2021-12-14
*
@@ -18,17 +18,53 @@
#include "networkConfig.h"
#define MQTT_TIME_RECONNECT 2500
/**
* @brief This class handles all network stuff
*
* This class only inherits static functions and members and use
* only the configuration data is given by networkConfig.h
*
*/
class Network {
public:
/**
* @brief Set the all IPs needed by this class
*/
static void setIps();
/**
* @brief Establish a connection to the WiFi.
*/
static void connectWifi();
/**
* @brief Set all general settings to connect to a broker.
*/
static void setupMQTT();
/**
* @brief Checks if mqtt is still connected
*
* If mqtt is not connect, this function try a reconnect
* with the function connectMQTT. This function should be
* called every mainloop.
*/
static void checkMQTT();
static PubSubClient* getMqtttClient();
/**
* @brief Get the Mqtt Client object
*
* @return PubSubClient*
*/
static PubSubClient* getMqttClient();
private:
/**
* @brief Tries a connect to the broker
*
* @return true if the connect attemp was successful
* @return false if the connect attemp was unsuccessful
*/
static bool connectMQTT();
static IPAddress local_IP;
+17
View File
@@ -1,5 +1,22 @@
/**
* @file networkConfig.h
* @author Alexander Klein (alex@kleiax.de)
* @brief Contains the settings for the Network class
*
* With different defines the location can be choosen.
*
* @version 0.1
* @date 2022-02-15
*
* @copyright Copyright (c) 2022
*
*/
// General config
#define MQTT_TIME_RECONNECT 2500
#define HW1
//Network config RHEDE
#ifdef RHEDE
#define WLAN_SSID "LebennigHuus"
+5 -3
View File
@@ -18,9 +18,11 @@ char DebugMqtt::msg[MQTT_BUFFER_SIZE];
char DebugMqtt::topic[MQTT_BUFFER_SIZE];
DebugMqtt::DebugMqtt(const char* name) {
DebugMqtt::DebugMqtt(const char* name, uint8_t bufSize) {
this->name = name;
this->buf = new char[this->bufSitze];
if (bufSize != 0)
this->bufSize = bufSize;
this->buf = new char[this->bufSize];
}
DebugMqtt::~DebugMqtt() {
@@ -62,7 +64,7 @@ void DebugMqtt::writeToInflux(String measurement_name, String field_set, float m
void DebugMqtt::addCharacter(char c) {
this->buf[this->bufPos] = c;
this->bufPos++;
if (c == '\n' || this->bufPos >= this->bufSitze - 1) {
if (c == '\n' || this->bufPos >= this->bufSize - 1) {
this->buf[this->bufPos - 1] = '\0';
this->sendMsg(Loglevel::info, buf);
this->bufPos = 0;
+19 -9
View File
@@ -69,15 +69,16 @@ class DebugMqtt {
* @brief Construct a new Debug Mqtt object.
*
* @param name A String with send with every Message.
* @param bufSize for the addCharacter function.
*/
DebugMqtt(const char* name);
DebugMqtt(const char* name, uint8_t bufSize = 0);
~DebugMqtt();
/**
* @brief Send a Message via MQTT
*
* This funtion uses sendData to send the given string and
* This function uses sendData to send the given string and
* add the name to the message given by the constructer.
*
* @see sendData()
@@ -93,9 +94,9 @@ class DebugMqtt {
/**
* @brief Send a Message via MQTT
*
* This funtion sends the Data via MQTT with the given topic
* This function sends the Data via MQTT with the given topic
* from Loglevel or followed by given String topic.
* Normaly this function is called by sendMsg() or by
* Normally this function is called by sendMsg() or by
* writeToInflux()
*
* @see sendData()
@@ -112,7 +113,7 @@ class DebugMqtt {
/**
* @brief Send a Message via MQTT for InfluxDB
*
* This funtion sends a MQTT message which is intended for
* This function sends a MQTT message which is intended for
* Telegraf. Telegraf can listen on MQTT messages and put
* them in an Influx Database.
*
@@ -123,14 +124,23 @@ class DebugMqtt {
*/
void writeToInflux(String measurement_name, String field_set, float measurement, uint64_t nanos);
/**
* @brief Adds a single character to the buf
*
* The buf will be flushed out:
* 1. when the buffer is full
* 2. when the character is '\n'
*
* @param c
*/
void addCharacter(char c);
/**
* @brief Initalize debugMQTT for all instances
* @brief Initialize debugMQTT for all instances
*
* You only have to call this function once for your project.
* If you call this funtion again you overwrite the client and
* the loglevel. If you only eant du overwrite the max_loglevel
* If you call this function again you overwrite the client and
* the loglevel. If you only want du overwrite the max_loglevel
* use changeLoglevel()
*
* @see changeLoglevel()
@@ -153,7 +163,7 @@ class DebugMqtt {
const char* name;
char* buf;
uint8_t bufPos = 0;
uint8_t bufSitze = 100;
uint8_t bufSize = 100;
static String enum_to_string(Loglevel loglevel);
+2 -2
View File
@@ -1,7 +1,7 @@
/**
* @file outputStreamMqtt.cpp
* @file outputBufMqtt.cpp
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @brief Contains the implementation of the class OutputBufMqtt
* @version 0.1
* @date 2022-02-14
*
+24 -2
View File
@@ -1,7 +1,11 @@
/**
* @file outputStreamMqtt.h
* @file outputBufMqtt.h
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @brief Contains a small class that provide a streambuf
*
* The streambuf is used to double the std::cout to consol
* and MQTT.
*
* @version 0.1
* @date 2022-02-14
*
@@ -19,11 +23,29 @@
#include "debugMqtt.h"
/**
* @brief A alternativ streambuf for std::cout
*
* The streambuf is used to double the std::cout to consol
* and MQTT.
*
*/
class OutputBufMqtt : public std::streambuf {
public:
/**
* @brief Construct a new Output Buf Mqtt object
*
* @param debugMqtt
*/
OutputBufMqtt(DebugMqtt* debugMqtt);
protected:
/**
* @brief
*
* @param c
* @return std::streambuf::int_type
*/
virtual std::streambuf::int_type overflow(std::streambuf::int_type c);
public:
+1 -1
View File
@@ -1,7 +1,7 @@
/**
* @file menu.cpp
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @brief Implementation of the class Menu
* @version 0.1
* @date 2022-01-12
*
+20 -10
View File
@@ -1,7 +1,7 @@
/**
* @file menu.h
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @brief Contains the Menu class
* @version 0.1
* @date 2022-01-12
*
@@ -17,20 +17,30 @@
#include "menuControl.h"
class MenuAction;
/**
* @brief A class to build menu structers
*/
class Menu : public MenuControl {
public:
Menu();
/**
* @brief Add a menu action to the menu
*
* @param entry
*/
void addEntry(MenuAction* entry);
void printMenu();
void update();
void down();
void up();
void right();
void left();
void yes();
void no();
void printMenu() override;
void update() override;
void down() override;
void up() override;
void right() override;
void left() override;
void yes() override;
void no() override;
private:
bool inSubmenu = false;
@@ -40,4 +50,4 @@ class Menu : public MenuControl {
};
#endif // MENU_H
#endif // MENU_H
+3 -17
View File
@@ -1,7 +1,7 @@
/**
* @file menuEntry.cpp
* @file menuAction.cpp
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @brief Implentation of the class MenuAction
* @version 0.1
* @date 2022-01-12
*
@@ -16,20 +16,6 @@ MenuAction::MenuAction(const char* name, void (*function) (), void (*callback) (
this->callback = callback;
}
MenuAction::MenuAction(const char* name, void (*function) ()) {
this->name = name;
this->function = function;
this->callback = nullptr;
}
// MenuAction::MenuAction(const char* name, void (DriveManager:: *classFunction) ()) {
// this->name = name;
// this->classFunction = classFunction;
// this->classFunc = true;
// this->function = nullptr;
// this->callback = nullptr;
// }
MenuAction::MenuAction(const char* name, MenuControl* menu) {
this->name = name;
this->menu = menu;
@@ -60,4 +46,4 @@ MenuControl* MenuAction::getMenu() {
return this->menu;
else
return nullptr;
}
}
+53 -5
View File
@@ -1,7 +1,7 @@
/**
* @file menuEntry.h
* @file menuAction.h
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @brief Contains the MenuAction class
* @version 0.1
* @date 2022-01-12
*
@@ -14,15 +14,63 @@
#include "menu.h"
class MenuControl;
/**
* @brief This class forms the transition between menus.
*
* In the Menu these are the entries.
* This class can be call an submenu or a function.
*/
class MenuAction {
public:
MenuAction(const char* name, void (*function) (), void (*callback) ());
MenuAction(const char* name, void (*function) ());
/**
* @brief Construct a new Menu Action object
*
* @param name shown in the Menu
* @param function to call when activate the entry
* @param callback to call when leave the entry
*/
MenuAction(const char* name, void (*function) (), void (*callback) () = nullptr);
/**
* @brief Construct a new Menu Action object
*
* This constructer is used for submenus.
*
* @param name shown in the Menu
* @param menu to call when activate the entry
*/
MenuAction(const char* name, MenuControl* menu);
/**
* @brief activates the entry
*/
void runAction();
/**
* @brief Get the Name string
*
* @return const char*
*/
const char* getName();
/**
* @brief Get the Is Menu object
*
* @return true runAction calls a submenu
* @return false runAction call a function
*/
bool getIsMenu();
/**
* @brief Get the Menu object
*
* Before call this function it may be useful
* to check if is it a submenu with getIsMenu.
*
* @return MenuControl*
*/
MenuControl* getMenu();
private:
@@ -35,4 +83,4 @@ class MenuAction {
MenuControl* menu;
};
#endif // MENU_ENTRY_H
#endif // MENU_ENTRY_H
+37 -3
View File
@@ -1,7 +1,7 @@
/**
* @file menuControl.h
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @brief Contains a abstract class for Menu
* @version 0.1
* @date 2022-01-19
*
@@ -15,25 +15,59 @@
#include <iostream>
#include <LiquidCrystal_I2C.h>
/**
* @brief Baseclass to build Menus
*
* This class must be inherited by other classes which want to be
* act as a menu, because the menu structure uses polymorphism.
*
*/
class MenuControl {
public:
// Ínputs from the Gamepad
/** @name UserInputs
* @brief This functions should be called be user actions.
*
* This functions have to be implement in every other menu
* class.
*/
///@{
virtual void down();
virtual void up();
virtual void right();
virtual void left();
virtual void yes();
virtual void no();
///@}
/**
* @brief can be called to update shown data
*/
virtual void update();
virtual void printMenu();
/**
* @brief Set the Parent Menu
*
* If the parentMenu is set it will be called automaticaly
* when the user left the child menu.
*
* @param menu
*/
void setParentMenu(MenuControl* menu) { this->parentMenu = menu; }
/**
* @brief Set the Lcd object
*
* If this is set the menu will be print on the display too.
*
* @param lcd
*/
void setLcd(LiquidCrystal_I2C* lcd) { this->lcd = lcd; }
protected:
MenuControl* parentMenu = nullptr;
LiquidCrystal_I2C* lcd = nullptr;
};
#endif // MENU_CONTROLL_H
#endif // MENU_CONTROLL_H
+3 -3
View File
@@ -32,7 +32,7 @@ class MotorControl {
MotorControl();
/**
* @brief Initalize the motorcontroler
* @brief Initialize the motorController
*
* @param pwm_pin The output pin for the signal on the esp.
* @param pwm_channel One of the pwm channels from the esp.
@@ -53,7 +53,7 @@ class MotorControl {
uint16_t loop();
/**
* @brief Normaly called repeatedly by loop() to update the pwm signal.
* @brief Normally called repeatedly by loop() to update the pwm signal.
*
* Checks the difference between target power and current power to
* increase or decrease the duty cycle. The amount of decrease or increase
@@ -167,4 +167,4 @@ class MotorControl {
};
#endif // MOTOR_CONTROL_H
#endif // MOTOR_CONTROL_H
+4 -4
View File
@@ -1,7 +1,7 @@
/**
* @file navigation.cpp
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @brief Contains the implementation of the class Navigation
* @version 0.1
* @date 2022-01-31
*
@@ -50,7 +50,7 @@ CourseCorrection Navigation::getCourseCorrection() {
Point currentPos = this->currentLocation();
double targetCourse = Navigation::courseTo(currentPos, this->targetPoint);
double distance = Navigation::distanceBetwenn(currentPos, this->targetPoint);
double distance = Navigation::distanceBetween(currentPos, this->targetPoint);
if (targetCourse < 0 || distance < 0 || this->navigationFinished)
return courseCorrection;
@@ -89,7 +89,7 @@ bool Navigation::addCurrentPosToRoute() {
}
// Ever Point after the first
if (MIN_DISTANCE_BETWEEN_POINTS <= this->distanceBetwenn(p, this->lastPoint)) {
if (MIN_DISTANCE_BETWEEN_POINTS <= this->distanceBetween(p, this->lastPoint)) {
this->route->addPointToRoute(p);
this->lastPoint = p;
return true;
@@ -121,7 +121,7 @@ bool Navigation::setTargetPoint(Point target) {
return false;
}
double Navigation::distanceBetwenn(Point p1, Point p2) {
double Navigation::distanceBetween(Point p1, Point p2) {
if (p1.isValid() && p2.isValid())
return TinyGPSPlus::distanceBetween(p1.lat, p1.lon, p2.lat, p2.lon);
return -1;
+123 -3
View File
@@ -1,7 +1,7 @@
/**
* @file navigation.h
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @brief Contains a class which navigate an object by the given route
* @version 0.1
* @date 2022-01-10
*
@@ -18,33 +18,153 @@
#include "route.h"
/**
* @brief The minimal distance between Points
*
* This is a very critical option. It have to be
* around the half accuracy of the positioning system
*
*/
#define MIN_DISTANCE_BETWEEN_POINTS 1
/**
* @brief This struct inherits the result of the navigation
*
* The drive get objects of this struct and should
* correct the direction in dependency on this.
*
*/
struct CourseCorrection {
int16_t correction;
double distance;
};
/**
* @brief This class navigate an object
*
* The class use the given Route and the gps device
* to tell the driver in which direction he have to
* be drive and the distance to the next checkpoint.
*
*/
class Navigation {
public:
/**
* @brief Construct a new Navigation object
*
* @param rx pin to the gps device
* @param tx pin to the gps device
* @param route with which to navigate
*/
Navigation(uint8_t rx, uint8_t tx, Route* route = nullptr);
/**
* @brief Destroy the Navigation object
*
*/
~Navigation();
/**
* @brief Decodes new GPS information
*
* Should be called ever main loop.
*/
void loop();
/**
* @brief creates a new empty route
*
*/
void newRoute();
/**
* @brief Tries to start the route
*
* For example the route can not be started
* if there are no Points or wrong Points.
*
* @return true route is started
* @return false route can not be started
*/
bool startNavigation();
/**
* @brief Get the Course Correction object
*
* This should be called by the driver to get new instructions.
*
* @return CourseCorrection
*/
CourseCorrection getCourseCorrection();
/**
* @brief Tries to add the current Position to the route
*
* This can be go wrong if there is no valid GPS signal
*
* @return true successful added point
* @return false no point added to route
*/
bool addCurrentPosToRoute();
/**
* @brief Returns the GPS object
*
* @return TinyGPSPlus*
*/
TinyGPSPlus* getGPS() { return this->gps; }
/**
* @brief Get the Route Info object
*
* This object contains information about the route.
* For example the stored points.
*
* @return RouteInfo
*/
RouteInfo getRouteInfo() const { return this->route->getRouteInfo(); }
private:
/**
* @brief Returns the current Location
*
* @return Point
*/
Point currentLocation();
/**
* @brief Set the next point as target
*
* @return true
* @return false
*/
bool nextPoint();
/**
* @brief Set the target point
*
* @param target
* @return true
* @return false
*/
bool setTargetPoint(Point target);
static double distanceBetwenn(Point p1, Point p2);
/**
* @brief Calculate the distance between to points
*
* @param p1 point 1
* @param p2 point 2
* @return double distance in meter
*/
static double distanceBetween(Point p1, Point p2);
/**
* @brief Calculates the course from point1 to point2
*
* @param p1 point 1
* @param p2 point 2
* @return double degree north = 0° west = 270°
*/
static double courseTo(Point p1, Point p2);
TinyGPSPlus* gps;
@@ -57,4 +177,4 @@ class Navigation {
bool navigationFinished = false;
};
#endif // NAVIGATION_H
#endif // NAVIGATION_H
+1 -4
View File
@@ -1,7 +1,7 @@
/**
* @file route.cpp
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @brief Implements the class Route
* @version 0.1
* @date 2022-01-31
*
@@ -11,9 +11,6 @@
#include "route.h"
// TODO: Delete iostream
#include <iostream>
Route::Route() {
}
+68 -1
View File
@@ -1,7 +1,7 @@
/**
* @file route.h
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @brief Contains a class which hold multiple Points
* @version 0.1
* @date 2022-01-31
*
@@ -16,33 +16,100 @@
#include <list>
/**
* @brief A to handle points on the earth
*
* The points inherits latidue and longitude as doubles
*
*/
class Point{
public:
/**
* @brief Construct a new Point object
*
* @param lat latidude
* @param lon longitude
*/
Point(double lat, double lon) { this->lat = lat; this->lon = lon; }
Point(){ this->lat = 0; this->lon = 0; }
double lat = 0;
double lon = 0;
/**
* @brief checks if to points are equal
*
* @param rhs
* @return true
* @return false
*/
bool operator==(const Point& rhs) const {
return this->lat == rhs.lat && this->lon == rhs.lon;
}
/**
* @brief Checks if the Point is valid
*
* @return true
* @return false
*/
bool isValid() const { return this->lat + this->lon; }
};
/**
* @brief Holds some route information
*
*/
struct RouteInfo{
/**
* @brief Selected number of Points
*/
uint16_t currentPoint;
/**
* @brief Total points stored in route
*/
uint16_t totalPoints;
};
/**
* @brief A class to manage multiple points
*
* The list of point presents a route which can be driven
*/
class Route {
public:
/**
* @brief Construct a new Route object
*/
Route();
/**
* @brief Adds a point to the list
*
* @param point
*/
void addPointToRoute(Point point);
/**
* @brief Select the first point as target
*
* @return Point
*/
Point startRoute();
/**
* @brief Get the next point and set it as target
*
* @return Point is zero if there are no more Points
*/
Point getNextPoint();
/**
* @brief Get the Route Info object
*
* @return RouteInfo
*/
RouteInfo getRouteInfo();
private:
+5 -5
View File
@@ -1,7 +1,7 @@
/**
* @file speedometer.h
* @author Alexander Klein (alex@kleiax.de)
* @brief A complete implementation to measure wheel speeds with an encoder.
* @brief A implementation to measure wheel speeds with an encoder.
* @version 0.1
* @date 2021-12-09
*
@@ -32,7 +32,7 @@
* @brief A class which use a encoder to calc the speed
*
* This class use ESP32 pulse counter hardware peripheral.
* The calclutaed speed is the average of an amount of last measurments.
* The calculated speed is the average of an amount of last measurements.
*
*/
class Speedometer {
@@ -40,7 +40,7 @@ class Speedometer {
Speedometer();
/**
* @brief Initalize the speedometer
* @brief Initialize the speedometer
*
* @param pinA Pin on the Esp from the encoder.
* @param pinB Pin on the Esp from the encoder.
@@ -63,7 +63,7 @@ class Speedometer {
uint16_t loop();
/**
* @brief Noramly called repeatedly by loop() to calcluate new values.
* @brief Normally called repeatedly by loop() to calculate new values.
*
* Add a new Value to the average and update the speed.
*/
@@ -121,4 +121,4 @@ class Speedometer {
uint32_t last_millis_calc = 0;
};
#endif // SPEEDOMETER_H
#endif // SPEEDOMETER_H
+1 -1
View File
@@ -1,7 +1,7 @@
/**
* @file menuAkku.cpp
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @brief Contains a implementation of the class MenuAkku
* @version 0.1
* @date 2022-02-05
*
+31 -9
View File
@@ -1,7 +1,7 @@
/**
* @file menuAkku.h
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @brief Contains a Menu class to show battery pack informations
* @version 0.1
* @date 2022-02-05
*
@@ -16,19 +16,41 @@
#include "menuControl.h"
/**
* @brief This class shows Akku informations
*
* Provide information for main battery pack and
* PS3-Controller battery pack
*
*/
class MenuAkku : public MenuControl {
public:
/**
* @brief Construct a new Menu Akku object
*
*/
MenuAkku();
void down(){}
void up(){}
void right();
void left();
void no();
void yes();
void down() override {}
void up() override {}
void right() override;
void left() override;
void no() override;
void yes() override;
void printMenu();
void update();
/**
* @brief Prints the Information to display and console
*
* The informations are only printed to the display if it
* set.
*/
void printMenu() override;
/**
* @brief Renew the informations and print them
*
*/
void update() override;
private:
const uint16_t delay = 5000;
+1 -1
View File
@@ -1,7 +1,7 @@
/**
* @file menuGPS.cpp
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @brief Contains an implementation of the class MenuGPS
* @version 0.1
* @date 2022-01-29
*
+54 -10
View File
@@ -1,7 +1,7 @@
/**
* @file menuGPS.h
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @brief Contains a class to print informations about the GPS object
* @version 0.1
* @date 2022-01-29
*
@@ -16,19 +16,63 @@
#include "menuControl.h"
/**
* @brief A class to print informations about the GPS object
*
*/
class MenuGPS : public MenuControl {
public:
/**
* @brief Construct a new Menu GPS object
*
* @param gps
*/
MenuGPS(TinyGPSPlus* gps);
void down();
void up();
void right();
void left();
void no();
void yes();
void printMenu();
void update();
/**
* @brief Next page
*/
void down() override;
/**
* @brief Previous page
*/
void up() override;
/**
* @brief Update information
*/
void right() override;
/**
* @brief Go to the parent menu
*/
void left() override;
/**
* @brief Go to the parent menu
*/
void no() override;
/**
* @brief Update information
*/
void yes() override;
/**
* @brief Prints the Information to display and console
*
* Prints the selected page.
* The informations are only printed to the display if it
* set.
*/
void printMenu() override;
/**
* @brief can be called to update shown data
*/
void update() override;
private:
const uint8_t countPages = 7;
@@ -41,4 +85,4 @@ class MenuGPS : public MenuControl {
uint32_t last_millis = 0;
};
#endif // MENU_GPS_H
#endif // MENU_GPS_H
+2 -2
View File
@@ -1,7 +1,7 @@
/**
* @file pidSettings.cpp
* @file menuPidSettings.cpp
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @brief Contains an implementation of the class MenuPidSettings
* @version 0.1
* @date 2022-01-19
*
+50 -11
View File
@@ -1,7 +1,7 @@
/**
* @file pidSettings.h
* @file menuPidSettings.h
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @brief Contains a class to tune the PID settings
* @version 0.1
* @date 2022-01-19
*
@@ -18,19 +18,58 @@
#define NUM_VAL 3
/**
* @brief A class to tune the PID settings
*
*/
class MenuPidSettings : public MenuControl {
public:
/**
* @brief Construct a new Menu Pid Settings object
*
* @param pid
*/
MenuPidSettings(PID* pid);
void down();
void up();
void right();
void left();
void no();
void yes();
/**
* @brief Decrement selected value
*/
void down() override;
void printMenu();
void update(){};
/**
* @brief Increment selected value
*/
void up() override;
/**
* @brief Select next value
*/
void right() override;
/**
* @brief Select previous value
*/
void left() override;
/**
* @brief Leave menu without saving
*/
void no() override;
/**
* @brief Leave menu with saving
*/
void yes() override;
/**
* @brief Prints the Information to display and console
*
* The informations are only printed to the display if it
* set.
*/
void printMenu() override;
void update() override {};
private:
PID* pid;
@@ -39,4 +78,4 @@ class MenuPidSettings : public MenuControl {
};
#endif // PID_SETTINGS_H
#endif // PID_SETTINGS_H
@@ -1,7 +1,7 @@
/**
* @file menuAutopilot.cpp
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @brief Contains an implementation of the class MenuAutopilot
* @version 0.1
* @date 2022-02-03
*
@@ -1,7 +1,7 @@
/**
* @file menuAutopilot.h
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @brief Contains a class to print informations about the Autopilot
* @version 0.1
* @date 2022-02-03
*
@@ -14,10 +14,33 @@
#include "SpecialMenus/driveModi/menuDriveMode.h"
/**
* @brief A class to print informations about the Autopilot
*
*/
class MenuAutopilot : public MenuDriveMode {
public:
/**
* @brief Construct a new Menu Autopilot object
*
* @param driveManager for MenuDriveMode
*/
MenuAutopilot(DriveManager* driveManager) : MenuDriveMode(driveManager) {}
/**
* @brief Prints the Information to display and console
*
* The informations are only printed to the display if it
* set.
*
* Changes the DriveModi to Autopilot if it is the first time called
* and save the Autopilot object.
*/
void printMenu();
/**
* @brief can be called to update shown data
*/
void update();
private:
@@ -1,7 +1,7 @@
/**
* @file menuCaptureRoute.cpp
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @brief Contains an implementation of the class MenuCaptureRoute
* @version 0.1
* @date 2022-01-31
*
@@ -1,7 +1,7 @@
/**
* @file menuCaptureRoute.h
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @brief Contains a class to print informations about CaptureRoute
* @version 0.1
* @date 2022-01-31
*
@@ -13,10 +13,33 @@
#include "SpecialMenus/driveModi/menuDriveMode.h"
/**
* @brief A class to print informations about the Autopilot
*
*/
class MenuCaptureRoute : public MenuDriveMode {
public:
/**
* @brief Construct a new Menu Capture Route object
*
* @param driveManager
*/
MenuCaptureRoute(DriveManager* driveManager) : MenuDriveMode(driveManager) {}
/**
* @brief Prints the Information to display and console
*
* The informations are only printed to the display if it
* set.
*
* Changes the DriveModi to CaptureRoute if it is the first time called
* and save the CaptureRoute object.
*/
void printMenu();
/**
* @brief can be called to update shown data
*/
void update();
private:
@@ -26,4 +49,4 @@ class MenuCaptureRoute : public MenuDriveMode {
RouteInfo routeInfo;
};
#endif // MENU_MANUAL_DRIVE_H
#endif // MENU_MANUAL_DRIVE_H
@@ -1,7 +1,7 @@
/**
* @file menuManualDrive.cpp
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @brief Contains an implementation of the class MenuManualDrive
* @version 0.1
* @date 2022-01-20
*
@@ -1,7 +1,7 @@
/**
* @file menuManualDrive.h
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @brief Contains a class to print information about the class ManualControl
* @version 0.1
* @date 2022-01-20
*
@@ -14,10 +14,28 @@
#include "SpecialMenus/driveModi/menuDriveMode.h"
/**
* @brief A class to print informations about the class ManualControl
*
*/
class MenuManualControl : public MenuDriveMode {
public:
/**
* @brief Construct a new Menu Manual Control object
*
* @param driveManager
*/
MenuManualControl(DriveManager* driveManager) : MenuDriveMode(driveManager) {}
/**
* @brief Prints the Information to display and console
*
* The informations are only printed to the display if it
* set.
*
* Changes the DriveModi to Autopilot if it is the first time called.
*/
void printMenu();
};
#endif // MENU_MANUAL_DRIVE_H
#endif // MENU_MANUAL_DRIVE_H
+2 -2
View File
@@ -1,7 +1,7 @@
/**
* @file menuDriveMode.cpp
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @brief Contains an implementation of the class MenuDriveMode
* @version 0.1
* @date 2022-01-31
*
@@ -24,4 +24,4 @@ void MenuDriveMode::left() {
void MenuDriveMode::no() {
this->left();
}
}
+21 -8
View File
@@ -1,7 +1,7 @@
/**
* @file menuDriveMode.h
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @brief Contains a base class for Menus about DriveModi
* @version 0.1
* @date 2022-01-31
*
@@ -14,18 +14,31 @@
#include "menuControl.h"
#include "driveModi/driveManager.h"
/**
* @brief A base class for Menus about DriveModi
*
*/
class MenuDriveMode : public MenuControl {
public:
/**
* @brief Construct a new Menu Drive Mode object
*
* @param driveManager
*/
MenuDriveMode(DriveManager* driveManager);
void down(){}
void up(){}
void right(){}
void left();
void no();
void yes(){}
void down() override {}
void up() override {}
void right() override {}
void left() override;
void no() override;
void yes() override {}
virtual void printMenu() = 0;
/**
* @brief can be called to update shown data
*/
void update(){}
protected:
@@ -33,4 +46,4 @@ class MenuDriveMode : public MenuControl {
bool firstPrint = true;
};
#endif // MENU_DRIVE_MODI_H
#endif // MENU_DRIVE_MODI_H
+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
+16 -1
View File
@@ -1,3 +1,18 @@
/**
* @file main.cpp
* @author Alexander Klein (alex@kleiax.de)
* @brief The main file.
*
* Sets up Network stuff, PS3-Controller, Menu and Lcd
* Handles Controller Input
*
* @version 0.1
* @date 2022-02-15
*
* @copyright Copyright (c) 2022
*
*/
#include <Arduino.h>
#include <Ps3Controller.h>
#include <iostream>
@@ -42,7 +57,7 @@ void setup() {
Network::connectWifi();
Network::setupMQTT();
Network::checkMQTT();
DebugMqtt::init(Network::getMqtttClient(), Loglevel::debug);
DebugMqtt::init(Network::getMqttClient(), Loglevel::debug);
std::cout << "Activate additional output via MQTT..." << std::endl;
debugMqtt = new DebugMqtt("Console");
+10
View File
@@ -1,3 +1,13 @@
/**
* @file moveControl.cpp
* @author Alexander Klein (alex@kleiax.de)
* @brief Contains an implementation of the class MoveControl
* @version 0.1
* @date 2022-02-15
*
* @copyright Copyright (c) 2022
*
*/
#include "moveControl.h"
MoveControl::MoveControl() {
+2 -2
View File
@@ -1,7 +1,7 @@
/**
* @file network.cpp
* @author Alexander Klein (alex@kleiax.de)
* @brief TODO: write some stuff
* @brief Contains the implementation of the ststic class Network
* @version 0.1
* @date 2021-12-14
*
@@ -86,6 +86,6 @@ void Network::checkMQTT() {
mqtt_client->loop();
}
PubSubClient* Network::getMqtttClient() {
PubSubClient* Network::getMqttClient() {
return mqtt_client;
}