Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
trap::motor::DjiM2006Old Class Reference

#include <dji_m2006_old.hpp>

Inheritance diagram for trap::motor::DjiM2006Old:
Collaboration diagram for trap::motor::DjiM2006Old:

Classes

struct  Config
 

Public Member Functions

 DjiM2006Old (Drivers &drivers, const Config &config)
 
 DjiM2006Old (Drivers &drivers, tap::motor::MotorId motorId, tap::can::CanBus canBus, const char *name, bool inverted, double gearRatio, const DjiSpeedPid::Config &speedConfig)
 
mockable ~DjiM2006Old ()=default
 
mockable void initialize () override
 
mockable void update () override
 
mockable void setTargetSpeed (const RPM &targetSpeed) override
 
mockable RPM getSpeed () const
 
mockable void setDesiredOutput (DjiMotorOutput desiredOutput)
 
mockable bool isMotorOnline () const
 
mockable Celsius getTemperature () const
 
mockable tap::can::CanBus getCanBus () const
 
mockable const char * getName () const
 

Static Public 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.
 

Detailed Description

Wrapper for DJI motor for the DJI M3508 on a CAN bus

Constructor & Destructor Documentation

◆ DjiM2006Old() [1/2]

trap::motor::DjiM2006Old::DjiM2006Old ( Drivers drivers,
const Config config 
)

◆ DjiM2006Old() [2/2]

trap::motor::DjiM2006Old::DjiM2006Old ( 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.

◆ ~DjiM2006Old()

mockable trap::motor::DjiM2006Old::~DjiM2006Old ( )
default

Member Function Documentation

◆ getCanBus()

tap::can::CanBus trap::motor::DjiM2006Old::getCanBus ( ) const

◆ getName()

const char * trap::motor::DjiM2006Old::getName ( ) const

◆ getSpeed()

RPM trap::motor::DjiM2006Old::getSpeed ( ) const

Returns the last reported RPM from CAN

◆ getTemperature()

Celsius trap::motor::DjiM2006Old::getTemperature ( ) const

Returns the reported temperature in celsius. The temperature was provided in an int8_t

◆ initialize()

void trap::motor::DjiM2006Old::initialize ( )
override

It must be called for the motor to properly function.

◆ isMotorOnline()

bool trap::motor::DjiM2006Old::isMotorOnline ( ) const

true if a can message has been received within the last MOTOR_DISCONNECT_TIME.

◆ setDesiredOutput()

void trap::motor::DjiM2006Old::setDesiredOutput ( DjiMotorOutput  desiredOutput)

The desired motor output. It must be limited to a 16 bit int.

◆ setTargetSpeed()

void trap::motor::DjiM2006Old::setTargetSpeed ( const RPM targetSpeed)
override

Sets the desired speed for the pid to target

◆ update()

void trap::motor::DjiM2006Old::update ( )
override

Must be called regularly to update the motor pid and set the motor output

Member Data Documentation

◆ k_factoryGearboxRatio

constexpr double trap::motor::DjiM2006Old::k_factoryGearboxRatio {tap::motor::DjiMotorEncoder::GEAR_RATIO_M2006}
staticconstexpr

gear ratio of the gearbox that usually ships with the motor.

◆ k_maxOutput

constexpr DjiMotorOutput trap::motor::DjiM2006Old::k_maxOutput {tap::motor::DjiMotor::MAX_OUTPUT_C610}
staticconstexpr

Maximum output for C610 controller.


The documentation for this class was generated from the following files: