Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
motor_interface.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_MOTOR_INTERFACE_HPP_
25#define TAPROOT_MOTOR_INTERFACE_HPP_
26
27#include <cstdint>
28
30
31namespace tap::motor
32{
34{
35public:
36 virtual void initialize() = 0;
38 virtual void setDesiredOutput(int32_t desiredOutput) = 0;
39 virtual bool isMotorOnline() const = 0;
40 virtual int16_t getOutputDesired() const = 0;
41 virtual int8_t getTemperature() const = 0;
42 virtual int16_t getTorque() const = 0;
43
44 [[deprecated]] virtual void resetEncoderValue() { this->getEncoder()->resetEncoderValue(); };
45 [[deprecated]] virtual float getPositionUnwrapped() const
46 {
47 return this->getEncoder()->getPosition().getUnwrappedValue();
48 };
49 [[deprecated]] virtual float getPositionWrapped() const
50 {
51 return this->getEncoder()->getPosition().getWrappedValue();
52 };
53 [[deprecated]] virtual int16_t getShaftRPM() const
54 {
55 return this->getEncoder()->getVelocity() / static_cast<float>(M_TWOPI) * 60.f;
56 };
57};
58
59} // namespace tap::motor
60
61#endif // TAPROOT_MOTOR_INTERFACE_HPP_
float getWrappedValue() const
Definition wrapped_float.hpp:294
float getUnwrappedValue() const
Definition wrapped_float.hpp:286
Definition encoder_interface.hpp:32
virtual void resetEncoderValue()=0
virtual float getVelocity() const =0
virtual tap::algorithms::WrappedFloat getPosition() const =0
Definition motor_interface.hpp:34
virtual int16_t getOutputDesired() const =0
virtual void setDesiredOutput(int32_t desiredOutput)=0
virtual float getPositionUnwrapped() const
Definition motor_interface.hpp:45
virtual tap::encoder::EncoderInterface * getEncoder() const =0
virtual int16_t getTorque() const =0
virtual bool isMotorOnline() const =0
virtual int8_t getTemperature() const =0
virtual int16_t getShaftRPM() const
Definition motor_interface.hpp:53
virtual float getPositionWrapped() const
Definition motor_interface.hpp:49
virtual void initialize()=0
virtual void resetEncoderValue()
Definition motor_interface.hpp:44
Definition dji_motor.cpp:41