FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Movement-based calls should be stopped when their task ends · Issue #413 · OkapiLib/OkapiLib · GitHub

This repository was archived by the owner on Feb 3, 2023. It is now read-only.
/ OkapiLib Public archive
This repository was archived by the owner on Feb 3, 2023. It is now read-only.

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

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingworkaround availableThis bug has a workaround

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL