documentation checked and edit
for all files in lib folder
This commit is contained in:
+7
-8
@@ -1,9 +1,8 @@
|
||||
|
||||
// AUTO GENERATED FILE, DO NOT EDIT
|
||||
#ifndef VERSION
|
||||
#define VERSION "0.8.36"
|
||||
#endif
|
||||
#ifndef BUILD_TIMESTAMP
|
||||
#define BUILD_TIMESTAMP "2023-08-13 15:13:34.491991"
|
||||
#endif
|
||||
|
||||
// AUTO GENERATED FILE, DO NOT EDIT
|
||||
#ifndef VERSION
|
||||
#define VERSION "1.8.36"
|
||||
#endif
|
||||
#ifndef BUILD_TIMESTAMP
|
||||
#define BUILD_TIMESTAMP "2023-10-13 15:13:34.491991"
|
||||
#endif
|
||||
|
||||
+147
-143
@@ -4,9 +4,9 @@
|
||||
* @brief Contains the MoveControl class
|
||||
* @version 0.1
|
||||
* @date 2021-12-14
|
||||
*
|
||||
*
|
||||
* @copyright Copyright (c) 2021
|
||||
*
|
||||
*
|
||||
*/
|
||||
#ifndef MOVE_CONTROL_H
|
||||
#define MOVE_CONTROL_H
|
||||
@@ -22,178 +22,182 @@
|
||||
#include "debugTimes.h"
|
||||
#include "component.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief A struct to easy set the speed
|
||||
*
|
||||
*
|
||||
*/
|
||||
struct DrivingSpeeds {
|
||||
struct DrivingSpeeds
|
||||
{
|
||||
double x;
|
||||
double rot;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class manages the motors and the encoders
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
*/
|
||||
class MoveControl : public Component {
|
||||
public:
|
||||
/**
|
||||
* @brief used to set driving status
|
||||
*
|
||||
* When set to stop all motors are set to halt
|
||||
* When set to Raw the PIDs are not used. The target
|
||||
* values must be given withe @see setRawPowerLeft and
|
||||
* @see setRawPowerRight.
|
||||
*
|
||||
* Drive is the normal working mode.
|
||||
*
|
||||
*/
|
||||
enum Status {Stop,
|
||||
Drive,
|
||||
Raw};
|
||||
class MoveControl : public Component
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Used to set driving status
|
||||
*
|
||||
* When set to stop all motors are set to halt
|
||||
*
|
||||
* When set to Raw the PIDs are not used. The target
|
||||
* values must be given withe setRawPowerLeft() and
|
||||
* setRawPowerRight().
|
||||
*
|
||||
* Drive is the normal working mode.
|
||||
*
|
||||
*/
|
||||
enum Status
|
||||
{
|
||||
Stop,
|
||||
Drive,
|
||||
Raw
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Construct a new Move Control object
|
||||
*
|
||||
* Initialize the motors, encoders and PIDs with given
|
||||
* values in config.h
|
||||
*/
|
||||
MoveControl();
|
||||
|
||||
/**
|
||||
* @brief Construct a new Move Control object
|
||||
*
|
||||
* Initialize the motors, encoders and PIDs with given
|
||||
* values in config.h
|
||||
*/
|
||||
MoveControl();
|
||||
/**
|
||||
* @brief Destroy the Move Control object
|
||||
*
|
||||
* Stops the motors with emergencyStop()
|
||||
*/
|
||||
~MoveControl();
|
||||
|
||||
/**
|
||||
* @brief Destroy the Move Control object
|
||||
*
|
||||
* Stops the motors with emergencyStop()
|
||||
*/
|
||||
~MoveControl();
|
||||
/**
|
||||
* @brief Set the Status
|
||||
*
|
||||
* Control if this component should work normally or with
|
||||
* raw values for the motors.
|
||||
*
|
||||
* @see Status
|
||||
* @param status
|
||||
*/
|
||||
void setDrivingStatus(Status status);
|
||||
|
||||
/**
|
||||
* @brief Set the Status
|
||||
*
|
||||
* Control if this component should work normally or with
|
||||
* raw values for the motors.
|
||||
*
|
||||
* @see Status
|
||||
* @param status
|
||||
*/
|
||||
void setDrivingStatus(Status status);
|
||||
/**
|
||||
* @brief Stops the engine immediately
|
||||
*
|
||||
*/
|
||||
void emergencyStop();
|
||||
|
||||
/**
|
||||
* @brief Stops the engine immediately
|
||||
*
|
||||
*/
|
||||
void emergencyStop();
|
||||
/**
|
||||
* @brief Set the target speed
|
||||
*
|
||||
* If the given speed is close to zero, then the
|
||||
* target speed is set to zero.
|
||||
* @param speed in m/s
|
||||
*/
|
||||
void setSpeed(double speed);
|
||||
|
||||
/**
|
||||
* @brief Set the target speed
|
||||
*
|
||||
* If the given speed is close to zero, then the
|
||||
* target speed is set to zero.
|
||||
* @param speed in m/s
|
||||
*/
|
||||
void setSpeed(double speed);
|
||||
/**
|
||||
* @brief Set the rotationSpeed
|
||||
*
|
||||
* If the given rotationSpeed is close to zero, then the
|
||||
* target rotationSpeed is set to zero.
|
||||
* @param speed rad/s
|
||||
*/
|
||||
void setRotationSpeed(double speed);
|
||||
|
||||
/**
|
||||
* @brief Set the rotationSpeed
|
||||
*
|
||||
* If the given rotationSpeed is close to zero, then the
|
||||
* target rotationSpeed is set to zero.
|
||||
* @param speed rad/s
|
||||
*/
|
||||
void setRotationSpeed(double speed);
|
||||
/**
|
||||
* @brief Set the speeds
|
||||
*
|
||||
* This function is a combination of the functions setSpeed() and
|
||||
* setRotationSpeed(). The struct DrivingSpeeds
|
||||
* is used for this.
|
||||
*
|
||||
*
|
||||
* @param drivingSpeeds
|
||||
*/
|
||||
void setSpeeds(DrivingSpeeds drivingSpeeds);
|
||||
|
||||
/**
|
||||
* @brief Set the speeds
|
||||
*
|
||||
* This function is a combination of @see setSpeed and
|
||||
* @see setRotationSpeed. The struct @see DrivingSpeeds
|
||||
* is used for this.
|
||||
*
|
||||
* @param drivingSpeeds
|
||||
*/
|
||||
void setSpeeds(DrivingSpeeds drivingSpeeds);
|
||||
/**
|
||||
* @brief Set raw power left
|
||||
*
|
||||
* This value has only an effect if the status is raw.
|
||||
* @see setDrivingStatus
|
||||
*
|
||||
* @param power between -100 and 100
|
||||
*/
|
||||
void setRawPowerLeft(int16_t power);
|
||||
|
||||
/**
|
||||
* @brief Set raw power left
|
||||
*
|
||||
* This value has only an effect if the status is raw.
|
||||
* @see setDrivingStatus
|
||||
*
|
||||
* @param power between -100 and 100
|
||||
*/
|
||||
void setRawPowerLeft(int16_t power);
|
||||
/**
|
||||
* @brief Set the raw power right
|
||||
*
|
||||
* This value has only an effect if status is raw.
|
||||
*
|
||||
* @param power between -100 and 100
|
||||
*/
|
||||
void setRawPowerRight(int16_t power);
|
||||
|
||||
/**
|
||||
* @brief Set the raw power right
|
||||
*
|
||||
* This value has only an effect if status is raw.
|
||||
*
|
||||
* @param power between -100 and 100
|
||||
*/
|
||||
void setRawPowerRight(int16_t power);
|
||||
/**
|
||||
* @brief Set the pid tunings
|
||||
*
|
||||
* @param side 0 -> left, 1 -> right
|
||||
* @param pPart
|
||||
* @param iPart
|
||||
* @param dPart
|
||||
*/
|
||||
void setPidTunings(uint8_t side, double pPart, double iPart, double dPart);
|
||||
|
||||
/**
|
||||
* @brief Set the pid tunings
|
||||
*
|
||||
* @param side 0 -> left, 1 -> right
|
||||
* @param pPart
|
||||
* @param iPart
|
||||
* @param dPart
|
||||
*/
|
||||
void setPidTunings(uint8_t side, double pPart, double iPart, double dPart);
|
||||
/**
|
||||
* @brief Returns the PID object of the choosen side.
|
||||
*
|
||||
* @param side 0 -> left, 1 -> right
|
||||
* @return PID*
|
||||
*/
|
||||
PID *getPID(uint8_t side) const;
|
||||
|
||||
/**
|
||||
* @brief Returns the PID object of the choosen side.
|
||||
*
|
||||
* @param side 0 -> left, 1 -> right
|
||||
* @return PID*
|
||||
*/
|
||||
PID* getPID(uint8_t side) const;
|
||||
Speedometer *getSpeedometerLeft() const { return this->leftSpeedometer; }
|
||||
Speedometer *getSpeedometerRight() const { return this->rightSpeedometer; }
|
||||
|
||||
Speedometer* getSpeedometerLeft() const { return this->leftSpeedometer; }
|
||||
Speedometer* getSpeedometerRight() const { return this->rightSpeedometer; }
|
||||
uint16_t getDutycycleLeft() const { return this->leftMotor->getDutycycle(); }
|
||||
uint16_t getDutycycleRight() const { return this->rightMotor->getDutycycle(); }
|
||||
|
||||
uint16_t getDutycycleLeft() const { return this->leftMotor->getDutycycle(); }
|
||||
uint16_t getDutycycleRight() const { return this->rightMotor->getDutycycle(); }
|
||||
private:
|
||||
void run() override;
|
||||
static void setSpeedometerDirection(Speedometer *speedometer, double value);
|
||||
void calcTargetWheelSpeed();
|
||||
void regulateMotors();
|
||||
void updateCurrentWheelSpeed();
|
||||
|
||||
private:
|
||||
void run() override;
|
||||
static void setSpeedometerDirection(Speedometer *speedometer, double value);
|
||||
void calcTargetWheelSpeed();
|
||||
void regulateMotors();
|
||||
void updateCurrentWheelSpeed();
|
||||
MotorControl *leftMotor;
|
||||
MotorControl *rightMotor;
|
||||
Speedometer *leftSpeedometer;
|
||||
Speedometer *rightSpeedometer;
|
||||
PID *leftPid;
|
||||
PID *rightPid;
|
||||
|
||||
MotorControl *leftMotor;
|
||||
MotorControl *rightMotor;
|
||||
Speedometer *leftSpeedometer;
|
||||
Speedometer *rightSpeedometer;
|
||||
PID *leftPid;
|
||||
PID *rightPid;
|
||||
Status driving_status = Status::Stop;
|
||||
DrivingSpeeds drivingSpeeds = {0, 0};
|
||||
|
||||
Status driving_status = Status::Stop;
|
||||
DrivingSpeeds drivingSpeeds = {0, 0};
|
||||
double wheelspeedLeftTarget = 0;
|
||||
double wheelspeedRightTarget = 0;
|
||||
double wheelspeedLeft = 0;
|
||||
double wheelspeedRight = 0;
|
||||
double leftPidOut = 0;
|
||||
double rightPidOut = 0;
|
||||
|
||||
double wheelspeedLeftTarget = 0;
|
||||
double wheelspeedRightTarget = 0;
|
||||
double wheelspeedLeft = 0;
|
||||
double wheelspeedRight = 0;
|
||||
double leftPidOut = 0;
|
||||
double rightPidOut = 0;
|
||||
|
||||
uint8_t overTimeCounter = 0;
|
||||
uint8_t overTimeMax = 100;
|
||||
int8_t rawPowerLeft = 0;
|
||||
int8_t rawPowerRight = 0;
|
||||
|
||||
static constexpr int8_t maxPercentage = 100;
|
||||
static constexpr float minSpeed = 0.2;
|
||||
static constexpr uint8_t loopDelay = 20;
|
||||
uint8_t overTimeCounter = 0;
|
||||
uint8_t overTimeMax = 100;
|
||||
int8_t rawPowerLeft = 0;
|
||||
int8_t rawPowerRight = 0;
|
||||
|
||||
static constexpr int8_t maxPercentage = 100;
|
||||
static constexpr float minSpeed = 0.2;
|
||||
static constexpr uint8_t loopDelay = 20;
|
||||
};
|
||||
#endif // MOVE_CONTROL_H
|
||||
|
||||
+18
-13
@@ -2,14 +2,14 @@
|
||||
* @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
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
@@ -17,7 +17,8 @@
|
||||
#define HW1
|
||||
|
||||
#ifdef HOTSPOT
|
||||
namespace NetworkConfig {
|
||||
namespace NetworkConfig
|
||||
{
|
||||
const char ssid[] = "Kleiax Handy";
|
||||
const char password[] = "12345677";
|
||||
const char ip[] = "192.168.43.4";
|
||||
@@ -26,10 +27,11 @@ namespace NetworkConfig {
|
||||
const char dns[] = "8.8.8.8";
|
||||
const bool mqtt = false;
|
||||
}
|
||||
#endif //HOTSPOT
|
||||
#endif // HOTSPOT
|
||||
|
||||
#ifdef HW1
|
||||
namespace NetworkConfig {
|
||||
namespace NetworkConfig
|
||||
{
|
||||
const char ssid[] = "hw1_gast";
|
||||
const char password[] = "KeineAhnung";
|
||||
const char ip[] = "192.168.0.4";
|
||||
@@ -38,11 +40,12 @@ namespace NetworkConfig {
|
||||
const char dns[] = "8.8.8.8";
|
||||
const bool mqtt = false;
|
||||
}
|
||||
#endif //HW1
|
||||
#endif // HW1
|
||||
|
||||
//Network config Rhede
|
||||
// Network config Rhede
|
||||
#ifdef RHEDE
|
||||
namespace NetworkConfig {
|
||||
namespace NetworkConfig
|
||||
{
|
||||
const char ssid[] = "LebennigHuus";
|
||||
const char password[] = "Punica-699";
|
||||
const char ip[] = "192.168.11.4";
|
||||
@@ -51,16 +54,18 @@ namespace NetworkConfig {
|
||||
const char dns[] = "8.8.8.8";
|
||||
const bool mqtt = true;
|
||||
}
|
||||
#endif //RHEDE
|
||||
#endif // RHEDE
|
||||
|
||||
namespace MqttConfig {
|
||||
namespace MqttConfig
|
||||
{
|
||||
const char server[] = "192.168.1.7";
|
||||
const uint16_t port = 1883;
|
||||
const char user[] = "kleiax";
|
||||
const char password[] = "p?{$_~5%hBM7wrcFkr55KWr#";
|
||||
}
|
||||
|
||||
namespace NtripConfig {
|
||||
namespace NtripConfig
|
||||
{
|
||||
const char host[] = "rtk2go.com";
|
||||
const uint16_t port = 2101;
|
||||
// const char mountPoint[] = "GER-Dortmund";
|
||||
|
||||
Reference in New Issue
Block a user