Sandbox for training -- transition to python
Why? Well read this: switch to python
This repository contains the resources and code we use to initally transition to Python and to train future Raoches.
The 2025 REEFScape season repository (for competiton code) is located at RobotPython2025 #TODO: update the repo name and this link once team is over their initial freakout
Create a python based profile in your VS Code: optional profile file
Make sure you have Python 3.12.5
python --version
------------------------
OUTPUT: Python 3.12.5
1a. If not go to [Other Resources] and download it.
Clone the repository:
git clone https://github.com/Team2556/RobotPythonTraining.git
cd sandbox\
This should put you in the sandbox folder in your terminal on VS Code. There should be a \src\ folder and a pyproject.toml file on the main branch. We don't want the main branch changed yet, bruh.
Create a branch named with your name and publish that to GitHub (origin)
Create a virtual environment (from a terminal in VS Code; in the repo/sandbox directry on pc)
python -m venv venv
Activate the virtual environment:
On Windows:
venv\Scripts\activate
On macOS/Linux:
source venv/bin/activate
Install the dependencies:
pip install .
The dot (.) references your current directory. From that directory it will use the pyproject.toml to install the proper libraries.
VS Code will often prompt you as to if you want to use this venv as your working environment (in the big windows, not just the terminal you activated in the previous step).
[ ] TODO: See what most students seeing and add helper image to get to working in correct venv
py -m robotpy sync
Run the robot code:
python src/robot.py
Root Directory:
Directory Structure:
/docs/
:
training_materials
, API_docs
, and design_docs
./training/
:
/basics/
: Python basics (syntax, loops, functions, etc.)/robot_basics/
: Simple Python examples related to robot control (e.g., motor control, sensor integration)./advanced/
: More complex examples (e.g., autonomous mode routines, vision processing)./challenges/
: Coding challenges and exercises for team members to practice./solutions/
: Example solutions to the challenges./sandbox/
:
/src/
:commands/
: Houses command logic that directs subsystems.components/
: Stores smaller, reusable pieces of code that don't belong to a specific subsystem but are used across multiple areas (e.g., custom sensors, utility functions).subsystems/
: Contains the code for each major subsystem of the robot, such as drivetrain, shooter, intake, etc.autonomous/
: Dedicated to autonomous routines and strategies.pathplanner/
: Contains path planning logic, trajectory generation, and related code./sandbox/src/
├── commands/
│ ├── drive_command.py
│ ├── shoot_command.py
│ └── tests/
├── components/
│ ├── custom_sensor.py
│ └── utils.py
├── subsystems/
│ ├── drivetrain.py
│ ├── intake.py
│ ├── shooter.py
│ └── tests/
├── autonomous/
│ ├── auto_routines.py
│ └── tests/
├── pathplanner/
│ ├── trajectory_generator.py
│ └── path_follower.py
└── main.py
/tests/
: Unit tests for each component and subsystem. Encourage test-driven development (TDD) where feasible.Branches:
main
Branch: your_name_here
Branch: Pull Requests (PRs):
Issues and Tasks:
bug
, enhancement
, documentation
). # [] TODO: updateTODO: Refer to our main github readme or sync here.... In the VS Code Extensions sidbar, these codes should help you find usefull extensions (well.. Git and Python are required)
Clone the repository:
git clone https://github.com/Team2556/RobotPython2025.git
cd RobotPython2025
Create a vertual environment (from a terminal in VS Code; in the repo/sandbox directry on pc)
python -m venv venv
Activate the virtual environment:
On Windows:
venv\Scripts\activate
On macOS/Linux:
source venv/bin/activate
Install the dependencies:
pip install . #the dot references your current directory -->
initialize robotpy
py -m robotpy init
Created folders named 'src/subsytems' and 'tests' etc..
mkdir src/subsytems
mkdir src/tests
move robot.py file created by initilization to 'src' folder move robot.py src\
Ran the robotpy sync to get the RoboRIO python
py -m robotpy sync
Ran the robot code:
python src/robot.py