Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
servo.hpp
Go to the documentation of this file.
1/*****************************************************************************/
2/********** !!! WARNING: CODE GENERATED BY TAPROOT. DO NOT EDIT !!! **********/
3/*****************************************************************************/
4
5/*
6 * Copyright (c) 2020-2021 Advanced Robotics at the University of Washington <robomstr@uw.edu>
7 *
8 * This file is part of Taproot.
9 *
10 * Taproot is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * Taproot is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with Taproot. If not, see <https://www.gnu.org/licenses/>.
22 */
23
24#ifndef TAPROOT_SERVO_HPP_
25#define TAPROOT_SERVO_HPP_
26
29
30namespace tap
31{
32class Drivers;
33namespace motor
34{
40class Servo
41{
42public:
56 Servo(
57 Drivers *drivers,
58 tap::gpio::Pwm::Pin currpwmPinPort,
59 float maximumPwm,
60 float minimumPwm,
61 float pwmRampSpeed);
62
68 void setTargetPwm(float PWM);
69
74 void updateSendPwmRamp();
75
79 float getPWM() const;
80
84 float getMinPWM() const;
85
89 float getMaxPWM() const;
90
95 bool isRampTargetMet() const;
96
97private:
99
101 tap::algorithms::Ramp pwmOutputRamp;
102
104 float maxPwm;
105
107 float minPwm;
108
110 float currentPwm;
111
113 float pwmRampSpeed;
114
116 uint32_t prevTime = 0;
117
119 tap::gpio::Pwm::Pin servoPin;
120}; // class Servo
121
122} // namespace motor
123
124} // namespace tap
125
126#endif // TAPROOT_SERVO_HPP_
Definition drivers.hpp:70
Definition ramp.hpp:43
Pin
Definition pwm.hpp:59
Definition servo.hpp:41
float getMinPWM() const
Definition servo.cpp:74
void updateSendPwmRamp()
Definition servo.cpp:63
float getMaxPWM() const
Definition servo.cpp:76
void setTargetPwm(float PWM)
Definition servo.cpp:57
float getPWM() const
Definition servo.cpp:72
bool isRampTargetMet() const
Definition servo.cpp:78
Definition brushlessutils.cpp:4
Definition ballistics.cpp:29
tap::Drivers Drivers
Definition drivers.hpp:11
fang::Drivers & drivers
Definition robot_singleton.cpp:45