Base robot, missions, and materials for the Fall 2024 FLL Season "Submerged".
We are not "giving away solutions" here. If you are looking for mission solutions, you'll just have to figure them out yourself :) Read our statement on the FLL "Discovery" core value here.
The instructions below will get team members up and running for FLL in a team collaboration environment using pybricks libraries, writing programs with Visual Studio Code, and using git/github for version control. The instructions are not perfect, and you will probably have some troubleshooting and adjustments along the way.
Very helpful page here about how to use pybricks with VS Code: https://pybricks.com/projects/tutorials/dev/tools/vscode/. Github link: https://github.com/pybricks/pybricks-micropython
Ctrl-Shift-P
> Python: Create Environment
. Just use the defaults. Open a new terminal with ctrl-shift-`
or Ctrl-Shift-P
> Create Terminal
and make sure it is in the python virtual environment. It will start with a green "(.venv)". If there are executionPolicy errors, you will need to elevate the permissions for Powershell. Instructions here (copied here), but basically just run Set-ExecutionPolicy RemoteSigned
in an Administrative PowerShell. Keep the admin PowerShell running because you will need it later on.pip install -r .\requirements.txt
(should do the same thing as pip install pybricks==3.3.0a5
, pip install pybricksdev
and pip install black
). Theoretically the virtual environment should read the requirements.txt file and install those libraries automatically, but I haven't tested that yet. Check to see what is installed with pip list
.teamMemberName-test-mission.py
, copy and paste the code below, and save it, but don't try to run it just yet. Wait for step 13 below. Note that after saving the file, the python Black Formatter should correct the "incorrect" spacing around the equals signs and commas.git config --global user.name "FIRST_NAME LAST_NAME"
; and git config --global user.email "MY_NAME@example.com"
robotName
to the name of the robot. This should allow the keyboard binding and tasks to recognize the robot by name. You may also want to set robot1, robot2, robot3 if needed/desired. Restart VS Code and open a new terminal and then test it with echo $env:robotName
.Ctrl-Shift-P
> Preferences: Open Keyboard Shortcuts (JSON)
. Edit the JSON to add the keyboard shortcut to run the task. Paste in the code below at the bottom of keybindings.json.ctrl-shift-L
runs the command, which should also run their program. Also, Ctrl-Shift-P
> Tasks: Run task
should pop up a menu with the correct entry. Watch the terminal and make sure the robot name is correct. If not, recheck that you completed step 11 correctly and that you restarted VS Code. If you want to run the program on one of the other robots that you defined in step 11 (i.e., robot1, etc) then use the keyboard shortcut Ctrl-Alt-L
, followed by the number 1
, 2
, or 3
as desired.from base_robot import *
# Copy this text into a new mission file. Name it something like
# myname.py. You can name it pretty much anything, but don't use
# any spaces or punctuation, other than _ and -. The name MUST
# end with .py
#
# Weird spacing in the code below is intentional. It should be
# corrected automatically by the Black formatter if it is working
# correctly.
#
# Add good comments, such as what the mission is supposed to do,
# how to align the robot in home, any initial starting instructions,
# such as how it should be loaded with anything, arm positions, etc.
# Please delete all of these comments, and consider writing your
# own here.
# When we run this program from the master program, we will call this
# "Run(br)" method.
def Run ( br: BaseRobot ) :
# Your mission code goes here, step-by-step
# It MUST be indented just like the lines below
br.driveForDistance(distance=250) # Drive distance
br.turnInPlace( angle = 90 )
br.moveLeftAttachmentMotorForDegrees(degrees=-720)
br.waitForForwardButton ()
br.driveUntilStalled(speedPct=80, stallPct=5)
br.moveRightAttachmentMotorForMillis(millis=1500)
br.waitForMillis(millis=1000)
br.moveLeftAttachmentMotorUntilStalled(stallPct=100)
br.curve(radius=350, angle=70)
# If running this program directly (not from the master program), this is
# how we know it is running directly. In which case, this method will
# create a BaseRobot and run the Run(br) method above.
# In other words, keep these three lines at the bottom of your code and
# everything will be fine.
if __name__ == "__main__":
br = BaseRobot()
Run(br)
keybindings.json
[
{
"key" : "ctrl+shift+l",
"command" : "workbench.action.tasks.runTask",
"args": "Run on robot"
},
{
"key" : "ctrl+alt+l",
"command" : "workbench.action.tasks.runTask",
"args": "Run on any robot"
}
]