Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ on:
push:
branches:
- main
- '2027'
tags:
- '*'

jobs:
ci:
uses: robotpy/build-actions/.github/workflows/package-ci.yml@v2026
uses: robotpy/build-actions/.github/workflows/package-ci.yml@v2027
with:
artifactory_repo_type: vendor
enable_raspbian: false
Expand Down
23 changes: 13 additions & 10 deletions examples/can-arcade-drive/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,35 @@

import rev
import wpilib
from wpilib.drive import DifferentialDrive


class Robot(wpilib.TimedRobot):
def robotInit(self):
def __init__(self):
super().__init__()
# SPARK MAX controllers are intialized over CAN by constructing a
# CANSparkMax object
#
# The CAN ID, which can be configured using the SPARK MAX Client, is passed
# as the first parameter
# The CAN bus ID is passed as the first parameter, and the device ID,
# which can be configured using the SPARK MAX Client, is passed as the
# second parameter.
#
# The motor type is passed as the second parameter.
# The motor type is passed as the third parameter.
# Motor type can either be:
# rev.CANSparkMax.MotorType.kBrushless
# rev.CANSparkMax.MotorType.kBrushed
#
# The example below initializes four brushless motors with CAN IDs
# 1, 2, 3, 4. Change these parameters to match your setup
self.leftLeadMotor = rev.SparkMax(1, rev.SparkMax.MotorType.kBrushless)
self.rightLeadMotor = rev.SparkMax(3, rev.SparkMax.MotorType.kBrushless)
self.leftFollowMotor = rev.SparkMax(2, rev.SparkMax.MotorType.kBrushless)
self.rightFollowMotor = rev.SparkMax(4, rev.SparkMax.MotorType.kBrushless)
self.leftLeadMotor = rev.SparkMax(0, 1, rev.SparkMax.MotorType.kBrushless)
self.rightLeadMotor = rev.SparkMax(0, 3, rev.SparkMax.MotorType.kBrushless)
self.leftFollowMotor = rev.SparkMax(0, 2, rev.SparkMax.MotorType.kBrushless)
self.rightFollowMotor = rev.SparkMax(0, 4, rev.SparkMax.MotorType.kBrushless)

# Passing in the lead motors into DifferentialDrive allows any
# commmands sent to the lead motors to be sent to the follower motors.
self.driveTrain = DifferentialDrive(self.leftLeadMotor, self.rightLeadMotor)
self.driveTrain = wpilib.DifferentialDrive(
self.leftLeadMotor, self.rightLeadMotor
)
self.joystick = wpilib.Joystick(0)

# Create new SPARK MAX configuration objects. These will store the
Expand Down
17 changes: 9 additions & 8 deletions examples/can-tank-drive/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,27 @@

import rev
import wpilib
from wpilib.drive import DifferentialDrive


class Robot(wpilib.TimedRobot):
def robotInit(self):
def __init__(self):
super().__init__()
# SPARK MAX controllers are intialized over CAN by constructing a
# CANSparkMax object
#
# The CAN ID, which can be configured using the SPARK MAX Client, is passed
# as the first parameter
# The CAN bus ID is passed as the first parameter, and the device ID,
# which can be configured using the SPARK MAX Client, is passed as the
# second parameter.
#
# The motor type is passed as the second parameter.
# The motor type is passed as the third parameter.
# Motor type can either be:
# rev.CANSparkMax.MotorType.kBrushless
# rev.CANSparkMax.MotorType.kBrushed
#
# The example below initializes two brushless motors with CAN IDs
# 1 and 2. Change these parameters to match your setup
self.leftMotor = rev.SparkMax(1, rev.SparkMax.MotorType.kBrushless)
self.rightMotor = rev.SparkMax(2, rev.SparkMax.MotorType.kBrushless)
self.leftMotor = rev.SparkMax(0, 1, rev.SparkMax.MotorType.kBrushless)
self.rightMotor = rev.SparkMax(0, 2, rev.SparkMax.MotorType.kBrushless)

# Configure for factory defaults and invert right side motor
self.globalConfig = rev.SparkMaxConfig()
Expand All @@ -42,7 +43,7 @@ def robotInit(self):
rev.PersistMode.kPersistParameters,
)

self.driveTrain = DifferentialDrive(self.leftMotor, self.rightMotor)
self.driveTrain = wpilib.DifferentialDrive(self.leftMotor, self.rightMotor)
self.l_stick = wpilib.Joystick(0)
self.r_stick = wpilib.Joystick(1)

Expand Down
14 changes: 6 additions & 8 deletions examples/getting-started/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,20 @@
#

import wpilib
import wpilib.drive
import rev


class MyRobot(wpilib.TimedRobot):
def robotInit(self):
def __init__(self):
super().__init__()
"""
This function is called upon program startup and
should be used for any initialization code.
"""
self.leftDrive = rev.SparkMax(1, rev.SparkMax.MotorType.kBrushless)
self.rightDrive = rev.SparkMax(2, rev.SparkMax.MotorType.kBrushless)
self.robotDrive = wpilib.drive.DifferentialDrive(
self.leftDrive, self.rightDrive
)
self.controller = wpilib.XboxController(0)
self.leftDrive = rev.SparkMax(0, 1, rev.SparkMax.MotorType.kBrushless)
self.rightDrive = rev.SparkMax(0, 2, rev.SparkMax.MotorType.kBrushless)
self.robotDrive = wpilib.DifferentialDrive(self.leftDrive, self.rightDrive)
self.controller = wpilib.Gamepad(0)
self.timer = wpilib.Timer()

# We need to invert one side of the drivetrain so that positive voltages
Expand Down
13 changes: 7 additions & 6 deletions examples/limit-switch/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@


class Robot(wpilib.TimedRobot):
def robotInit(self):
def __init__(self):
super().__init__()
# Create motor
self.motor = rev.SparkMax(1, rev.SparkMax.MotorType.kBrushless)
self.motor = rev.SparkMax(0, 1, rev.SparkMax.MotorType.kBrushless)

self.joystick = wpilib.Joystick(0)

Expand Down Expand Up @@ -60,8 +61,8 @@ def robotInit(self):
)

def teleopPeriodic(self):
# Pair motor and the joystick's Y Axis
self.motor.set(self.joystick.getY())
# Pair motor output and the joystick's Y Axis
self.motor.setVoltage(self.joystick.getY() * 12)

