Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Bad trajectory calculation for some accelerations #664

Closed
laurensvalk opened this issue Jun 11, 2022 · 2 comments
Closed

[Bug] Bad trajectory calculation for some accelerations #664

laurensvalk opened this issue Jun 11, 2022 · 2 comments
Assignees
Labels
bug Something isn't working software: pybricks-micropython Issues with Pybricks MicroPython firmware (or EV3 runtime) topic: motors Issues involving motors

Comments

@laurensvalk
Copy link
Member

Describe the bug
Under some conditions, the reference trajectory calculation fails. Instead of going to the target gradually, it jumps there right away.

On the bright side, the controller is so stable now that it doesn't even blink and just goes there without complaining (like track_target), but clearly not at the commanded speed and acceleration.

Since this is only reproducable on the large motor while the trajectory code is motor independent, this is indicative that it happens for certain acceleration parameters, which do differ between motors.

control
servo

To reproduce

On today's master build. This likely also affects the 3.2.0 beta1 release.

Attach a large angular motor to port A. Then run:

from pybricks.pupdevices import Motor
from pybricks.tools import wait
from pybricks.parameters import Port, Stop
from pybricks import version

print(version)

# Initialize the motor.
motor = Motor(Port.A)

# Allocate the data logs.
DURATION = 4000
motor.log.start(DURATION)
motor.control.log.start(DURATION)

# Preposition motor to reproduce bug
motor.run_target(500, -170)

# Bug occurs here:
motor.run_target(1000, 360)

# Wait so we can also log the stopped behavior.
wait(500)
motor.stop()

# Transfer data logs.
print("Transferring data...")
motor.log.save("servo.txt")
motor.control.log.save("control.txt")
print("Done")
@laurensvalk laurensvalk added bug Something isn't working topic: motors Issues involving motors labels Jun 11, 2022
@laurensvalk laurensvalk self-assigned this Jun 11, 2022
@dlech dlech added the software: pybricks-micropython Issues with Pybricks MicroPython firmware (or EV3 runtime) label Jun 11, 2022
@laurensvalk
Copy link
Member Author

laurensvalk commented Jun 14, 2022

The following reproduces it on Move Hub using the internal motor

from pybricks.pupdevices import Motor
from pybricks.tools import wait
from pybricks.parameters import Port
from pybricks import version

print(version)

# Initialize the motor.
motor = Motor(Port.A)
motor.run_target(1500, 360)
wait(2000)

@laurensvalk
Copy link
Member Author

This should be fixed and covered by tests in test_trajectory.c.

Pybricks v3.2 automation moved this from To do to Done Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working software: pybricks-micropython Issues with Pybricks MicroPython firmware (or EV3 runtime) topic: motors Issues involving motors
Projects
Pybricks v3.2
  
Done
Development

No branches or pull requests

2 participants