robotpy_toolkit_7407.motors package

Submodules

robotpy_toolkit_7407.motors.ctre_motors module

class robotpy_toolkit_7407.motors.ctre_motors.TalonConfig(k_P: float | None = None, k_I: float | None = None, k_D: float | None = None, k_F: float | None = None, closed_loop_peak_output: float | None = None, motion_cruise_velocity: float | None = None, motion_acceleration: float | None = None, neutral_brake: bool | None = None, integral_zone: float | None = None, max_integral_accumulator: float | None = None)

Bases: object

Configuration for a TalonSRX/Falcon motor controller

Args:

kP: Proportional gain kI: Integral gain kD: Derivative gain kF: Feedforward gain closed_loop_peak_output: The maximum output of the controller neutral_brake: Whether to brake or coast when the motor is not moving

closed_loop_peak_output: float | None = None
integral_zone: float | None = None
k_D: float | None = None
k_F: float | None = None
k_I: float | None = None
k_P: float | None = None
max_integral_accumulator: float | None = None
motion_acceleration: float | None = None
motion_cruise_velocity: float | None = None
neutral_brake: bool | None = None
class robotpy_toolkit_7407.motors.ctre_motors.TalonFX(can_id: int, inverted: bool = False, config: TalonConfig | None = None)

Bases: _Talon

TalonFX motor controller wrapper

init()

Initialize the motor controller

class robotpy_toolkit_7407.motors.ctre_motors.TalonGroup(*motors: _Talon, config: TalonConfig | None = None, leader_idx: int = 0)

Bases: PIDMotor

Group of Talon motor controllers. Used when multiple motors act as a single unit with a leader motor

get_sensor_position() float

Get the sensor position of the leader motor

Returns:

position (radians): Sensor position of the leader motor in radians

get_sensor_velocity() float

Get the sensor velocity of the leader motor Returns:

velocity (radians_per_second): Sensor velocity of the leader motor in radians per second

init()

Initialize the motor controllers

motors: list[robotpy_toolkit_7407.motors.ctre_motors._Talon]
set_leader_idx(idx: int)

Set the leader motor index (in the list of motors)

Args:

idx (int): Index of the leader motor

set_raw_output(x: float)

Set the raw output of the leader motor Args:

x (float): Raw output of the leader motor

set_sensor_position(pos: float)

Set the sensor position of the leader motor Args:

pos (radians): Sensor position of the leader motor in radians

set_target_position(pos: float)

Set the target position of the leader motor Args:

pos (radians): Target position of the leader motor in radians

set_target_velocity(vel: float)

Set the target velocity of the leader motor Args:

vel (radians_per_second): Target velocity of the leader motor in radians per second

class robotpy_toolkit_7407.motors.ctre_motors.TalonSRX(can_id: int, inverted: bool = False, config: TalonConfig | None = None)

Bases: _Talon

TalonSRX motor controller wrapper

init()

Initialize the motor controller

class robotpy_toolkit_7407.motors.ctre_motors.VictorSPX(can_id: int, inverted: bool = False, config: TalonConfig | None = None)

Bases: _Talon

VictorSPX motor controller wrapper

init()

Initialize the motor controller

robotpy_toolkit_7407.motors.rev_motors module

class robotpy_toolkit_7407.motors.rev_motors.SparkMax(can_id: int, inverted: bool = True, brushless: bool = True, config: SparkMaxConfig | None = None)

Bases: PIDMotor

Wrapper class for the SparkMax motor controller

get_sensor_position() float

Gets the sensor position of the motor controller in rotations

Returns:

(rotations): The sensor position of the motor controller in rotations

get_sensor_velocity() float

Gets the sensor velocity of the motor controller in rotations per second

Returns:

(rotations_per_second): The sensor velocity of the motor controller in rotations per second

init()

Initializes the motor controller, pid controller, and encoder

set_raw_output(x: float)

Sets the raw output of the motor controller

Args:

x (float): The output of the motor controller (between -1 and 1)

set_sensor_position(pos: float)

Sets the sensor position of the motor controller in rotations

Args:

pos (rotations): The sensor position of the motor controller in rotations

set_target_position(pos: float)

Sets the target position of the motor controller in rotations

Args:

pos (float): The target position of the motor controller in rotations

set_target_velocity(vel: float)

Sets the target velocity of the motor controller in rotations per second

Args:

vel (float): The target velocity of the motor controller in rotations per second

class robotpy_toolkit_7407.motors.rev_motors.SparkMaxConfig(k_P: float | None = None, k_I: float | None = None, k_D: float | None = None, k_F: float | None = None, output_range: tuple[float, float] | None = None, idle_mode: IdleMode | None = None)

Bases: object

Configuration for a SparkMax motor controller

Args:

kP: Proportional gain kI: Integral gain kD: Derivative gain kF: Feedforward gain output_range: The minimum and maximum output of the controller as (min: float, max: float) idle_mode: Whether to brake or coast when the motor is not moving

idle_mode: IdleMode | None = None
k_D: float | None = None
k_F: float | None = None
k_I: float | None = None
k_P: float | None = None
output_range: tuple[float, float] | None = None

Module contents