Describe the bug
Calling moveDistance or similar will start that movement. Normally, the movement (and with it, the call) will finish before its task is deleted. However, if the task is deleted prematurely, the movement continues, which can lead to a loss of control over the robot.
As a safety measure, users can call the relevant stop method.
This should be fixed by tracking the task the movement was started from; if that task is deleted, then the movement should be interrupted.
Steps To Reproduce
void opcontrol() {
chassis = ChassisControllerBuilder()
.withMotors({1, -3}, {-2, 4})
.withGains({0.001, 0, 0}, {0, 0, 0})
.withDimensions(AbstractMotor::gearset::green,
{{4_in, 11.5_in}, imev5GreenTPR})
.build();
pros::Task task([](void *) {
std::cout << "Starting" << std::endl;
chassis->moveDistance(20_ft);
}, nullptr, "task");
pros::delay(500);
task.remove();
std::cout << "Killed" << std::endl;
pros::delay(500);
}
Expected behavior
The robot should have been stopped when the task was killed. Instead, it kept driving.
Versions
v4.0.1
Describe the bug
Calling moveDistance or similar will start that movement. Normally, the movement (and with it, the call) will finish before its task is deleted. However, if the task is deleted prematurely, the movement continues, which can lead to a loss of control over the robot.
As a safety measure, users can call the relevant stop method.
This should be fixed by tracking the task the movement was started from; if that task is deleted, then the movement should be interrupted.
Steps To Reproduce
Expected behavior
The robot should have been stopped when the task was killed. Instead, it kept driving.
Versions
v4.0.1