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:
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