mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
They were either replaced with delegating constructors or merged into the only constructor in the class. Change-Id: I3d35139f6ab23c719433a9f76942b02a3b07ddac
51 lines
1.6 KiB
C++
51 lines
1.6 KiB
C++
/*----------------------------------------------------------------------------*/
|
|
/* Copyright (c) FIRST 2008. All Rights Reserved.
|
|
*/
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
|
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
|
|
/*----------------------------------------------------------------------------*/
|
|
#pragma once
|
|
|
|
#include "SafePWM.h"
|
|
#include "SpeedController.h"
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
class Servo : public SafePWM {
|
|
public:
|
|
explicit Servo(uint32_t channel);
|
|
virtual ~Servo();
|
|
void Set(float value);
|
|
void SetOffline();
|
|
float Get() const;
|
|
void SetAngle(float angle);
|
|
float GetAngle() const;
|
|
static float GetMaxAngle() { return kMaxServoAngle; }
|
|
static float GetMinAngle() { return kMinServoAngle; }
|
|
|
|
void ValueChanged(ITable* source, const std::string& key, EntryValue value,
|
|
bool isNew) override;
|
|
void UpdateTable() override;
|
|
void StartLiveWindowMode() override;
|
|
void StopLiveWindowMode() override;
|
|
std::string GetSmartDashboardType() const override;
|
|
void InitTable(ITable* subTable) override;
|
|
ITable* GetTable() const override;
|
|
|
|
ITable* m_table = nullptr;
|
|
|
|
private:
|
|
float GetServoAngleRange() const { return kMaxServoAngle - kMinServoAngle; }
|
|
|
|
static constexpr float kMaxServoAngle = 180.0;
|
|
static constexpr float kMinServoAngle = 0.0;
|
|
|
|
static constexpr float kDefaultMaxServoPWM = 2.4;
|
|
static constexpr float kDefaultMinServoPWM = .6;
|
|
};
|