Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

Movement-based calls should be stopped when their task ends #413

Open
Octogonapus opened this issue Jan 12, 2020 · 0 comments
Open

Movement-based calls should be stopped when their task ends #413

Octogonapus opened this issue Jan 12, 2020 · 0 comments
Assignees
Labels
bug Something isn't working workaround available This bug has a workaround

Comments

@Octogonapus
Copy link
Member

Octogonapus commented Jan 12, 2020

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

@Octogonapus Octogonapus added the bug Something isn't working label Jan 12, 2020
@Octogonapus Octogonapus self-assigned this Jan 12, 2020
@Octogonapus Octogonapus added the workaround available This bug has a workaround label May 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working workaround available This bug has a workaround
Projects
None yet
Development

No branches or pull requests

1 participant