Example of code needed for FLL or other robotics competition. #1065
MonongahelaCryptidCooperative
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey everyone,
We have seen multiple people asking how one goes about using Pybricks for competitive robotics. Particularly how to handle different runs/programs. I know the Pybricks creators have released some demos but I thought we'd just do a code dump and show exactly what we used for this season including things only used for development (like our remote code and our code to utilize technic hubs).
Be kind as all of this was programmed by a 12 year old just learning python/OOP
https://github.com/MonongahelaCryptidCooperative/FLL/
A couple of points:
To switch programs you have to hold down both an arrow buttons (Left or right) and the center button. This was done as team members had fat fingers and were accidentally scrolling through programs during competition (we have it programmed to automatically load the next program/run so such is unnecessary).
Runs/programs are launched via the Bluetooth button. This is because 1. we were using the center button as a "safety" and 2. our design resulted in all of the buttons other than the Bluetooth being covered by attachments.
RC mode works by first finding the RC program (It displays an "R") then pushing the launch (Bluetooth button) on the prime hub and then pressing the center button on the remote. Controls are pretty straightforward, but the red left/right buttons work as macros and when held down cause the buttons on the opposite side to operate the attachment motors. This is quite useful as then you can use RC mode to develop new attachments/try out different strategies without having to program anything. This is particularly useful if you develop copies of your robot using technic hubs just for this purpose.
Line following/finding code has been deleted/switched to pass so you can't actually run several of the runs programmed.
We did include this years code. Had 400 points coded, got 375 in real life. Our run starts at 4:36:00 if you want to look at the code and see how it worked in real life. https://www.youtube.com/watch?v=I4g1R-PBdCY&t=16633s
At that point in time the team was called Exploding toaster supernova (they are now the Mon Cryptid Cooperative).
Anyways hopefully this helps people get started. Please let us know if this was helpful to anyone.
Beta Was this translation helpful? Give feedback.
All reactions