mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
This is the changes made by Patrick Plenefisch converting the native code to use CMake and the CMake Maven Plugin, as opposed to the native Maven plugin. This is to allow for compatibility with newer versions of the GCC toolchain. All the cpp sources were moved from maven style directories to cpp style directories for CMake. Change-Id: I67f5e3608948f37c83b0990d232105a3784f8593
53 lines
1.5 KiB
C++
53 lines
1.5 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. */
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
#ifndef SERVO_H
|
|
#define SERVO_H
|
|
|
|
#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);
|
|
Servo(uint8_t moduleNumber, uint32_t channel);
|
|
virtual ~Servo();
|
|
void Set(float value);
|
|
void SetOffline();
|
|
float Get();
|
|
void SetAngle(float angle);
|
|
float GetAngle();
|
|
static float GetMaxAngle() { return kMaxServoAngle; };
|
|
static float GetMinAngle() { return kMinServoAngle; };
|
|
|
|
void ValueChanged(ITable* source, const std::string& key, EntryValue value, bool isNew);
|
|
void UpdateTable();
|
|
void StartLiveWindowMode();
|
|
void StopLiveWindowMode();
|
|
std::string GetSmartDashboardType();
|
|
void InitTable(ITable *subTable);
|
|
ITable * GetTable();
|
|
|
|
ITable *m_table;
|
|
|
|
private:
|
|
void InitServo();
|
|
float GetServoAngleRange() {return kMaxServoAngle - kMinServoAngle;}
|
|
|
|
static constexpr float kMaxServoAngle = 170.0;
|
|
static constexpr float kMinServoAngle = 0.0;
|
|
};
|
|
|
|
#endif
|
|
|