14 #include "SpeedController.h"
27 explicit Servo(
int channel);
29 void Set(
double value);
34 static double GetMaxAngle() {
return kMaxServoAngle; }
35 static double GetMinAngle() {
return kMinServoAngle; }
38 std::shared_ptr<nt::Value> value,
bool isNew)
override;
43 void InitTable(std::shared_ptr<ITable> subTable)
override;
44 std::shared_ptr<ITable>
GetTable()
const override;
46 std::shared_ptr<ITable> m_table;
49 double GetServoAngleRange()
const {
return kMaxServoAngle - kMinServoAngle; }
51 static constexpr
double kMaxServoAngle = 180.0;
52 static constexpr
double kMinServoAngle = 0.0;
54 static constexpr
double kDefaultMaxServoPWM = 2.4;
55 static constexpr
double kDefaultMinServoPWM = .6;
Standard hobby style servo.
Definition: Servo.h:25
A table whose values can be read and written to.
Definition: ITable.h:22
double GetAngle() const
Get the servo angle.
Definition: Servo.cpp:99
void UpdateTable() override
Update the table for this sendable object with the latest values.
Definition: Servo.cpp:109
std::string GetSmartDashboardType() const override
Definition: Servo.cpp:127
std::shared_ptr< ITable > GetTable() const override
Definition: Servo.cpp:134
void InitTable(std::shared_ptr< ITable > subTable) override
Initializes a table for this sendable object.
Definition: Servo.cpp:129
double Get() const
Get the servo position.
Definition: Servo.cpp:65
void SetAngle(double angle)
Set the servo angle.
Definition: Servo.cpp:81
void Set(double value)
Set the servo position.
Definition: Servo.cpp:48
void StopLiveWindowMode() override
Stop having this sendable object automatically respond to value changes.
Definition: Servo.cpp:121
void StartLiveWindowMode() override
Start having this sendable object automatically respond to value changes reflect the value on the tab...
Definition: Servo.cpp:115
A safe version of the PWM class.
Definition: SafePWM.h:26
void SetOffline()
Set the servo to offline.
Definition: Servo.cpp:55
Servo(int channel)
Definition: Servo.cpp:24
void ValueChanged(ITable *source, llvm::StringRef key, std::shared_ptr< nt::Value > value, bool isNew) override
Called when a key-value pair is changed in a ITable.
Definition: Servo.cpp:103