Installing Phoenix 6 (non-FRC)¶
Important
Users in FRC can skip this article.
Phoenix 6 is fully supported outside of FRC on supported systems with a USB to CAN adapter.
Note
CANivore is the recommended USB to CAN adapter with support for CAN FD, name specification, and Windows (as host).
Installation¶
Installation is composed of a few primary pieces. Users may skip CANivore installation if they are using a generic USB-to-CAN adapter.
Installing the Phoenix APT Repository¶
Phoenix 6 is distributed through our APT repository. Begin with adding the repository to your APT sources.
YEAR=<year>
sudo curl -s --compressed -o /usr/share/keyrings/ctr-pubkey.gpg "https://deb.ctr-electronics.com/ctr-pubkey.gpg"
sudo curl -s --compressed -o /etc/apt/sources.list.d/ctr${YEAR}.list "https://deb.ctr-electronics.com/ctr${YEAR}.list"
Note
<year>
should be replaced with the year of Phoenix 6 software for which you have purchased licenses.
Open /etc/apt/sources.list.d/ctr${YEAR}.list
with an editor of your choice.
sudo nano /etc/apt/sources.list.d/ctr${YEAR}.list
In the tools
entry, replace stable
with the distribution you want to use.
# APT repo for CTR tools, including canivore-usb
deb [signed-by=/usr/share/keyrings/ctr-pubkey.gpg] https://deb.ctr-electronics.com/tools stable main
For example. Raspberry Pi would look like:
# APT repo for CTR tools, including canivore-usb
deb [signed-by=/usr/share/keyrings/ctr-pubkey.gpg] https://deb.ctr-electronics.com/tools raspberrypi main
Available distributions can be found in the dropdown below.
Modifying .list
Distribution
System |
|
---|---|
Raspberry Pi |
raspberrypi |
NVIDIA Jetson |
jetson |
Other Linux systems (default) |
stable |
Warning
Do not modify the distribution of the libs/<year>
entry in the .list
file.
CANivore Installation¶
On non-FRC Linux systems, the canivore-usb
kernel module must be installed to add SocketCAN support for the CANivore. The kernel module is distributed through our APT repository.
Note
Custom bit rates and CAN 2.0 are not supported at this time. The parameters passed into SocketCAN are not applied by the firmware.
Raspberry Pi
Warning
Raspberry Pi 4 with 32-bit OS require additional instructions. See Raspberry Pi Errata for more information.
Install the Raspberry Pi kernel headers.
sudo apt install raspberrypi-kernel-headers
Update APT and install
canivore-usb
sudo apt update
sudo apt install canivore-usb -y
Other Supported Distributions
Update APT and install
canivore-usb
.
sudo apt update
sudo apt install canivore-usb
Tip
To get a robot application up and running quickly, check out our non-FRC Linux example.
API Installation¶
Phoenix 6 can be installed and updated using the following:
sudo apt update
sudo apt install phoenix6
Tip
To get a robot application up and running quickly, check out our non-FRC Linux example.
Installation is available through PyPI.
py -3 -m pip install phoenix6
Installation is available through Nuget. An example on adding Nuget packages to a Visual Studio project is available in the Microsoft Quickstart.
Firmware Installation¶
Device firmware upgrading is handled by the Phoenix Tuner X configuration client.
Simulation vs Hardware¶
Users may notice the robot program is using simulated devices by default. This is the default behavior if the host platform supports simulation (see requirements for a full list of supported platforms).
In order for the robot program to communicate with physical devices (on platforms that support both simulation and hardware), the CTR_TARGET
environment variable must be set. Examples of this are shown below.
export CTR_TARGET=Hardware # Export the environment variable so it's persistent in the shell
Or
CTR_TARGET=Hardware python3 application.py # Set the environment variable only for the python call
Troubleshooting¶
Bad return status on module...
¶
This error can show up on Raspberry Pi or Jetson systems when using the incorrect tools distribution for APT. Refer to Modifying list Distribution to correct your .list
file.
Diagnostics is running but no CAN¶
Symptom: Tuner can ping the system and see that diagnostics is running but there are no devices. Possible Solutions:
Verify that the CAN Bus is valid. Motors should be blinking orange. Consult Hardware Reference for a full list of LED codes.
Verify that the
canivore-usb
kernel module is correctly installed by runningmodinfo canivore-usb
.If
canivore-usb
shows installed with APT but does not appear withmodinfo
, then an update may have broken the module. Uninstall and reinstallcanivore-usb
with:
sudo apt remove canivore-usb canivore-usb-kernel
sudo apt install canivore-usb
Raspberry Pi Errata¶
On a Raspberry Pi 4 or newer, the latest 32-bit Raspberry Pi OS image will default to using the 64-bit kernel while still using 32-bit APT packages. As a result, the canivore-usb kernel module will fail to install.
There are two options to work around this issue:
(Recommended) Use the 64-bit Raspberry Pi OS. This allows programs to use all available RAM and improves overall system performance and stability.
Add
arm_64bit=0
to /boot/config.txt and reboot. This forces the Raspberry Pi to use the 32-bit kernel. Note that programs will be limited to using 3 GB of RAM, and system performance may be impacted.
Warning
Do not add arm_64bit=0
to /boot/config.txt when using the 64-bit Raspberry Pi OS. Attempting to do so may cause the Pi to be unable to boot.
Examples¶
The same Phoenix 6 examples can be used as a reference outside of FRC. The function calls are identical, although the framework that is used to call them may be different and specialized for FRC.
Non FRC Projects¶
We recommend that users use the standard language projects to use our library outside of FRC. For example, a typical Python project will have a main.py
that utilizes the phoenix6
library that’s installed with pip
.
A typical C# project is a Visual Studio project that includes our libraries via nuget.
For C++, an example utilizing CMake is provided here.
Note
When utilizing actuators outside of FRC, the user must continuously feed an enable signal to the device. For more information, see Enabling Actuators.
Alternative Support¶
In the event that the Phoenix 6 API does not fit the user’s needs (e.g. when using devices such as a TalonSRX), users can utilize the Phoenix 5 API.
We also provide a hardware robot controller called the HERO development board. The HERO can be programmed in C# to utilize compatible v5 devices.