# enable/disable limit switches based on value read from SmartDashboard
if self.prevForwardLimitEnabled != wpilib.SmartDashboard.getBoolean(
Expand Down Expand Up @@ -101,10 +102,10 @@ def teleopPeriodic(self):
# pressed. It will also return true if you do not have a switch
# connected. get() will return false when the switch is released.
wpilib.SmartDashboard.putBoolean(
"Forward Limit Switch", self.forwardLimit.get()
"Forward Limit Switch", self.forwardLimit.get().get()
)
wpilib.SmartDashboard.putBoolean(
"Reverse Limit Switch", self.reverseLimit.get()
"Reverse Limit Switch", self.reverseLimit.get().get()
)


Expand Down
6 changes: 3 additions & 3 deletions examples/run_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
script_dir = os.path.dirname(__file__)

robot_files = []
for root, dirs, files in os.walk("."):
for root, dirs, files in os.walk(script_dir):
if "robot.py" in files:
robot_files.append(os.path.relpath(root, "."))
robot_files.append(os.path.relpath(root, script_dir))

for file in robot_files:
print("found: " + file)
Expand All @@ -39,5 +39,5 @@
for test in TESTS:
print(f"Running test: {test}")
os.chdir(os.path.join(script_dir, test))
subprocess.run([sys.executable, "-m", "robotpy", "test", "--builtin"])
subprocess.check_call([sys.executable, "-m", "robotpy", "test", "--builtin"])
os.chdir(script_dir)
18 changes: 11 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ requires = [
"hatchling",
"hatch-vcs",
"semiwrap~=0.3.0",
"hatch-meson~=0.1.0",
"hatch-meson~=0.1.2",
"hatch-robotpy~=0.2.1",
"wpilib~=2026.2.1",
"wpilib==2027.0.0a6.post1",
]


Expand All @@ -16,7 +16,7 @@ dynamic = ["version"]
description = "REVLib for RobotPy"
license = "BSD-3-Clause"
dependencies = [
"wpilib>=2026.2.1,<2027",
"wpilib==2027.0.0a6.post1",
]

[[project.authors]]
Expand Down Expand Up @@ -44,23 +44,23 @@ packages = ["rev"]
artifact_id = "REVLib-cpp"
group_id = "com.revrobotics.frc"
repo_url = "https://maven.revrobotics.com"
version = "2026.0.4"
version = "2027.0.0-alpha-3"
staticlibs = ["REVLib"]
extract_to = "lib"

[[tool.hatch.build.hooks.robotpy.maven_lib_download]]
artifact_id = "REVLib-driver"
group_id = "com.revrobotics.frc"
repo_url = "https://maven.revrobotics.com"
version = "2026.0.4"
version = "2027.0.0-alpha-3"
staticlibs = [ "REVLibDriver"]
extract_to = "lib"

[[tool.hatch.build.hooks.robotpy.maven_lib_download]]
artifact_id = "RevLibBackendDriver"
group_id = "com.revrobotics.frc"
repo_url = "https://maven.revrobotics.com"
version = "2026.0.4"
version = "2027.0.0-alpha-3"
staticlibs = [
"BackendDriver",
]
Expand All @@ -71,7 +71,7 @@ use_headers = false
artifact_id = "RevLibWpiBackendDriver"
group_id = "com.revrobotics.frc"
repo_url = "https://maven.revrobotics.com"
version = "2026.0.4"
version = "2027.0.0-alpha-3"
staticlibs = [
"REVLibWpi",
]
Expand Down Expand Up @@ -145,6 +145,9 @@ includes = [

[tool.semiwrap.extension_modules."rev._rev".headers]

# first
A301 = "first/A301.h"

# rev
AbsoluteEncoder = "rev/AbsoluteEncoder.h"
AnalogInput = "rev/AnalogInput.h"
Expand Down Expand Up @@ -236,4 +239,5 @@ SparkRelativeEncoderSim = "rev/sim/SparkRelativeEncoderSim.h"
SparkSimFaultManager = "rev/sim/SparkSimFaultManager.h"

# rev/util
Signal = "rev/util/Signal.h"
StatusLogger = "rev/util/StatusLogger.h"
64 changes: 64 additions & 0 deletions rev/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

# autogenerated by 'semiwrap create-imports rev rev._rev'
from ._rev import (
A301,
AbsoluteEncoder,
AbsoluteEncoderConfig,
AbsoluteEncoderConfigAccessor,
Expand All @@ -25,6 +26,7 @@
DetachedEncoderLowLevel,
DetachedEncoderSim,
DetachedSignalsConfig,
DetachedSignalsConfigAccessor,
EncoderConfig,
EncoderConfigAccessor,
ExternalEncoderConfig,
Expand Down Expand Up @@ -52,6 +54,36 @@
ServoHubParameter,
ServoHubSim,
ServoHubSimFaultManager,
Signal_A301Faults,
Signal_A301Warnings,
Signal_ClosedLoopSlot,
Signal_DetachedFaults,
Signal_DetachedPeriodicStatus1,
Signal_DetachedPeriodicStatus2,
Signal_DetachedPeriodicStatus3,
Signal_DetachedPeriodicStatus4,
Signal_ServoHubFaults,
Signal_ServoHubPeriodicStatus0,
Signal_ServoHubPeriodicStatus1,
Signal_ServoHubPeriodicStatus2,
Signal_ServoHubPeriodicStatus3,
Signal_ServoHubPeriodicStatus4,
Signal_ServoHubWarnings,
Signal_SparkFaults,
Signal_SparkPeriodicStatus0,
Signal_SparkPeriodicStatus1,
Signal_SparkPeriodicStatus2,
Signal_SparkPeriodicStatus3,
Signal_SparkPeriodicStatus4,
Signal_SparkPeriodicStatus5,
Signal_SparkPeriodicStatus6,
Signal_SparkPeriodicStatus7,
Signal_SparkPeriodicStatus8,
Signal_SparkPeriodicStatus9,
Signal_SparkWarnings,
Signal_bool,
Signal_double,
Signal_int,
SignalsConfig,
SignalsConfigAccessor,
SoftLimitConfig,
Expand Down Expand Up @@ -90,6 +122,7 @@
)

__all__ = [
"A301",
"AbsoluteEncoder",
"AbsoluteEncoderConfig",
"AbsoluteEncoderConfigAccessor",
Expand All @@ -111,6 +144,7 @@
"DetachedEncoderLowLevel",
"DetachedEncoderSim",
"DetachedSignalsConfig",
"DetachedSignalsConfigAccessor",
"EncoderConfig",
"EncoderConfigAccessor",
"ExternalEncoderConfig",
Expand Down Expand Up @@ -138,6 +172,36 @@
"ServoHubParameter",
"ServoHubSim",
"ServoHubSimFaultManager",
"Signal_A301Faults",
"Signal_A301Warnings",
"Signal_ClosedLoopSlot",
"Signal_DetachedFaults",
"Signal_DetachedPeriodicStatus1",
"Signal_DetachedPeriodicStatus2",
"Signal_DetachedPeriodicStatus3",
"Signal_DetachedPeriodicStatus4",
"Signal_ServoHubFaults",
"Signal_ServoHubPeriodicStatus0",
"Signal_ServoHubPeriodicStatus1",
"Signal_ServoHubPeriodicStatus2",
"Signal_ServoHubPeriodicStatus3",
"Signal_ServoHubPeriodicStatus4",
"Signal_ServoHubWarnings",
"Signal_SparkFaults",
"Signal_SparkPeriodicStatus0",
"Signal_SparkPeriodicStatus1",
"Signal_SparkPeriodicStatus2",
"Signal_SparkPeriodicStatus3",
"Signal_SparkPeriodicStatus4",
"Signal_SparkPeriodicStatus5",
"Signal_SparkPeriodicStatus6",
"Signal_SparkPeriodicStatus7",
"Signal_SparkPeriodicStatus8",
"Signal_SparkPeriodicStatus9",
"Signal_SparkWarnings",
"Signal_bool",
"Signal_double",
"Signal_int",
"SignalsConfig",
"SignalsConfigAccessor",
"SoftLimitConfig",
Expand Down
Loading
Loading