|
Fang-Robotics-MCB
Fang Robotics Team Codebase
|
#include <dji_motor_encoder.hpp>


Public Member Functions | |
| DjiMotorEncoder (bool isInverted, float gearRatio=1, uint32_t encoderHomePosition=0) | |
| void | initialize () override |
| bool | isOnline () const override |
| float | getVelocity () const override |
| mockable int16_t | getShaftRPM () const |
| mockable void | processMessage (const modm::can::Message &message) |
Public Member Functions inherited from tap::encoder::WrappedEncoder | |
| WrappedEncoder (bool isInverted, uint32_t encoderResolution, float gearRatio=1, uint32_t encoderHomePosition=0) | |
| void | initialize () override |
| tap::algorithms::WrappedFloat | getPosition () const override |
| mockable tap::algorithms::WrappedFloat | getEncoder () const |
| float | getVelocity () const override |
| void | alignWith (EncoderInterface *other) override |
| void | resetEncoderValue () override |
Static Public Attributes | |
| static constexpr uint16_t | ENC_RESOLUTION = 8192 |
| static constexpr float | GEAR_RATIO_M3508 = 3591.0f / 187.0f |
| static constexpr float | GEAR_RATIO_GM3510_L1 = 3.7f / 1.0f |
| static constexpr float | GEAR_RATIO_GM3510_L2 = 5.2f / 1.0f |
| static constexpr float | GEAR_RATIO_GM3510_L3 = 19.0f / 1.0f |
| static constexpr float | GEAR_RATIO_GM3510_L4 = 27.0f / 1.0f |
| static constexpr float | GEAR_RATIO_M2006 = 36.0f / 1.0f |
| static constexpr float | GEAR_RATIO_GM6020 = 1.0f / 1.0f |
Additional Inherited Members | |
Protected Member Functions inherited from tap::encoder::WrappedEncoder | |
| void | updateEncoderValue (uint32_t encoderActual) |
Protected Attributes inherited from tap::encoder::WrappedEncoder | |
| tap::algorithms::WrappedFloat | encoder |
| tap::algorithms::WrappedFloat | position |
| bool | inverted |
| const uint32_t | encoderResolution |
| const float | gearRatio |
A class designed to interface with the encoder for DJI brand motors and motor controllers over CAN. This includes the C610 and C620 motor controllers and the GM6020 motor (that has a built-in motor controller).
this->isMotorInverted() == false) is counter clockwise when looking at the shaft from the side opposite the motor. This is specified in the C620 user manual (page 18).DJI motor encoders store a consistent encoding for a given angle across power-cycles. This means the encoder angle reported by the motor can have meaning if the encoding for an angle is unique as it is for the GM6020s. However for geared motors like the M3508 where a full encoder revolution does not correspond 1:1 to a shaft revolution, it is impossible to know the orientation of the shaft given just the encoder value.
Combining them with some form of absolute encoder on the output shaft would give you knowledge of the orientation of the output shaft.
| tap::motor::DjiMotorEncoder::DjiMotorEncoder | ( | bool | isInverted, |
| float | gearRatio = 1, |
||
| uint32_t | encoderHomePosition = 0 |
||
| ) |
| isInverted | if false the positive rotation direction of the shaft is counter-clockwise when looking at the shaft from. If true then the positive rotation direction will be clockwise. |
| encoderResolution | the number of encoder ticks before the value wraps. |
| gearRatio | the ratio of input revolutions to output revolutions of this encoder. |
| encoderHomePosition | the zero position for the encoder in encoder ticks. |
| int16_t tap::motor::DjiMotorEncoder::getShaftRPM | ( | ) | const |
The current RPM reported by the motor controller.
|
overridevirtual |
Gets the current velocity reported by the encoder. Returned in a value of radians / second
Implements tap::encoder::EncoderInterface.
|
inlineoverridevirtual |
Initialize the encoder. For instance: attaching a can receiver.
Implements tap::encoder::EncoderInterface.
|
overridevirtual |
Returns true when the encoder is online and reporting valid values.
Implements tap::encoder::EncoderInterface.
| void tap::motor::DjiMotorEncoder::processMessage | ( | const modm::can::Message & | message | ) |
Overrides virtual method in the can class, called every time a message with the CAN message id this class is attached to is received by the can receive handler. Parses the data in the message and updates this class's fields accordingly.
| [in] | message | the message to be processed. |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |