Merge branch 'main' into projektarbeit
This commit is contained in:
@@ -1,23 +1,25 @@
|
||||
/**
|
||||
* @file calibrateCompassM.cpp
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief
|
||||
* @brief
|
||||
* @version 0.1
|
||||
* @date 2023-09-03
|
||||
*
|
||||
*
|
||||
* @copyright Copyright (c) 2023
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include "calibrateCompassM.h"
|
||||
|
||||
CalibrateCompassM::CalibrateCompassM(DriveModiParams params) : ManualControl(params) {}
|
||||
|
||||
void CalibrateCompassM::setCalibrateCompass(CalibrateCompass *caliCompass) {
|
||||
if (caliCompass) {
|
||||
void CalibrateCompassM::setCalibrateCompass(CalibrateCompass *caliCompass)
|
||||
{
|
||||
if (static_cast<bool>(caliCompass))
|
||||
{
|
||||
this->caliCompass = caliCompass;
|
||||
this->addChildComponent(this->caliCompass);
|
||||
} else if (this->caliCompass) {
|
||||
}
|
||||
else if (static_cast<bool>(this->caliCompass))
|
||||
{
|
||||
this->removeChildComponent(this->caliCompass);
|
||||
this->caliCompass = caliCompass;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/**
|
||||
* @file calibrateCompassM.h
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief
|
||||
* @brief Contains a Menu class to calibrate the compass
|
||||
* @version 0.1
|
||||
* @date 2023-09-03
|
||||
*
|
||||
*
|
||||
* @copyright Copyright (c) 2023
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CALIBRATE_COMPASS_M_H
|
||||
@@ -16,14 +16,21 @@
|
||||
|
||||
#include "driveModi/Modi/ManualControl/manualControl.h"
|
||||
|
||||
class CalibrateCompassM : public ManualControl {
|
||||
public:
|
||||
CalibrateCompassM(DriveModiParams params);
|
||||
/**
|
||||
* @brief A Menu class to interact with CalibrateCompass class
|
||||
*/
|
||||
class CalibrateCompassM : public ManualControl
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Set the CalibrateCompass object
|
||||
*
|
||||
* @param caliCompass
|
||||
*/
|
||||
void setCalibrateCompass(CalibrateCompass *caliCompass = nullptr);
|
||||
|
||||
void setCalibrateCompass(CalibrateCompass* caliCompass = nullptr);
|
||||
|
||||
private:
|
||||
CalibrateCompass* caliCompass = nullptr;
|
||||
private:
|
||||
CalibrateCompass *caliCompass = nullptr;
|
||||
};
|
||||
|
||||
#endif //CALIBRATE_COMPASS_M_H
|
||||
#endif // CALIBRATE_COMPASS_M_H
|
||||
|
||||
@@ -4,73 +4,89 @@
|
||||
* @brief Implementation of the class manualControl.h
|
||||
* @version 0.1
|
||||
* @date 2021-12-13
|
||||
*
|
||||
*
|
||||
* @copyright Copyright (c) 2021
|
||||
*
|
||||
*
|
||||
*/
|
||||
#include "manualControl.h"
|
||||
|
||||
void ManualControl::run() {
|
||||
switch (this->inputMode) {
|
||||
case InputMode::Analog :
|
||||
this->analogControl();
|
||||
break;
|
||||
void ManualControl::run()
|
||||
{
|
||||
switch (this->inputMode)
|
||||
{
|
||||
case InputMode::Analog:
|
||||
this->analogControl();
|
||||
break;
|
||||
|
||||
case InputMode::Digital :
|
||||
this->digitalControl();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
case InputMode::Digital:
|
||||
this->digitalControl();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ManualControl::switchInputMode() {
|
||||
void ManualControl::switchInputMode()
|
||||
{
|
||||
this->inputMode = (this->inputMode == InputMode::Analog) ? InputMode::Digital : InputMode::Analog;
|
||||
}
|
||||
|
||||
void ManualControl::analogControl() {
|
||||
void ManualControl::analogControl()
|
||||
{
|
||||
// Have to be int16_t to avoid overflow (int8_t = 255 - 127 = -128)
|
||||
int16_t x = this->input->x - 127;
|
||||
int16_t y = this-> input->y - 127;
|
||||
const int16_t xAxis = this->input->x - 127;
|
||||
const int16_t yAxis = this->input->y - 127;
|
||||
|
||||
// static int counter = 0;
|
||||
// if (counter % 60 == 0) {
|
||||
// std::cout << "Input: x: " << (int) this->input->x << " y: " << (int) this->input->y << std::endl;
|
||||
// std::cout << "Output: x: " << (int) x << " y: " << (int) y << std::endl;
|
||||
// }
|
||||
// counter++;
|
||||
double value_per_step = this->maxSpeeds.x * 2 / UINT8_MAX;
|
||||
this->moveControl->setSpeed(-xAxis * value_per_step);
|
||||
|
||||
double value_per_step = this->maxForwardSpeed * 2 / UINT8_MAX;
|
||||
this->moveControl->setSpeed(-x * value_per_step);
|
||||
|
||||
value_per_step = this->maxRotationSpeed * 2 / UINT8_MAX;
|
||||
this->moveControl->setRotationSpeed(y * value_per_step);
|
||||
value_per_step = this->maxSpeeds.rot * 2 / UINT8_MAX;
|
||||
this->moveControl->setRotationSpeed(yAxis * value_per_step);
|
||||
}
|
||||
|
||||
void ManualControl::digitalControl() {
|
||||
int16_t y = this->input->x - 127;
|
||||
int16_t x = this->input->y - 127;
|
||||
void ManualControl::digitalControl()
|
||||
{
|
||||
static constexpr uint8_t deadzone = 120;
|
||||
const int16_t yAxis = this->input->x - 127;
|
||||
const int16_t xAxis = this->input->y - 127;
|
||||
|
||||
if (y > 120)
|
||||
this->moveControl->setSpeed(-this->maxForwardSpeed);
|
||||
else if (y < -120)
|
||||
this->moveControl->setSpeed(this->maxForwardSpeed);
|
||||
if (yAxis > deadzone)
|
||||
{
|
||||
this->moveControl->setSpeed(-this->maxSpeeds.x);
|
||||
}
|
||||
else if (yAxis < -deadzone)
|
||||
{
|
||||
this->moveControl->setSpeed(this->maxSpeeds.rot);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->moveControl->setSpeed(0);
|
||||
}
|
||||
|
||||
if (x > 120)
|
||||
this->moveControl->setRotationSpeed(this->maxRotationSpeed);
|
||||
else if (x < -120)
|
||||
this->moveControl->setRotationSpeed(-this->maxRotationSpeed);
|
||||
if (xAxis > deadzone)
|
||||
{
|
||||
this->moveControl->setRotationSpeed(this->maxSpeeds.rot);
|
||||
}
|
||||
else if (xAxis < -deadzone)
|
||||
{
|
||||
this->moveControl->setRotationSpeed(-this->maxSpeeds.rot);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->moveControl->setRotationSpeed(0);
|
||||
}
|
||||
|
||||
if (this->directionChangeWrapper && (x > 120 || x < -120))
|
||||
if (static_cast<bool>(this->directionChangeWrapper) && (xAxis > deadzone || xAxis < -deadzone))
|
||||
{
|
||||
this->lastLoopTurned = true;
|
||||
else if (this->lastLoopTurned) {
|
||||
if (this->directionChangeWrapper)
|
||||
}
|
||||
else if (this->lastLoopTurned)
|
||||
{
|
||||
if (static_cast<bool>(this->directionChangeWrapper))
|
||||
{
|
||||
this->directionChangeWrapper->action();
|
||||
}
|
||||
this->lastLoopTurned = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,55 +4,70 @@
|
||||
* @brief A small class to drive the Rover by the controller joystick.
|
||||
* @version 0.1
|
||||
* @date 2021-12-13
|
||||
*
|
||||
*
|
||||
* @copyright Copyright (c) 2021
|
||||
*
|
||||
*
|
||||
*/
|
||||
#ifndef MANUAL_CONTROL_H
|
||||
#define MANUAL_CONTROL_H
|
||||
|
||||
#include "driveModi/driveModi.h"
|
||||
|
||||
class DirectionChangeWrapper {
|
||||
public:
|
||||
virtual void action() = 0;
|
||||
class DirectionChangeWrapper
|
||||
{
|
||||
public:
|
||||
virtual void action() = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Drive the Rover with a Joystick
|
||||
*
|
||||
* This class gets the x and y value from the PS3 controller
|
||||
*
|
||||
* This class gets the x and y value from the ControlPad
|
||||
* and map the values to moveControl
|
||||
*
|
||||
*
|
||||
* @see MoveControl
|
||||
*/
|
||||
class ManualControl : public DriveModi {
|
||||
public:
|
||||
enum class InputMode : uint8_t {
|
||||
Analog,
|
||||
Digital
|
||||
};
|
||||
class ManualControl : public DriveModi
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief The enum is used to change the interpretation of the joystick data
|
||||
*/
|
||||
enum class InputMode : uint8_t
|
||||
{
|
||||
Analog,
|
||||
Digital
|
||||
};
|
||||
|
||||
ManualControl(DriveModiParams params) : DriveModi(params){};
|
||||
/**
|
||||
* @brief Change the InputMode to the opposite
|
||||
*/
|
||||
void switchInputMode();
|
||||
void setInputMode(InputMode mode) { this->inputMode = mode; }
|
||||
InputMode getInputMode() const { return this->inputMode; }
|
||||
|
||||
void switchInputMode();
|
||||
void setInputMode(InputMode mode) { this->inputMode = mode; }
|
||||
InputMode getInputMode() const { return this->inputMode; }
|
||||
void setDirectionChangeCallback(DirectionChangeWrapper* callback) { this->directionChangeWrapper = callback; }
|
||||
/**
|
||||
* @brief Set the DirectionChangeWrapper object
|
||||
*
|
||||
* This callback is used to inform the CalcAzimuth Component about a direction change
|
||||
*
|
||||
* @param callback
|
||||
*/
|
||||
void setDirectionChangeCallback(DirectionChangeWrapper *callback) { this->directionChangeWrapper = callback; }
|
||||
|
||||
uint16_t getDutycycleLeft() const { return this->moveControl->getDutycycleLeft(); }
|
||||
uint16_t getDutycycleRight() const { return this->moveControl->getDutycycleRight(); }
|
||||
uint16_t getDutycycleLeft() const { return this->moveControl->getDutycycleLeft(); }
|
||||
uint16_t getDutycycleRight() const { return this->moveControl->getDutycycleRight(); }
|
||||
|
||||
protected:
|
||||
void run() override;
|
||||
protected:
|
||||
void run() override;
|
||||
|
||||
private:
|
||||
void analogControl();
|
||||
void digitalControl();
|
||||
private:
|
||||
void analogControl();
|
||||
void digitalControl();
|
||||
|
||||
bool lastLoopTurned = false;
|
||||
DirectionChangeWrapper* directionChangeWrapper = nullptr;
|
||||
InputMode inputMode = InputMode::Analog;
|
||||
bool lastLoopTurned = false;
|
||||
DirectionChangeWrapper *directionChangeWrapper = nullptr;
|
||||
InputMode inputMode = InputMode::Analog;
|
||||
};
|
||||
|
||||
#endif // MANUAL_CONTROL_H
|
||||
|
||||
@@ -4,27 +4,25 @@
|
||||
* @brief Contains the implementation of the class TestMode.
|
||||
* @version 0.1
|
||||
* @date 2022-09-08
|
||||
*
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*
|
||||
*/
|
||||
#include "testMode.h"
|
||||
|
||||
TestMode::TestMode(DriveModiParams params)
|
||||
: DriveModi(params) {}
|
||||
|
||||
TestMode::~TestMode() {
|
||||
this->moveControl->setDrivingStatus(MoveControl::Status::Stop);
|
||||
}
|
||||
|
||||
void TestMode::run() {
|
||||
if (this->maneuver == Maneuver::Turn) {
|
||||
void TestMode::run()
|
||||
{
|
||||
if (this->maneuver == Maneuver::Turn)
|
||||
{
|
||||
uint16_t delta = abs(this->azimuth - this->getSensorData()->getRealAzimuth());
|
||||
if (delta > this->degree)
|
||||
{
|
||||
this->abort = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (millis() - this->actionStart > this->maneuverTime || this->abort) {
|
||||
if (this->busy && millis() - this->actionStart > this->maneuverTime || this->abort)
|
||||
{
|
||||
this->busy = false;
|
||||
this->abort = false;
|
||||
this->moveControl->setDrivingStatus(MoveControl::Status::Stop);
|
||||
@@ -32,71 +30,95 @@ void TestMode::run() {
|
||||
}
|
||||
}
|
||||
|
||||
bool TestMode::drive(int16_t cm, int16_t degree) {
|
||||
bool TestMode::drive(int16_t cmDistance, int16_t degree)
|
||||
{
|
||||
if (this->busy)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
this->actionStart = millis();
|
||||
this->moveControl->setDrivingStatus(MoveControl::Status::Drive);
|
||||
|
||||
if (cm == 0) {
|
||||
//Only left or right
|
||||
if (cmDistance == 0)
|
||||
{
|
||||
// Only left or right
|
||||
this->moveControl->setSpeed(0);
|
||||
|
||||
if (degree < 0)
|
||||
this->moveControl->setRotationSpeed(-this->maxRotationSpeed);
|
||||
{
|
||||
this->moveControl->setRotationSpeed(-this->maxSpeeds.rot);
|
||||
}
|
||||
else if (degree > 0)
|
||||
this->moveControl->setRotationSpeed(this->maxRotationSpeed);
|
||||
|
||||
{
|
||||
this->moveControl->setRotationSpeed(this->maxSpeeds.rot);
|
||||
}
|
||||
|
||||
this->azimuth = this->getSensorData()->getRealAzimuth();
|
||||
this->degree = degree;
|
||||
|
||||
this->maneuverTime = 5 * 1000;
|
||||
this->busy = true;
|
||||
return true;
|
||||
|
||||
} else if (degree == 0) {
|
||||
//Only forward or backward
|
||||
}
|
||||
if (degree == 0)
|
||||
{
|
||||
// Only forward or backward
|
||||
this->moveControl->setRotationSpeed(0);
|
||||
|
||||
if (cm < 0)
|
||||
this->moveControl->setSpeed(-this->maxForwardSpeed);
|
||||
else if (cm > 0)
|
||||
this->moveControl->setSpeed(this->maxForwardSpeed);
|
||||
|
||||
this->maneuverTime = (uint32_t) (((double) abs(cm) / 100.0) / this->maxForwardSpeed) * 1000;
|
||||
if (cmDistance < 0)
|
||||
{
|
||||
this->moveControl->setSpeed(-this->maxSpeeds.x);
|
||||
}
|
||||
else if (cmDistance > 0)
|
||||
{
|
||||
this->moveControl->setSpeed(this->maxSpeeds.x);
|
||||
}
|
||||
|
||||
this->maneuverTime = static_cast<uint32_t>(((abs(cmDistance) / 100.0) / this->maxSpeeds.x) * 1000);
|
||||
this->busy = true;
|
||||
this->maneuver = Maneuver::Drive;
|
||||
return true;
|
||||
} else {
|
||||
//forward or backward and left or right
|
||||
// TODO: Calculate roationspeed
|
||||
if (cm < 0)
|
||||
this->moveControl->setSpeed(-this->maxForwardSpeed);
|
||||
else if (cm > 0)
|
||||
this->moveControl->setSpeed(this->maxForwardSpeed);
|
||||
|
||||
this->maneuverTime = (uint32_t) (((double) cm / 100.0) / this->maxForwardSpeed) * 1000;
|
||||
}
|
||||
else
|
||||
{
|
||||
// forward or backward and left or right
|
||||
// TODO: Calculate roationspeed
|
||||
if (cmDistance < 0)
|
||||
{
|
||||
this->moveControl->setSpeed(-this->maxSpeeds.x);
|
||||
}
|
||||
else if (cmDistance > 0)
|
||||
{
|
||||
this->moveControl->setSpeed(this->maxSpeeds.x);
|
||||
}
|
||||
|
||||
this->maneuverTime = static_cast<uint32_t>(((cmDistance / 100.0) / this->maxSpeeds.x) * 1000);
|
||||
this->busy = true;
|
||||
this->maneuver = Maneuver::Drive;
|
||||
return true;
|
||||
}
|
||||
|
||||
this->moveControl->setDrivingStatus(MoveControl::Status::Stop);
|
||||
this->moveControl->setDrivingStatus(MoveControl::Status::Stop);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TestMode::leftEngine(int16_t powerPercentage, int16_t seconds) {
|
||||
if (this->engineInit(powerPercentage, seconds)) {
|
||||
bool TestMode::leftEngine(int16_t powerPercentage, int16_t seconds)
|
||||
{
|
||||
if (this->engineInit(powerPercentage, seconds))
|
||||
{
|
||||
this->moveControl->setRawPowerLeft(powerPercentage);
|
||||
this->maneuver = Maneuver::LeftEngine;
|
||||
std::cout << "TestMode::leftEngine" << std::endl;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TestMode::rightEngine(int16_t powerPercentage, int16_t seconds) {
|
||||
if (this->engineInit(powerPercentage, seconds)) {
|
||||
bool TestMode::rightEngine(int16_t powerPercentage, int16_t seconds)
|
||||
{
|
||||
if (this->engineInit(powerPercentage, seconds))
|
||||
{
|
||||
this->moveControl->setRawPowerRight(powerPercentage);
|
||||
this->maneuver = Maneuver::RightEngine;
|
||||
return true;
|
||||
@@ -104,8 +126,10 @@ bool TestMode::rightEngine(int16_t powerPercentage, int16_t seconds) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TestMode::bothEngine(int16_t powerPercentage, int16_t seconds) {
|
||||
if (this->engineInit(powerPercentage, seconds)) {
|
||||
bool TestMode::bothEngine(int16_t powerPercentage, int16_t seconds)
|
||||
{
|
||||
if (this->engineInit(powerPercentage, seconds))
|
||||
{
|
||||
this->moveControl->setRawPowerLeft(powerPercentage);
|
||||
this->moveControl->setRawPowerRight(powerPercentage);
|
||||
this->maneuver = Maneuver::BothEngine;
|
||||
@@ -114,23 +138,34 @@ bool TestMode::bothEngine(int16_t powerPercentage, int16_t seconds) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void TestMode::abortManeuver() {
|
||||
void TestMode::abortManeuver()
|
||||
{
|
||||
this->abort = true;
|
||||
}
|
||||
|
||||
uint8_t TestMode::getRemainingManeuverTime() const {
|
||||
if (busy)
|
||||
return (uint8_t) ((this->maneuverTime - (millis() - this->actionStart)) / 1000);
|
||||
uint8_t TestMode::getRemainingManeuverTime() const
|
||||
{
|
||||
if (this->busy)
|
||||
{
|
||||
return static_cast<uint8_t>((this->maneuverTime - (millis() - this->actionStart)) / 1000);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool TestMode::engineInit(int16_t powerPercentage, int16_t seconds) {
|
||||
bool TestMode::engineInit(int16_t powerPercentage, int16_t seconds)
|
||||
{
|
||||
if (this->busy)
|
||||
{
|
||||
return false;
|
||||
if (powerPercentage >= 100 || powerPercentage <= -100)
|
||||
}
|
||||
if (powerPercentage > TestMode::maxPercentage || powerPercentage < -TestMode::maxPercentage)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (seconds < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
this->actionStart = millis();
|
||||
this->moveControl->setDrivingStatus(MoveControl::Status::Raw);
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
* @brief Contains a class to test different functions from the rover.
|
||||
* @version 0.1
|
||||
* @date 2022-09-08
|
||||
*
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*
|
||||
*/
|
||||
#ifndef TEST_MODE_H
|
||||
#ifndef TEST_MODE_H
|
||||
#define TEST_MODE_H
|
||||
|
||||
#include <iostream>
|
||||
@@ -16,105 +16,108 @@
|
||||
#include "moveControl.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,
|
||||
RightEngine,
|
||||
BothEngine,
|
||||
Turn,
|
||||
Drive
|
||||
};
|
||||
class TestMode : public DriveModi
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Different states to test the engine
|
||||
*/
|
||||
enum Maneuver
|
||||
{
|
||||
None,
|
||||
LeftEngine,
|
||||
RightEngine,
|
||||
BothEngine,
|
||||
Turn,
|
||||
Drive
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Construct a new Test Mode object
|
||||
*
|
||||
* @param moveControl
|
||||
*/
|
||||
TestMode(DriveModiParams params);
|
||||
~TestMode();
|
||||
/**
|
||||
* @brief Let the rover drive
|
||||
*
|
||||
* @param cmDistance to drive
|
||||
* @param degree degree to rotate over the hole distance
|
||||
* @return true
|
||||
* @return false
|
||||
*/
|
||||
bool drive(int16_t cmDistance = 0, int16_t degree = 0);
|
||||
|
||||
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 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 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 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();
|
||||
|
||||
/**
|
||||
* @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() const;
|
||||
|
||||
uint8_t getRemainingManeuverTime() const;
|
||||
/**
|
||||
* @brief Returns true if a maneuver is running
|
||||
*
|
||||
* @return true
|
||||
* @return false
|
||||
*/
|
||||
bool getBusy() const { return this->busy; }
|
||||
|
||||
/**
|
||||
* @brief Returns true if a maneuver is running
|
||||
*
|
||||
* @return true
|
||||
* @return false
|
||||
*/
|
||||
bool getBusy() const { return this->busy; }
|
||||
Maneuver getManeuver() const { return this->maneuver; }
|
||||
Speedometer* getSpeedometerLeft() const { return this->moveControl->getSpeedometerLeft(); }
|
||||
Speedometer* getSpeedometerRight() const { return this->moveControl->getSpeedometerRight(); }
|
||||
Maneuver getManeuver() const { return this->maneuver; }
|
||||
Speedometer *getSpeedometerLeft() const { return this->moveControl->getSpeedometerLeft(); }
|
||||
Speedometer *getSpeedometerRight() const { return this->moveControl->getSpeedometerRight(); }
|
||||
|
||||
private:
|
||||
void run() override;
|
||||
bool engineInit(int16_t powerPercentage, int16_t seconds);
|
||||
private:
|
||||
void run() override;
|
||||
bool engineInit(int16_t powerPercentage, int16_t seconds);
|
||||
|
||||
Maneuver maneuver = Maneuver::None;
|
||||
int16_t maneuverValueOne = 0;
|
||||
int16_t maneuverValueTwo = 0;
|
||||
Maneuver maneuver = Maneuver::None;
|
||||
int16_t maneuverValueOne = 0;
|
||||
int16_t maneuverValueTwo = 0;
|
||||
|
||||
bool busy = false;
|
||||
bool abort = false;
|
||||
|
||||
uint16_t azimuth;
|
||||
int16_t degree;
|
||||
uint32_t maneuverTime = 0;
|
||||
uint32_t actionStart = 0;
|
||||
bool busy = false;
|
||||
bool abort = false;
|
||||
|
||||
uint16_t azimuth;
|
||||
int16_t degree;
|
||||
uint32_t maneuverTime = 0;
|
||||
uint32_t actionStart = 0;
|
||||
|
||||
static constexpr int8_t maxPercentage = 100;
|
||||
};
|
||||
|
||||
#endif // TEST_MODE_H
|
||||
|
||||
Reference in New Issue
Block a user