API Overview#
The Phoenix 6 API resides in the com.ctre.phoenix6
package in Java and the ctre::phoenix6
namespace in C++. The API is then further organized into smaller packages and namespaces that group together similar types of classes and functions:
configs
- classes related to device configurationcontrols
- classes related to device controlhardware
- the device hardware classes, such asTalonFX
signals
- enumeration types for device signalssim
- classes related to device simulation
C++ IntelliSense#
In C++, this namespace structure has the advantage of cleaning up IntelliSense when searching for classes:
// first use the ctre::phoenix6 namespace
using namespace ctre::phoenix6;
// now types are organized cleanly by namespace
hardware::TalonFX m_talonFX{0};
sim::TalonFXSimState& m_talonFXSim{m_talonFX.GetSimState()};
configs::TalonFXConfiguration m_talonFXConfig{};
signals::InvertedValue m_talonFXInverted{signals::InvertedValue::CounterClockwise_Positive};
controls::DutyCycleOut m_talonFXOut{0};
All C++ code examples in this documentation will assume the presence of using namespace ctre::phoenix6;
.