Skip to content

[Bug] Latest firmware causes drivebase glitch #2887

Closed

Description

@mauroid

We just updated to the latest firmware, as of Nov 3, 2026.

As soon as the program starts, before any of our code is executed, the robot starts driving backwards at a high speed. This behavior started as soon as we upgraded, and we definitely don't have any code that instructs the robot to behave this way.

We use the following code to create a drivebase:

from pybricks.hubs import PrimeHub
from pybricks.pupdevices import Motor, ColorSensor, UltrasonicSensor, ForceSensor
from pybricks.parameters import Button, Color, Direction, Port, Side, Stop
from pybricks.robotics import DriveBase
from pybricks.tools import wait, StopWatch

hub = PrimeHub()
ma = Motor(port=Port.D, positive_direction=Direction.COUNTERCLOCKWISE)
mb = Motor(port=Port.A)
ta = Motor(port=Port.C)
tb = Motor(port=Port.E)
db = DriveBase(left_motor=ma, right_motor=mb, wheel_diameter=62.4, axle_track=136)
db.use_gyro(True)

Activity

  1. added
    triage
    on Nov 3, 2026
  2. mauroid commented on Nov 3, 2026

    @mauroid
    Author

    We are using the Pybricks Beta.

  3. BertLindeman commented on Nov 3, 2026

    @BertLindeman

    I ran your program (without the ta and tb motors)
    on the current firmware of beta.pybricks: ('primehub', '4.1.2', 'ci-release-114-v4.1.2 on 2026-10-29')

    And did not show any motor movements.

  4. mauroid commented on Nov 3, 2026

    @mauroid
    Author

    Yes, it doesn't always do it. It does it some times. But when it does it, it is catastrophic. The robot almost teared up the FLL mat.

    I would say it happens around 20-30% of the time. It definitely started as soon as we upgraded.

  5. BertLindeman commented on Nov 3, 2026

    @BertLindeman

    That is horrible.

    Any idea under which circumstances the problem occurs more often?
    A stable testcase would be the best.

  6. mauroid commented on Nov 3, 2026

    @mauroid
    Author

    I am attaching the entire program. Most of it is not run as you can see, only mission_02() is called. When the wait_kbd() command is added, the problem does not appear (the one marked with ## <- THIS). When this command is not there, it happens with the frequency I described.

    I don't think it has anything to do with mission_02(). We also noticed the same thing when mission_03() was run and everything else was commented out.

    FLL_2026_missions13.py

  7. BertLindeman commented on Nov 4, 2026

    @BertLindeman

    Hi Dimitrios,

    I have not yet been able to reproduce.
    Tried 20 times via upload and 20 times via button start.

    Some things just to be sure:

    1. the hub in the model is oriented with the display on top and the USB port at the front
    2. the issue occurs on the script you show in the first post here. So without any drivebase actions.
    3. problem occurs 2 or 3 times per 10 attempts

    And a question: Does the problem occur after a fresh program upload or also on a start using the hub button?

    Loose thoughts:

    1. The wait_kbd() does give the gyro time to settle and calibrate.
    2. Might the battery voltage be of concern? I tested and got ==> Battery: 7.749V

    Bert

  8. dlech commented on Nov 4, 2026

    @dlech
    Member

    There is actually two different SPIKE Prime hardware versions and therefore two different firmwares. I don't remember what we did to allow us to tell the difference though. If the SPIKE Prime was purchased in 2026, it may be possible that it is a different firmware from what Bert is testing.

  9. mauroid commented on Nov 4, 2026

    @mauroid
    Author

    Hi Bert,

    This is a much older spike prime (yellow hub), bought when they first came out. The hub is oriented so that the on/off button is at the right side of the robot, and the bluetooth button at the left side of the robot, so it is sideways to the robot's movement. Could that be an issue?

    The problem (sudden unexpected, very fast, backwards movement of the robot at startup) occurs in the exact code that I have attached in my previous message, when I remove the wait_kbd() call. When the wait_kbd() call is there, the problem does not appear. The problem definitely started as soon as we upgraded. I am not sure when was the previous time we had upgraded, but it was not tool long ago (maybe a month?).

    Let me know if you need more info. I can try to upload a video of the problem if you want.

  10. BertLindeman commented on Nov 4, 2026

    @BertLindeman

    This is a much older spike prime (yellow hub), bought when they first came out.

    So no 2026-version hub. Makes it easier for me to try to recreate as I have an early spike prime too.

    The hub is oriented so that the on/off button is at the right side of the robot, and the bluetooth button at the left side of the robot, so it is sideways to the robot's movement. Could that be an issue?

    I'll make the model sideways too.

    The problem (sudden unexpected, very fast, backwards movement of the robot at startup) occurs in the exact code that I have attached in my previous message, when I remove the wait_kbd() call. When the wait_kbd() call is there, the problem does not appear. The problem definitely started as soon as we upgraded. I am not sure when was the previous time we had upgraded, but it was not tool long ago (maybe a month?).

    The wait gives the gyro the time to calibrate.
    I have no idea why that would cause so violent movement in this case.

    Let me know if you need more info.

    Do you start the program mostly:

    • via upload and run, or
    • hub button press

    I can try to upload a video of the problem if you want.

    Visual is always a good way to share. Please paste the video here.
    That would also help me to build a model with the orientation you have.

    Another thought and just hypothetical:
    If the hub is not correctly wired or has wrong rotate direction, then the gyro gets correct environmental data but the resulting correction is wrong due to wiring or motor direction.
    That would also cause havoc.
    I do not think that is the case here.

  11. mauroid commented on Nov 4, 2026

    @mauroid
    Author

    I almost always start the program via upload and run.

    I will post a video as soon as I can, later today.

  12. BertLindeman commented on Nov 4, 2026

    @BertLindeman

    Reconfigured the robot here.
    Commented ta and tb lines out, as they have no effect on this.

    Did over 30 times upload+run without any problem.
    Without wait_kbd() ## <- THIS

    I still do not think the orientation of the hub is the real culprit in this case.

    but...

    1. Pybricks uses this coordinate system:

      • X = forward
      • Y = left
      • Z = up

      The top_side is the side with the buttons; front_side is the side with the USB port

      We have the top-side on top so +Z
      The usb port (front-side) is on the left so +Y

      The mapping is:

      Hub feature Robot direction Pybricks axis
      Display / button face Up +Z
      USB port Left +Y

      So you can change the hub definition into:

    hub = PrimeHub(top_side=Axis.Z, front_side=Axis.Y)
    1. The PrimeHub has an imu.ready() method.
      It indicates whether the IMU has calibrated and is ready.

      You can add after the hub is instantiated:

    while not hub.imu.ready():
        wait(10)
    or
    
    while not (hub.imu.ready() and hub.imu.stationary()):
        wait(100)

    Maybe these two changes make the drivebase work correct.
    And then you can remove the wait again.

    But no feeling that I found the problem though.

    Bert

  13. mauroid commented on Nov 5, 2026

    @mauroid
    Author

    I tried to reproduce the problem yesterday, but it never appeared again. Then we had a full practice session, again it never appeared. The only thing that changed is that the robot was rebooted (turned off and on) between the day that the problem appeared and yesterday, I can't think of anything else that might have affected the outcome.

    If you feel that this bug should be closed, feel free to do so. If the problem reappears, I will certainly either reopen the bug or open a new one.

  14. BertLindeman commented on Nov 5, 2026

    @BertLindeman

    Thank you for reporting back.

    I have no permission to close.

  15. laurensvalk commented on Nov 5, 2026

    @laurensvalk
    Member

    Let's keep this issue open. This is useful so far.

    Yes, it doesn't always do it. It does it some times. I would say it happens around 20-30% of the time.

    Just to confirm, this is between multiple consecutive runs without any restarts?

  16. 2 remaining items

  17. laurensvalk commented on Nov 5, 2026

    @laurensvalk
    Member

    Found the underlying cause too. Hopefully we can launch a fix tomorrow.

  18. laurensvalk commented on Nov 5, 2026

    @laurensvalk
    Member

    @mauroid: You can follow these steps to try the solution before we include it in the next release.

    I am curious to hear if this fixes it for you.

    Before you try it, maybe you can reproduce it with your existing program: stop the robot while it is moving. Then the problem should happen when you start it again.

    With the update, doing the same operation should no longer show the issue.

    Thanks!

  19. added
    topic: motors
    and removed
    triage
    on Nov 5, 2026
  20. added theissue type on Nov 5, 2026
  21. mauroid commented on Nov 5, 2026

    @mauroid
    Author

    Apologies, I am out of town and won't be able to test this until next week..

  22. laurensvalk commented on Nov 5, 2026

    @laurensvalk
    Member

    No rush! We're happy that you reported it.

    We will release this fix, and you are welcome to re-open this issue if you find that it still happens when you try it later.

  23. BertLindeman commented on Nov 5, 2026

    @BertLindeman

    Ah, finally got it recreated with Dimitrios FLL program.

    I did not get it recreated, because I had telemetry OFF.
    And now with telemetry ON I see the problem.

    100% recreated running these two programs after each other.

    First `issue_2887_1.py`:
    from pybricks.parameters import Direction, Port
    from pybricks.pupdevices import Motor
    from pybricks.tools import multitask, run_task, wait
    
    # Set up.
    motor = Motor(Port.A, Direction.CLOCKWISE)
    
    async def main1():
        print(f"angle 0 {motor.angle()} speed {motor.speed()}")
        motor.dc(30)
        await wait(1000)
        motor.dc(-100)
        await wait(2000)
    
    async def main2():
        await wait(1500)
        print(f"angle 3 {motor.angle()} speed {motor.speed()}")
        raise SystemExit
    
    
    async def main():
        await multitask(main1(), main2())
    
    run_task(main())
    and then `issue_2887_2.py`:
    from pybricks.pupdevices import Motor
    from pybricks.parameters import Port
    # from pybricks.robotics import DriveBase
    from pybricks.tools import wait
    
    motor = Motor(Port.A)
    # motor.reset_angle(0)
    motor.run(500)
    print("start motor angle", motor.angle())
    wait(1000)
    print(" mid  motor angle", motor.angle())
    motor.run_angle(500, -360) # Next run is wrong if you stop the program midway here.
    print(" end  motor angle", motor.angle())

    On start of the second program I see the first movement in the wrong direction and with the high speed (the final speed of program 1).

    Now test with ('primehub', '4.1.2', 'ci-build-5141-v4.1.2-3-g4d274c913 on 2026-11-05')
    Set telemetry ON and run the two programs after each other.
    No problem seen in 10 tests.

  24. laurensvalk commented on Nov 5, 2026

    @laurensvalk
    Member

    I didn't mention it, since that is how urban legends are made. Telemetry was just something that made this long-standing bug visible. It is not the cause of it. 😄

  25. BertLindeman commented on Nov 5, 2026

    @BertLindeman

    Updated post 😄

    Well found and fast fixed problem. Thank you.

  26. laurensvalk commented on Nov 6, 2026

    @laurensvalk
    Member

    The fix has been included in the latest beta and stable release!

  27. added
    topic: control
    software: pybricks-micropython
    on Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    software: pybricks-micropythontopic: controltopic: motors

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions