![]() |
WPILibC++ 2027.0.0-alpha-2
|
Standard hobby style servo. More...
#include <frc/Servo.h>
Public Member Functions | |
Servo (int channel) | |
Constructor. | |
Servo (Servo &&)=default | |
Servo & | operator= (Servo &&)=default |
void | Set (double value) |
Set the servo position. | |
double | Get () const |
Get the servo position. | |
void | SetAngle (double angle) |
Set the servo angle. | |
double | GetAngle () const |
Get the servo angle. | |
int | GetChannel () const |
void | InitSendable (wpi::SendableBuilder &builder) override |
Initializes this Sendable object. | |
![]() | |
virtual constexpr | ~Sendable ()=default |
![]() | |
constexpr | SendableHelper (const SendableHelper &rhs)=default |
constexpr | SendableHelper (SendableHelper &&rhs) |
constexpr SendableHelper & | operator= (const SendableHelper &rhs)=default |
constexpr SendableHelper & | operator= (SendableHelper &&rhs) |
Friends | |
class | frc::sim::ServoSim |
Additional Inherited Members | |
![]() | |
constexpr | SendableHelper ()=default |
constexpr | ~SendableHelper () |
Standard hobby style servo.
The range parameters default to the appropriate values for the Hitec HS-322HD servo provided in the FIRST Kit of Parts in 2008.
|
explicit |
|
default |
double frc::Servo::Get | ( | ) | const |
Get the servo position.
Servo values range from 0.0 to 1.0 corresponding to the range of full left to full right. This returns the commanded position, not the position that the servo is actually at, as the servo does not report its own position.
double frc::Servo::GetAngle | ( | ) | const |
Get the servo angle.
This returns the commanded angle, not the angle that the servo is actually at, as the servo does not report its own angle.
int frc::Servo::GetChannel | ( | ) | const |
|
overridevirtual |
void frc::Servo::Set | ( | double | value | ) |
Set the servo position.
Servo values range from 0.0 to 1.0 corresponding to the range of full left to full right.
value | Position from 0.0 to 1.0. |
void frc::Servo::SetAngle | ( | double | angle | ) |
Set the servo angle.
The angles are based on the HS-322HD Servo, and have a range of 0 to 180 degrees.
Servo angles that are out of the supported range of the servo simply "saturate" in that direction. In other words, if the servo has a range of (X degrees to Y degrees) than angles of less than X result in an angle of X being set and angles of more than Y degrees result in an angle of Y being set.
angle | The angle in degrees to set the servo. |
|
friend |