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


Public Member Functions | |
| DjiMotor (Drivers *drivers, MotorId desMotorIdentifier, tap::can::CanBus motorCanBus, bool isInverted, const char *name, bool currentControl=false, float gearRatio=1, uint32_t encoderHomePosition=0, tap::encoder::EncoderInterface *externalEncoder=nullptr) | |
| mockable | ~DjiMotor () |
| void | initialize () override |
| tap::encoder::EncoderInterface * | getEncoder () const override |
| mockable const Encoder & | getInternalEncoder () const |
| void | processMessage (const modm::can::Message &message) override |
| void | setDesiredOutput (int32_t desiredOutput) override |
| bool | isMotorOnline () const override |
| mockable void | serializeCanSendData (modm::can::Message *txMessage) const |
| int16_t | getOutputDesired () const override |
| mockable uint32_t | getMotorIdentifier () const |
| int8_t | getTemperature () const override |
| int16_t | getTorque () const override |
| mockable bool | isMotorInverted () const |
| mockable tap::can::CanBus | getCanBus () const |
| mockable const char * | getName () const |
| mockable bool | isInCurrentControl () const |
Public Member Functions inherited from tap::can::CanRxListener | |
| CanRxListener (Drivers *drivers, uint32_t id, CanBus cB) | |
| ~CanRxListener () | |
| mockable void | attachSelfToRxHandler () |
Public Member Functions inherited from tap::motor::MotorInterface | |
| virtual void | resetEncoderValue () |
| virtual float | getPositionUnwrapped () const |
| virtual float | getPositionWrapped () const |
| virtual int16_t | getShaftRPM () const |
Static Public Attributes | |
| static constexpr uint16_t | MAX_OUTPUT_C610 = 10000 |
| static constexpr uint16_t | MAX_OUTPUT_C620 = 16384 |
| static constexpr uint16_t | MAX_OUTPUT_820R = 32767 |
| static constexpr uint16_t | MAX_OUTPUT_GM6020 = 25000 |
| static constexpr uint16_t | MAX_OUTPUT_GM3510 = 29000 |
Additional Inherited Members | |
Public Attributes inherited from tap::can::CanRxListener | |
| const uint32_t | canIdentifier |
| const CanBus | canBus |
| Drivers * | drivers |
A class designed to interface with 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).Extends the CanRxListener class to attach a message handler for feedback data from the motor to the CAN Rx dispatch handler.
initialize function in order for this class to work properly. | tap::motor::DjiMotor::DjiMotor | ( | Drivers * | drivers, |
| MotorId | desMotorIdentifier, | ||
| tap::can::CanBus | motorCanBus, | ||
| bool | isInverted, | ||
| const char * | name, | ||
| bool | currentControl = false, |
||
| float | gearRatio = 1, |
||
| uint32_t | encoderHomePosition = 0, |
||
| tap::encoder::EncoderInterface * | externalEncoder = nullptr |
||
| ) |
| drivers | a pointer to the drivers struct |
| desMotorIdentifier | the ID of this motor controller |
| motorCanBus | the CAN bus the motor is on |
| isInverted | if false the positive rotation direction of the shaft is counter-clockwise when looking at the shaft from the side opposite the motor. If true then the positive rotation direction will be clockwise. |
| name | a name to associate with the motor for use in the motor menu |
| gearRatio | the ratio of input revolutions to output revolutions of this encoder. |
| encoderHomePosition | the zero position for the encoder in encoder ticks. |
| externalEncoder | a pointer to an external encoder to average with the internal encoder. |
| tap::motor::DjiMotor::~DjiMotor | ( | ) |
| tap::can::CanBus tap::motor::DjiMotor::getCanBus | ( | ) | const |
|
inlineoverridevirtual |
Implements tap::motor::MotorInterface.
Returns the builtin encoder associated with the motor.
| uint32_t tap::motor::DjiMotor::getMotorIdentifier | ( | ) | const |
| const char * tap::motor::DjiMotor::getName | ( | ) | const |
|
overridevirtual |
desiredOutput value which will be sent to the motor controller (specified via setDesiredOutput()) Implements tap::motor::MotorInterface.
|
overridevirtual |
Implements tap::motor::MotorInterface.
|
overridevirtual |
Implements tap::motor::MotorInterface.
|
overridevirtual |
Implements tap::motor::MotorInterface.
| bool tap::motor::DjiMotor::isInCurrentControl | ( | ) | const |
| bool tap::motor::DjiMotor::isMotorInverted | ( | ) | const |
|
overridevirtual |
true if a CAN message has been received from the motor within the last MOTOR_DISCONNECT_TIME ms, false otherwise. Implements tap::motor::MotorInterface.
|
overridevirtual |
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. |
Implements tap::can::CanRxListener.
| void tap::motor::DjiMotor::serializeCanSendData | ( | modm::can::Message * | txMessage | ) | const |
Serializes send data and deposits it in a message to be sent.
|
overridevirtual |
Set the desired output for the motor. The meaning of this value is motor controller specific.
| [in] | desiredOutput | the desired motor output. Limited to the range of a 16-bit int. |
desiredOutput is cast to an int16_t and limited to an int16_t's range! The user should make sure their value is in range. The declaration takes an int32_t in hopes to mitigate overflow. Implements tap::motor::MotorInterface.
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |