FRC Team 4973's robot code in Python using RobotPy.
| Control | Action |
|---|---|
| A button (hold) | Spin motor at current speed |
| A button (release) | Stop motor |
| D-pad up | Increase speed by 0.05 |
| D-pad down | Decrease speed by 0.05 |
Starting speed: 0.1
uv manages Python and dependencies automatically - no global installs needed.
# Install uv (one time)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Run simulation (uv installs dependencies automatically)
uv run python -m robotpy simIf you prefer using system Python directly:
# Install dependencies
pip install robotpy[commands2,sim] phoenix6
# Run simulation
python3 -m robotpy simFor consistent environments across team members.
# Build (first time only)
docker compose build
# Run simulation
docker compose run --rm robotpy sim- Run:
uv run python -m robotpy sim(orpython3 -m robotpy simif using pip) - The simulation GUI opens
- In the GUI:
- Go to Joysticks panel
- Map a virtual joystick to port 0
- Enable Teleop mode
- Test the controls:
- Press A button → motor output appears
- Use D-pad up/down → check console for speed changes
When connected to the robot (via WiFi or USB):
# Using uv:
uv run python -m robotpy sync # First time: sync dependencies to roboRIO
uv run python -m robotpy deploy # Deploy code
# Or using pip:
python3 -m robotpy sync
python3 -m robotpy deployThen in Driver Station:
- Connect to robot
- Enable Teleop
- Test controls
flatbot2026-python/
├── robot.py # Main entry point & Robot class
├── robot_container.py # Hardware setup & button bindings
├── pyproject.toml # RobotPy config & dependencies
├── Dockerfile # Dev environment
├── docker-compose.yml # Easy Docker usage
└── README.md # This file
Simulation won't start:
- If using uv: try
uv sync --refreshto reinstall dependencies - If using pip: reinstall with
pip install --force-reinstall robotpy[commands2,sim] phoenix6 - Check Python version:
python3 --version(need 3.12+)
Motor not responding in simulation:
- Check the Joysticks panel - make sure a joystick is mapped to port 0
- Make sure Teleop is enabled (not Disabled or Autonomous)
Deploy fails:
- Make sure you're connected to the robot network
- Run sync first:
uv run python -m robotpy sync(orpython3 -m robotpy sync)