Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Running two commands in sequence from SendableChooser (http://www.chiefdelphi.com/forums/showthread.php?t=144692)

jreneew2 02-24-2016 07:43 PM

Running two commands in sequence from SendableChooser
 
Hello, I am having trouble with auto choosers in the smartdashboard. I have two sendable choosers (one for obstacles and one for goals). When I run the code, the commands work like they should, but when autonomous mode ends, the code crashes with no errors.

Here is a snippet:

Robot.cpp:
Code:

void Robot::AutonomousInit() {
        selectedObstacle = (Command*) chooserObstacle->GetSelected();
        selectedGoal = (Command*) chooserGoal->GetSelected();
        selectedObstacle->Start();
}

void Robot::AutonomousPeriodic() {
        Scheduler::GetInstance()->Run();
        if(selectedObstacle->IsRunning() == false) {
                selectedGoal->Start();
        }
}

void Robot::TeleopInit() {
        if (selectedObstacle != nullptr) {
                selectedObstacle->Cancel();
        }
        if (selectedGoal != nullptr) {
                selectedGoal->Cancel();
        }
}

My guess is that the robot is confused because the command group was cancelled? Does a command group get cancelled?

Thanks,
Drew


All times are GMT -5. The time now is 10:25 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi