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 is composed of a few primary pieces. Linux users may skip CANivore installation if they are using a generic USB-to-CAN adapter.

  1. APT Repository Installation (Linux only)

  2. (Optional) CANivore Installation (Linux only)

  3. API Installation

Linux Setup

Linux systems require some extra steps to install Phoenix 6 and CANivore.

APT Repository Installation

The Phoenix 6 C++ API, CANivore kernel module, and other utilities are 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

<dist>

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.

  1. Update APT and install the Raspberry Pi kernel headers.

sudo apt update
sudo apt install raspberrypi-kernel-headers
  1. Install canivore-usb.

sudo apt install canivore-usb -y
  1. Update APT and install canivore-usb.

sudo apt update
sudo apt install canivore-usb -y

API Installation

Installation is available through PyPI.

py -3 -m pip install phoenix6

Tip

To get a robot application up and running quickly, check out our non-FRC Python example.

Installation is available through NuGet.

An example on adding NuGet packages to a Visual Studio project is available in the Microsoft Quickstart. Alternatively, the package can be added using the dotnet CLI.

dotnet add package Phoenix6.Hardware

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.

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. Possible values of CTR_TARGET are:

Examples of setting CTR_TARGET are shown below.

$env:CTR_TARGET="Hardware" # Set the environment variable, which will persist for the duration of this powershell instance.
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

There are several variations of the Phoenix 6 NuGet package to switch between real and simulated devices on supported platforms (see requirements). The available NuGet packages are:

Note that only one of these packages may be active in the program at a time.

Firmware Installation

Device firmware upgrading is handled by the Phoenix Tuner X configuration client.

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 running modinfo canivore-usb.

    • If canivore-usb shows installed with APT but does not appear with modinfo, then an update may have broken the module. Uninstall and reinstall canivore-usb with:

sudo apt remove canivore-usb canivore-usb-kernel
sudo apt install canivore-usb

Examples

The FRC Phoenix 6 Examples can be used as a reference outside of FRC. Most of the API is identical, aside from a few FRC-specific integrations and the WPILib framework used by the robot program.

Non-FRC Projects

We recommend that users use the standard language projects to use our library outside of FRC.

  • A typical Python project will have a robot.py that utilizes the installed phoenix6 library, as demonstrated by the Python example.

  • A typical C# project is a Visual Studio or dotnet project that includes our libraries via NuGet.

  • A typical C++ Linux project uses CMake, as demonstrated by the C++ Linux example.

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

Some older devices such as the TalonSRX are not supported by Phoenix 6 and require usage of 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 Phoenix 5 devices.