Skip to content

Commit

Permalink
Rename 'ctre' package to 'phoenix5'
Browse files Browse the repository at this point in the history
- Will be more consistent for users in the future
  • Loading branch information
virtuald committed Nov 12, 2023
1 parent 082fe2a commit 126e0a4
Show file tree
Hide file tree
Showing 34 changed files with 98 additions and 98 deletions.
18 changes: 9 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ __pycache__/
*$py.class

# C extensions
/ctre/_init_ctre.py
/ctre/pkgcfg.py
/ctre/rpy-include
/ctre/version.py
/ctre/py.typed

/ctre/_*/_init_*.py
/ctre/_*/pkgcfg.py
/ctre/_*/include
/phoenix5/_init_ctre.py
/phoenix5/pkgcfg.py
/phoenix5/rpy-include
/phoenix5/version.py
/phoenix5/py.typed

/phoenix5/_*/_init_*.py
/phoenix5/_*/pkgcfg.py
/phoenix5/_*/include


# Distribution / packaging
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
robotpy-ctre
============

This is a python wrapper around the CTRE Phoenix library. The RobotPy project
This is a python wrapper around the CTRE Phoenix v5 API. The RobotPy project
is not associated with or endorsed by Cross The Road Electronics.

**NOTE**: CTRE only supports simulation for the following platforms:
Expand Down
6 changes: 3 additions & 3 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ and we'll try to address the problem.

.. toctree::

ctre
ctre.led
ctre.sensors
phoenix5
phoenix5.led
phoenix5.sensors
8 changes: 4 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from os.path import abspath, join, dirname

import ctre
import phoenix5

# -- RTD configuration ------------------------------------------------

Expand Down Expand Up @@ -136,6 +136,6 @@

root = abspath(dirname(__file__))

gen_package(root, "ctre")
gen_package(root, "ctre.led")
gen_package(root, "ctre.sensors")
gen_package(root, "phoenix5")
gen_package(root, "phoenix5.led")
gen_package(root, "phoenix5.sensors")
4 changes: 2 additions & 2 deletions examples/basic/robot.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3

import wpilib
import ctre
import phoenix5


class MyRobot(wpilib.TimedRobot):
Expand All @@ -11,7 +11,7 @@ class MyRobot(wpilib.TimedRobot):
"""

def robotInit(self):
self.motor = ctre.WPI_TalonSRX(1) # Initialize the TalonSRX on device 1.
self.motor = phoenix5.WPI_TalonSRX(1) # Initialize the TalonSRX on device 1.

def disabledPeriodic(self):
self.motor.disable()
Expand Down
6 changes: 3 additions & 3 deletions examples/getting-started/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import wpilib
import wpilib.drive
import ctre
import phoenix5


class MyRobot(wpilib.TimedRobot):
Expand All @@ -16,8 +16,8 @@ def robotInit(self):
This function is called upon program startup and
should be used for any initialization code.
"""
self.leftDrive = ctre.WPI_TalonFX(1)
self.rightDrive = ctre.WPI_TalonFX(2)
self.leftDrive = phoenix5.WPI_TalonFX(1)
self.rightDrive = phoenix5.WPI_TalonFX(2)
self.robotDrive = wpilib.drive.DifferentialDrive(
self.leftDrive, self.rightDrive
)
Expand Down
2 changes: 1 addition & 1 deletion examples/motion_magic/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* use button1 to motion-magic servo to target position specified by the gamepad stick.
"""

from ctre import WPI_TalonSRX
from phoenix5 import WPI_TalonSRX
import wpilib


Expand Down
12 changes: 6 additions & 6 deletions examples/position_closed_loop/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Tweak the PID gains accordingly.
"""

import ctre
import phoenix5
import wpilib


Expand All @@ -37,7 +37,7 @@ class Robot(wpilib.TimedRobot):
kTimeoutMs = 10

def robotInit(self):
self.talon = ctre.WPI_TalonSRX(3)
self.talon = phoenix5.WPI_TalonSRX(3)
self.joy = wpilib.Joystick(0)

self.loops = 0
Expand All @@ -46,7 +46,7 @@ def robotInit(self):

# choose the sensor and sensor direction
self.talon.configSelectedFeedbackSensor(
ctre.FeedbackDevice.CTRE_MagEncoder_Relative,
phoenix5.FeedbackDevice.CTRE_MagEncoder_Relative,
self.kPIDLoopIdx,
self.kTimeoutMs,
)
Expand Down Expand Up @@ -106,14 +106,14 @@ def teleopPeriodic(self):

# 10 Rotations * 4096 u/rev in either direction
self.targetPos = leftYstick * 4096 * 10.0
self.talon.set(ctre.ControlMode.Position, self.targetPos)
self.talon.set(phoenix5.ControlMode.Position, self.targetPos)

# on button2 just straight drive
if button2:
# Percent voltage mode
self.talon.set(ctre.ControlMode.PercentOutput, leftYstick)
self.talon.set(phoenix5.ControlMode.PercentOutput, leftYstick)

if self.talon.getControlMode() == ctre.ControlMode.Position:
if self.talon.getControlMode() == phoenix5.ControlMode.Position:
# append more signals to print when in speed mode.
sb.append("\terr: %s" % self.talon.getClosedLoopError(self.kPIDLoopIdx))
sb.append("\ttrg: %.3f" % self.targetPos)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

_root = abspath(dirname(phoenix6.__file__))

libinit_import = "ctre._init_phoenix6"
libinit_import = "phoenix5._init_phoenix6"
depends = []
pypi_package = "phoenix6"

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 126e0a4

Please sign in to comment.