Time to
Time to
Code
Code
1
Imports
from pybricks.hubs import PrimeHub
from pybricks.pupdevices import Motor, ColorSensor, UltrasonicSensor, ForceSensor
from pybricks.parameters import Button, Color, Direction, Port, Side, Stop, Axis
from pybricks.robotics import DriveBase
from pybricks.tools import wait, StopWatch, multitask, run_task
#Lifty Settings Ella
lifty = Motor(Port.A,Direction.COUNTERCLOCKWISE,reset_angle=True)
#Dropper Settings Milo
drop_grab = Motor(Port.E,Direction.COUNTERCLOCKWISE,reset_angle=True)
2 Initializations
def drive(cm,pause): #Benjamin
drive_base.straight(cm * 10,wait=pause)
def backup(cm,pause): #Benjamin
drive_base.straight(-cm * 10,wait=pause)
3
Functions
#M08 Rolling Camera Milo
lights_off()
tail_left(250,90,True)
drive(17,True)
left_turn(90,True)
tail_right(250,135,True)
tail_reset(True)
#M09 Movie Set Luke
drive(3,True)
right_turn(90,True)
drive(20.5,True) #15,18,19.5
right_turn(16,True) #10,15
lifty_down(200,180,True)
backup(16,True) #7,10
left_turn(30,True) #45
lifty_reset(True)
6. Comment to title the
code and say who wrote it.
5. Iteration comments to show
what we have changed in our code.
4 Robot
Mission Code
# Mission 4 Rolling Camera Part 1 written by Milo
Turn off the lights on the color sensor.
Back attachment turn left at 250 mm/s, for 90 degrees.
Drive forward 17 cm.
Left turn 90 degrees.
Back attachment turn right at 200 mm/s, for 135 degrees.
Back attachment reset to zero degrees.
# Mission 9 Movie Set written by Luke
Drive forward 3 cm.
Right turn 90 degrees.
Drive forward 20.5 cm.
Right turn 16 degrees.
Front attachment down at 200 mm/s, for 180 degrees.
Backup 16 cm.
Left turn 30 degrees.
Front attachment rest to zero degrees.
Every True in the code means that the command will finish before moving on to the next code. If it is False we add a while not statement that looks like this:
while not drop_grab.done() or not drive_base.done():
wait(10)
which means: that while the back attachment and the drive wheels haven't finished the last full motion in the command, wait to move on to the next command.
Team
Achievements
2021-2022 Season
FLL Regionals
Innovation Project Award
FLL STATE
Innovation Project Award
2022-2023 Season
FLL Regionals
Robot Design Award
FLL STATE
South Idaho State Champions Award
FIRST Championship (Worlds)
Huston, Texas
April 19-22, 2023
Rising Star Award
2023-2024 Season
FLL STATE
Core Values Award
nd
2 Place
Learn more about
The Building Beasts are a 4-H team, thus a 501(c)(3). Checks can be made out to 53036 The Building Beasts, or you can use the donate button.
Email: buildingbeasts@mailfence.com