The program was stopped (SystemAbort). #949
-
I am a first time builder that could use some help with code to motorizing the Lego model for Ecto-1. The Lego Move Hub is being used with the two motors for the drive function and a separate Lego Large Motor V46 for the steering. I was having difficulties getting the various angle functions to operate to calibrate after running until stall but using a work around by running the motor in short burst that seems to work. The Move Hub motors operate at a constant speed along with a power burst that all appear to work fine ... for a little while. I receive the message "The program was stopped (SystemAbort)" after a random amount of time that appears to be related to the number of buttons pressed but not normalized in time or amount of presses. The Move Hub will stay blue for second after the remote control first disconnects then the Move Hub powers off. I can continue this pattern by connecting back to bluetooth and running the code - I don't need to reflash the firmware. from pybricks.pupdevices import Motor, Remote
from pybricks.parameters import Port, Direction, Stop, Button
from pybricks.tools import wait
# Initialize the motors.
steer = Motor(Port.C)
front = Motor(Port.A)
rear = Motor(Port.B, Direction.COUNTERCLOCKWISE)
# Connect to the remote.
remote = Remote()
# driving with remote
while True:
# Check which buttons are pressed.
pressed = remote.buttons.pressed()
# steer by running the motor
if Button.RIGHT_MINUS in pressed:
steer.run_time(300,120,Stop,wait=False)
if Button.RIGHT_PLUS in pressed:
steer.run_time(-300,120,Stop,wait=False)
# Choose the drive speed based on the left controls.
drive_speed = 0
if Button.LEFT_PLUS in pressed:
drive_speed = 500
if Button.LEFT_MINUS in pressed:
drive_speed = -500
# speed boost
if Button.LEFT in pressed:
drive_speed = 1200
# Apply the selected speed.
front.run(drive_speed)
rear.run(drive_speed) Is there debug or more verbose error messaging that can be enabled? Could there be a buffer overflow from this bad coding? How best to troubleshoot this situation? Also, is there a tutorial on getting the code built-in with the firmware? How can the code run simply turning on the Move Hub and remote? Many thank you for reading and any helpful information you can share here. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 8 replies
-
If you press the button on the hub or the stop button in Pybricks Code while the program is running, it will stop the program with this message.
The Move hub has very limited memory, so there isn't anything more verbose. You can add your own
When you turn off the hub, the current program is saved to flash memory. Just press the green button on the hub to start the program again at any time (unless the program is already running, then pressing the green button stops the program). |
Beta Was this translation helpful? Give feedback.
-
Thank you for your response.
I am not pressing the button on the hub or the stop button in Pybricks Code while the program is running.
Understood
That doesn't seem to happen in this situation but I am getting this shutdown that might be causing my problem as I need to use Pybricks Code application every time to run the code. I can disconnect from the application bluetooth to continue to run but after a short period of time if the shutdown happens on me. Any suggestions? |
Beta Was this translation helpful? Give feedback.
-
Does this still happen if you replace steer.run_time(300,120,Stop,wait=False) by steer.run_time(300,120,Stop.COAST,wait=False) for both occurrences in your program? Using a bare |
Beta Was this translation helpful? Give feedback.
Thank you for your response.
I am not pressing the button on the hub or the stop button in Pybricks Code while the program is running.
Understood