ExpansionHubCRServo
- class wpilib.ExpansionHubCRServo(usb_id: SupportsInt | SupportsIndex, channel: SupportsInt | SupportsIndex)
Bases:
pybind11_objectThis class controls a specific servo in continuous rotation mode hooked up to an ExpansionHub.
Constructs a continuous rotation servo at the requested channel on a specific USB port.
@sa ExpansionHubServo for a servo mode, or non-continuous rotation servo
- Parameters:
usb_id – The USB port ID the hub is connected to
channel – The servo channel
- is_hub_connected() bool
Gets if the underlying ExpansionHub is connected.
- Returns:
True if hub is connected, otherwise false
- set_enabled(enabled: bool) None
Sets if the servo output is enabled or not. Defaults to false.
- Parameters:
enabled – True to enable, false to disable
- set_frame_period(frame_period: wpimath.units.microseconds) None
Sets the frame period for the servo. Defaults to 20ms.
- Parameters:
frame_period – The frame period
- set_pulse_width(pulse_width: wpimath.units.microseconds) None
Sets the raw pulse width output on the servo.
- Parameters:
pulse_width – Pulse width
- set_pwm_range(min_pwm: wpimath.units.microseconds, max_pwm: wpimath.units.microseconds) None
Sets the PWM range for the servo. By default, this is 600 to 2400 microseconds.
Maximum must be greater than minimum.
- Parameters:
min_pwm – Minimum PWM
max_pwm – Maximum PWM
- set_reversed(reversed: bool) None
Sets whether the servo is reversed.
This will reverse SetThrottle.
- Parameters:
reversed – True to reverse, false for normal
- set_throttle(value: SupportsFloat | SupportsIndex) None
Set the servo throttle.
Throttle values range from -1.0 to 1.0 corresponding to full reverse to full forward.
- Parameters:
value – Throttle from -1.0 to 1.0.