Very simple getting started example for using Phoenix 6 in Python.
- Make sure you meet the Phoenix 6 System Requirements
- Install
requirements.txt
withpip install -r requirements.txt
. - If using a CANivore on Linux, install canivore-usb
If running on linux with a generic USB to CAN SocketCAN adapter, run the ./generic_socketcan_start.sh
script.
If you're using CANivore on Windows, no additional steps are needed to interface with the CANivore. Ensure Tuner's "CANivore USB" toggle is off when running hardware-attached on Windows.
If a device has seen an FRC Robot Controller (RoboRIO or similar), it will "FRC-Lock". Unlock it for non-FRC use by performing a Factory Default in Tuner.
The Python package of Phoenix 6 by-default runs simulation if the system supports it.
In order to run with hardware, set the CTR_TARGET
environment variable to "Hardware".
A table of what to run is provided below:
Target | Windows | Linux | MacOS |
---|---|---|---|
Simulation | python robot.py |
python robot.py |
python robot.py |
Hardware | $env:CTR_TARGET="Hardware"; python robot.py |
CTR_TARGET=Hardware python robot.py |
Not supported |
Most of the examples available on our Phoenix 6 Examples repo are applicable for non-FRC as well.