This class controls a specific servo in continuous rotation mode hooked up to an ExpansionHub.
More...
#include <wpi/hardware/expansionhub/ExpansionHubCRServo.hpp>
|
| | ExpansionHubCRServo (int usbId, int channel) |
| | Constructs a continuous rotation servo at the requested channel on a specific USB port.
|
| | ~ExpansionHubCRServo () noexcept |
| void | SetThrottle (double value) |
| | Set the servo throttle.
|
| void | SetPulseWidth (wpi::units::microsecond_t pulseWidth) |
| | Sets the raw pulse width output on the servo.
|
| void | SetEnabled (bool enabled) |
| | Sets if the servo output is enabled or not.
|
| void | SetFramePeriod (wpi::units::microsecond_t framePeriod) |
| | Sets the frame period for the servo.
|
| bool | IsHubConnected () const |
| | Gets if the underlying ExpansionHub is connected.
|
| void | SetPWMRange (wpi::units::microsecond_t minPwm, wpi::units::microsecond_t maxPwm) |
| | Sets the PWM range for the servo.
|
| void | SetReversed (bool reversed) |
| | Sets whether the servo is reversed.
|
This class controls a specific servo in continuous rotation mode hooked up to an ExpansionHub.
◆ ExpansionHubCRServo()
| wpi::ExpansionHubCRServo::ExpansionHubCRServo |
( |
int | usbId, |
|
|
int | channel ) |
Constructs a continuous rotation servo at the requested channel on a specific USB port.
- See also
- ExpansionHubServo for a servo mode, or non-continuous rotation servo
- Parameters
-
| usbId | The USB port ID the hub is connected to |
| channel | The servo channel |
◆ ~ExpansionHubCRServo()
| wpi::ExpansionHubCRServo::~ExpansionHubCRServo |
( |
| ) |
|
|
noexcept |
◆ IsHubConnected()
| bool wpi::ExpansionHubCRServo::IsHubConnected |
( |
| ) |
const |
|
inline |
Gets if the underlying ExpansionHub is connected.
- Returns
- True if hub is connected, otherwise false
◆ SetEnabled()
| void wpi::ExpansionHubCRServo::SetEnabled |
( |
bool | enabled | ) |
|
Sets if the servo output is enabled or not.
Defaults to false.
- Parameters
-
| enabled | True to enable, false to disable |
◆ SetFramePeriod()
| void wpi::ExpansionHubCRServo::SetFramePeriod |
( |
wpi::units::microsecond_t | framePeriod | ) |
|
Sets the frame period for the servo.
Defaults to 20ms.
- Parameters
-
| framePeriod | The frame period |
◆ SetPulseWidth()
| void wpi::ExpansionHubCRServo::SetPulseWidth |
( |
wpi::units::microsecond_t | pulseWidth | ) |
|
Sets the raw pulse width output on the servo.
- Parameters
-
◆ SetPWMRange()
| void wpi::ExpansionHubCRServo::SetPWMRange |
( |
wpi::units::microsecond_t | minPwm, |
|
|
wpi::units::microsecond_t | maxPwm ) |
Sets the PWM range for the servo.
By default, this is 600 to 2400 microseconds.
Maximum must be greater than minimum.
- Parameters
-
| minPwm | Minimum PWM |
| maxPwm | Maximum PWM |
◆ SetReversed()
| void wpi::ExpansionHubCRServo::SetReversed |
( |
bool | reversed | ) |
|
Sets whether the servo is reversed.
This will reverse SetThrottle.
- Parameters
-
| reversed | True to reverse, false for normal |
◆ SetThrottle()
| void wpi::ExpansionHubCRServo::SetThrottle |
( |
double | value | ) |
|
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. |
The documentation for this class was generated from the following file: