58 lines
1.4 KiB
C++
58 lines
1.4 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);
|
|
|
|
void setSpeeds(DrivingSpeeds speeds) { this->maxSpeeds = speeds; }
|
|
DrivingSpeeds getSpeeds() const { return this->maxSpeeds; }
|
|
DrivingSpeeds& getSpeedsRef() { return this->maxSpeeds; }
|
|
|
|
protected:
|
|
virtual void afterActivate() {}
|
|
|
|
MoveControl *moveControl;
|
|
DrivingSpeeds maxSpeeds = {1, 7};
|
|
const ControlPadInput* input;
|
|
const SensorData* sensorData;
|
|
|
|
private:
|
|
void init();
|
|
};
|
|
#endif // DRIVEMODI_H
|