Pass gamepad to all objects
This commit is contained in:
@@ -11,8 +11,8 @@
|
||||
|
||||
#include "driveModi/Modi/Autopilot/autopilot.h"
|
||||
|
||||
Autopilot::Autopilot(MoveControl* moveControl, Navigation* navigation)
|
||||
: ManualControl(moveControl) {
|
||||
Autopilot::Autopilot(MoveControl* moveControl, Ps3Controller *gamepad, Navigation* navigation)
|
||||
: ManualControl(moveControl, gamepad) {
|
||||
this->navigation = navigation;
|
||||
this->navigationStarted = this->navigation->startNavigation();
|
||||
this->routeInfo = this->navigation->getRouteInfo();
|
||||
|
||||
@@ -35,7 +35,7 @@ class Autopilot : public ManualControl {
|
||||
* @param moveControl for ManualControl
|
||||
* @param navigation for route instructions
|
||||
*/
|
||||
Autopilot(MoveControl* moveControl, Navigation* navigation);
|
||||
Autopilot(MoveControl* moveControl, Ps3Controller *gamepad, Navigation* navigation);
|
||||
|
||||
/**
|
||||
* @brief Calls runAutopilot or ManualControl loop
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
#include "driveModi/Modi/CaptureRoute/captureRoute.h"
|
||||
|
||||
CaptureRoute::CaptureRoute(MoveControl* moveControl, Navigation* navigation)
|
||||
: ManualControl(moveControl) {
|
||||
CaptureRoute::CaptureRoute(MoveControl* moveControl, Ps3Controller *gamepad, Navigation* navigation)
|
||||
: ManualControl(moveControl, gamepad) {
|
||||
this->navigation = navigation;
|
||||
this->routeInfo = RouteInfo{0, 0};
|
||||
}
|
||||
@@ -28,7 +28,7 @@ void CaptureRoute::loop() {
|
||||
}
|
||||
|
||||
void CaptureRoute::runCaptureRoute() {
|
||||
if (Ps3.data.button.triangle) {
|
||||
if (this->gamepad->data.button.triangle) {
|
||||
if (this->navigation->addCurrentPosToRoute()) {
|
||||
this->routeInfo = navigation->getRouteInfo();
|
||||
this->updateDisplay = true;
|
||||
|
||||
@@ -33,7 +33,7 @@ class CaptureRoute : public ManualControl {
|
||||
* @param moveControl for ManualControl
|
||||
* @param navigation to add Points
|
||||
*/
|
||||
CaptureRoute(MoveControl* moveControl, Navigation* navigation);
|
||||
CaptureRoute(MoveControl* moveControl, Ps3Controller *gamepad, Navigation* navigation);
|
||||
|
||||
/**
|
||||
* @brief Calls runCaptureRoute and ManualControl::loop
|
||||
@@ -50,12 +50,12 @@ class CaptureRoute : public ManualControl {
|
||||
*/
|
||||
void runCaptureRoute();
|
||||
|
||||
/**
|
||||
* @brief Get the Navigation object
|
||||
*
|
||||
* @return Navigation*
|
||||
*/
|
||||
Navigation* getNavigation() const { return this->navigation; }
|
||||
// /**
|
||||
// * @brief Get the Navigation object
|
||||
// *
|
||||
// * @return Navigation*
|
||||
// */
|
||||
// Navigation* getNavigation() const { return this->navigation; }
|
||||
|
||||
/**
|
||||
* @brief Get the Route Info object
|
||||
|
||||
@@ -10,8 +10,9 @@
|
||||
*/
|
||||
#include "manualControl.h"
|
||||
|
||||
ManualControl::ManualControl(MoveControl *moveControl) {
|
||||
ManualControl::ManualControl(MoveControl *moveControl, Ps3Controller *gamepad) {
|
||||
this->moveControl = moveControl;
|
||||
this->gamepad = gamepad;
|
||||
this->moveControl->setDrivingStatus(DrivingStatus::drive);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
*/
|
||||
class ManualControl : public DriveModi {
|
||||
public:
|
||||
ManualControl(MoveControl *moveControl);
|
||||
ManualControl(MoveControl *moveControl, Ps3Controller *gamepad);
|
||||
|
||||
/**
|
||||
* @brief Destroy the Manual Control object
|
||||
@@ -71,6 +71,7 @@ class ManualControl : public DriveModi {
|
||||
|
||||
protected:
|
||||
MoveControl *moveControl;
|
||||
Ps3Controller *gamepad;
|
||||
|
||||
private:
|
||||
uint32_t lastMillis = 0;
|
||||
|
||||
Reference in New Issue
Block a user