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

#include <DJIMotor.h>

Public Member Functions

 DJIMotor (bool isErroneousMotor=false)
 
 DJIMotor (short motorID, CANHandler::CANBus canBus, motorType type=STANDARD, const std::string &name="NO_NAME")
 
 ~DJIMotor ()
 
int getData (motorDataType data)
 
void printAllMotorData ()
 
void setPower (int power)
 
void setSpeed (int speed)
 
void setPosition (int position)
 
motorMoveMode getMode ()
 
 __attribute__ ((unused)) inline bool isConnected() const
 
int operator>> (motorDataType data)
 
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)
 
int calculateSpeedPID (int desired, int current, double dt)
 
int calculatePositionPID (int desired, int current, double dt, int chassis_rpm=0)
 
int calculatePeriodicPosition (float dE, double dt, int chassis_rpm=0)
 

Static Public Member Functions

static int s_calculateDeltaPhase (int target, int current, int max=TICKS_REVOLUTION)
 
static float s_calculateDeltaPhaseF (float target, float current, float max)
 
static void s_setCANHandlers (CANHandler *bus_1, CANHandler *bus_2, bool threadSend=true, bool threadFeedback=true)
 
static void s_getFeedback (bool debug=false)
 
static void s_sendValues (bool debug=false)
 
static void s_feedbackThread ()
 the thread that runs the ever-necessary DJIMotor::s_getFeedback()
 
static void s_sendThread ()
 the thread that runs the ever-necessary DJIMotor::s_sendValues()
 
static bool s_theseConnected (DJIMotor *motors[], int size, bool debug=false)
 
static bool s_allConnected (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 = true
 
bool printAngle = false
 
motorType type = NONE
 

Static Public Attributes

static int motorCount = 0
 
static bool initializedWarning = false
 

Constructor & Destructor Documentation

◆ DJIMotor() [1/2]

DJIMotor::DJIMotor ( bool  isErroneousMotor = false)
explicit

◆ DJIMotor() [2/2]

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

◆ ~DJIMotor()

DJIMotor::~DJIMotor ( )

Member Function Documentation

◆ __attribute__()

DJIMotor::__attribute__ ( (unused)  ) const
inline

◆ calculatePeriodicPosition()

int DJIMotor::calculatePeriodicPosition ( float  dE,
double  dt,
int  chassis_rpm = 0 
)
inline

◆ calculatePositionPID()

int DJIMotor::calculatePositionPID ( int  desired,
int  current,
double  dt,
int  chassis_rpm = 0 
)
inline

◆ calculateSpeedPID()

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

◆ getData()

int DJIMotor::getData ( motorDataType  data)

◆ getMode()

motorMoveMode DJIMotor::getMode ( )
inline

◆ operator>>()

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

◆ printAllMotorData()

void DJIMotor::printAllMotorData ( )

◆ s_allConnected()

bool DJIMotor::s_allConnected ( bool  debug = false)
static

◆ s_calculateDeltaPhase()

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

◆ s_calculateDeltaPhaseF()

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

◆ s_feedbackThread()

void DJIMotor::s_feedbackThread ( )
static

the thread that runs the ever-necessary DJIMotor::s_getFeedback()

◆ s_getFeedback()

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

◆ s_sendThread()

void DJIMotor::s_sendThread ( )
static

the thread that runs the ever-necessary DJIMotor::s_sendValues()

◆ s_sendValues()

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

◆ s_setCANHandlers()

void DJIMotor::s_setCANHandlers ( CANHandler bus_1,
CANHandler bus_2,
bool  threadSend = true,
bool  threadFeedback = true 
)
static

◆ s_theseConnected()

bool DJIMotor::s_theseConnected ( DJIMotor motors[],
int  size,
bool  debug = false 
)
static

◆ setPosition()

void DJIMotor::setPosition ( int  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 ( int  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 = true

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