Files
Bachelorarbeit-Rover/src/driveModi/driveModi.h
T

73 lines
2.1 KiB
C++

/**
* @file driveModi.h
* @author Alexander Klein (alex@kleiax.de)
* @brief Contains a virtual class for all Modi
* @version 0.1
* @date 2021-12-14
*
* @copyright Copyright (c) 2021
*
*/
#ifndef DRIVEMODI_H
#define DRIVEMODI_H
#include "component.h"
#include "moveControl.h"
#include "controlPadInput.h"
#include "sensorData.h"
struct DriveModiParams {
MoveControl* moveControl;
const ControlPadInput* input;
const SensorData* sensorData;
};
/**
* @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 Component {
public:
DriveModi();
virtual ~DriveModi();
const SensorData* getSensorData() const { return this->sensorData; }
void activate(MoveControl* moveControl, ControlPadInput* input, SensorData* sensorData);
void activate(DriveModiParams params);
/**
* @brief Set the max speed
*
* @param maxSpeed in m/s
*/
void setMaxSpeed(double maxForwardSpeed) { maxForwardSpeed = maxForwardSpeed; }
void increaseMaxSpeed(double increase = 0.1) { maxForwardSpeed += increase; }
void decreaseMaxSpeed(double increase = 0.1) { maxForwardSpeed -= increase; }
double getMaxSpeed() const { return this->maxForwardSpeed; }
/**
* @brief Set the max rotation
*
* @param maxRotation in rad/s (maybe)
*/
void setMaxRotation(double maxRotation) { maxRotationSpeed = maxRotation; }
void increaseMaxRotation(double increase = 0.1) { maxRotationSpeed += increase; }
void decreaseMaxRotation(double increase = 0.1) { maxRotationSpeed -= increase; }
double getMaxRotation() const { return this->maxRotationSpeed; }
protected:
MoveControl *moveControl;
const ControlPadInput* input;
const SensorData* sensorData;
double maxForwardSpeed = 1;
double maxRotationSpeed = 7;
private:
void init();
};
#endif // DRIVEMODI_H