TR-mbed 1.0
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
DJIMotor Class Reference

#include <DJIMotor.h>

Classes

struct  config
 

Public Types

enum  motorMoveMode {
  OFF , POS , SPD , POW ,
  ERR
}
 

Public Member Functions

 DJIMotor (bool isErroneousMotor=false)
 
 DJIMotor (short motorID, CANHandler::CANBus canBus, motorType type=STANDARD, const std::string &name="NO_NAME")
 
 DJIMotor (config cfg)
 
 ~DJIMotor ()
 
float getData (motorDataType data)
 
void setMotorOutput (int val, motorMoveMode mod)
 
void setPower (int power)
 
void setSpeed (float speed)
 
void setPosition (float position)
 
motorMoveMode getMode ()
 
 __attribute__ ((unused)) inline bool isConnected() const
 
int operator>> (motorDataType data)
 
 DJIMotor (const DJIMotor &)=delete
 
DJIMotoroperator= (const DJIMotor &)=delete
 
void setPositionPID (float kP, float kI, float kD)
 
void setPositionIntegralCap (double cap)
 
void setPositionOutputCap (double cap)
 
void setSpeedPID (float kP, float kI, float kD)
 
void setSpeedIntegralCap (double cap)
 
void setSpeedDerivativeCap (double cap)
 
void setSpeedOutputCap (double cap)
 
float calculateSpeedPID (float desired, float current, double dt)
 
float calculatePositionPID (float desired, float current, double dt)
 
float calculatePeriodicPosition (float dE, double dt)
 

Static Public Member Functions

static int calculateDeltaPhase (int target, int current, int max=TICKS_REVOLUTION)
 
static float calculateDeltaPhase (float target, float current, float max)
 
static void setCanHandlers (CANHandler *can_1, CANHandler *can_2)
 
static void getCan1Feedback (const CANMsg *msg)
 
static void getCan2Feedback (const CANMsg *msg)
 
static void sendValues (bool debug=false)
 

Public Attributes

std::string name = "NO_NAME"
 
int16_t powerOut = 0
 
PID pidSpeed
 
PID pidPosition
 
int multiTurn = 0
 
int outputCap = INT16_T_MAX
 
bool useAbsEncoder = false
 
bool printAngle = false
 
motorType type = NONE
 

Static Public Attributes

static int motorCount = 0
 
static bool initializedWarning = false
 

Member Enumeration Documentation

◆ motorMoveMode

Enumerator
OFF 
POS 
SPD 
POW 
ERR 

Constructor & Destructor Documentation

◆ DJIMotor() [1/4]

DJIMotor::DJIMotor ( bool  isErroneousMotor = false)
explicit

◆ DJIMotor() [2/4]

DJIMotor::DJIMotor ( short  motorID,
CANHandler::CANBus  canBus,
motorType  type = STANDARD,
const std::string &  name = "NO_NAME" 
)

◆ DJIMotor() [3/4]

DJIMotor::DJIMotor ( config  cfg)

◆ ~DJIMotor()

DJIMotor::~DJIMotor ( )

◆ DJIMotor() [4/4]

DJIMotor::DJIMotor ( const DJIMotor )
delete

Member Function Documentation

◆ __attribute__()

DJIMotor::__attribute__ ( (unused)  ) const
inline

◆ calculateDeltaPhase() [1/2]

float DJIMotor::calculateDeltaPhase ( float  target,
float  current,
float  max 
)
static

◆ calculateDeltaPhase() [2/2]

int DJIMotor::calculateDeltaPhase ( int  target,
int  current,
int  max = TICKS_REVOLUTION 
)
static

◆ calculatePeriodicPosition()

float DJIMotor::calculatePeriodicPosition ( float  dE,
double  dt 
)
inline

◆ calculatePositionPID()

float DJIMotor::calculatePositionPID ( float  desired,
float  current,
double  dt 
)
inline

◆ calculateSpeedPID()

float DJIMotor::calculateSpeedPID ( float  desired,
float  current,
double  dt 
)
inline

◆ getCan1Feedback()

void DJIMotor::getCan1Feedback ( const CANMsg msg)
static

◆ getCan2Feedback()

void DJIMotor::getCan2Feedback ( const CANMsg msg)
static

◆ getData()

float DJIMotor::getData ( motorDataType  data)

◆ getMode()

motorMoveMode DJIMotor::getMode ( )
inline

◆ operator=()

DJIMotor & DJIMotor::operator= ( const DJIMotor )
delete

◆ operator>>()

int DJIMotor::operator>> ( motorDataType  data)
inline

◆ sendValues()

void DJIMotor::sendValues ( bool  debug = false)
static

◆ setCanHandlers()

void DJIMotor::setCanHandlers ( CANHandler can_1,
CANHandler can_2 
)
static

◆ setMotorOutput()

void DJIMotor::setMotorOutput ( int  val,
motorMoveMode  mod 
)
inline

◆ setPosition()

void DJIMotor::setPosition ( float  position)
inline

◆ setPositionIntegralCap()

void DJIMotor::setPositionIntegralCap ( double  cap)
inline

◆ setPositionOutputCap()

void DJIMotor::setPositionOutputCap ( double  cap)
inline

◆ setPositionPID()

void DJIMotor::setPositionPID ( float  kP,
float  kI,
float  kD 
)
inline

◆ setPower()

void DJIMotor::setPower ( int  power)
inline

◆ setSpeed()

void DJIMotor::setSpeed ( float  speed)
inline

◆ setSpeedDerivativeCap()

void DJIMotor::setSpeedDerivativeCap ( double  cap)
inline

◆ setSpeedIntegralCap()

void DJIMotor::setSpeedIntegralCap ( double  cap)
inline

◆ setSpeedOutputCap()

void DJIMotor::setSpeedOutputCap ( double  cap)
inline

◆ setSpeedPID()

void DJIMotor::setSpeedPID ( float  kP,
float  kI,
float  kD 
)
inline

Member Data Documentation

◆ initializedWarning

bool DJIMotor::initializedWarning = false
static

◆ motorCount

int DJIMotor::motorCount = 0
static

◆ multiTurn

int DJIMotor::multiTurn = 0

◆ name

std::string DJIMotor::name = "NO_NAME"

◆ outputCap

int DJIMotor::outputCap = INT16_T_MAX

◆ pidPosition

PID DJIMotor::pidPosition

◆ pidSpeed

PID DJIMotor::pidSpeed

◆ powerOut

int16_t DJIMotor::powerOut = 0

◆ printAngle

bool DJIMotor::printAngle = false

◆ type

motorType DJIMotor::type = NONE

◆ useAbsEncoder

bool DJIMotor::useAbsEncoder = false

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