driveManager gets now the object
This commit is contained in:
@@ -25,59 +25,21 @@ DriveManager::DriveManager(DriveModiParams params){
|
||||
this->init();
|
||||
}
|
||||
|
||||
DriveManager::~DriveManager() {
|
||||
delete this->navigation;
|
||||
}
|
||||
|
||||
void DriveManager::changeModus(Modi modus) {
|
||||
this->currentModus = modus;
|
||||
|
||||
void DriveManager::changeModus(DriveModi* modus) {
|
||||
if (this->currentModusPtr) {
|
||||
this->removeChildComponent(this->currentModusPtr);
|
||||
delete this->currentModusPtr;
|
||||
this->currentModusPtr = nullptr;
|
||||
}
|
||||
//Reset Route to first point
|
||||
this->navigation->startNavigation();
|
||||
|
||||
switch (modus) {
|
||||
case Modi::Off:
|
||||
this->currentModusPtr = nullptr;
|
||||
break;
|
||||
|
||||
case Modi::ManualControl: {
|
||||
this->currentModusPtr = new ManualControl(this->driveModiParams);
|
||||
}
|
||||
break;
|
||||
|
||||
case Modi::CaptureRoute: {
|
||||
this->currentModusPtr = new CaptureRoute(this->driveModiParams, this->navigation);
|
||||
}
|
||||
break;
|
||||
|
||||
case Modi::Autopilot: {
|
||||
this->currentModusPtr = new Autopilot(this->driveModiParams, this->navigation);
|
||||
}
|
||||
break;
|
||||
|
||||
case Modi::TestMode: {
|
||||
this->currentModusPtr = new TestMode(driveModiParams, this->navigation);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
this->currentModusPtr = nullptr;
|
||||
break;
|
||||
}
|
||||
this->currentModusPtr = modus;
|
||||
|
||||
if (this->currentModusPtr)
|
||||
this->currentModusPtr->activate(this->driveModiParams);
|
||||
this->addChildComponent(this->currentModusPtr);
|
||||
}
|
||||
|
||||
void DriveManager::init() {
|
||||
this->navigation = new Navigation(this->driveModiParams.sensorData);
|
||||
|
||||
this->addChildComponent(this->driveModiParams.moveControl);
|
||||
this->addChildComponent(this->navigation);
|
||||
this->activateOnlyChilds();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user