Class DjiM2006¶
Defined in File dji_m2006.hpp
Nested Relationships¶
Nested Types¶
Inheritance Relationships¶
Base Type¶
public fang::motor::ISpeedMotor
Class Documentation¶
-
class DjiM2006 : public virtual fang::motor::ISpeedMotor¶
Wrapper for DJI motor for the DJI M3508 on a CAN bus
Public Functions
-
DjiM2006(Drivers &drivers, tap::motor::MotorId motorId, tap::can::CanBus canBus, const char *name, bool inverted, double gearRatio, const DjiSpeedPid::Config &speedConfig)¶
drivers - the drivers struct motorId - the motor controller id canBus - the can bus the motor controller is on name - the name of the motor for the controller menu gearRatio - the ratio of input revolutions per output revolution pid config: make sure the maxOutput does not exceed DjiM3508 k_maxOutput. This would lead to undefined behavior. An assertion has been placed to prevent the code from continuing.
-
mockable ~DjiM2006() = default¶
- mockable void initialize () override
It must be called for the motor to properly function.
- mockable void update () override
Must be called regularly to update the motor pid and set the motor output
- mockable void setTargetSpeed (const RPM &targetSpeed) override
Sets the desired speed for the pid to target
- mockable RPM getSpeed () const
Returns the last reported RPM from CAN
- mockable void setDesiredOutput (DjiMotorOutput desiredOutput)
The desired motor output. It must be limited to a 16 bit int.
- mockable bool isMotorOnline () const
true if a can message has been received within the last MOTOR_DISCONNECT_TIME.
- mockable Celsius getTemperature () const
Returns the reported temperature in celsius. The temperature was provided in an int8_t
- mockable tap::can::CanBus getCanBus () const
- mockable const char * getName () const
Public Static Attributes
-
static constexpr DjiMotorOutput k_maxOutput = {tap::motor::DjiMotor::MAX_OUTPUT_C610}¶
Maximum output for C610 controller.
-
static constexpr double k_factoryGearboxRatio = {tap::motor::DjiMotorEncoder::GEAR_RATIO_M2006}¶
gear ratio of the gearbox that usually ships with the motor.
-
struct Config¶
-
DjiM2006(Drivers &drivers, tap::motor::MotorId motorId, tap::can::CanBus canBus, const char *name, bool inverted, double gearRatio, const DjiSpeedPid::Config &speedConfig)¶