Open FFBoard
Open source force feedback firmware
ODriveCAN2 Class Reference

#include <ODriveCAN.h>

Inheritance diagram for ODriveCAN2:
ODriveCAN MotorDriver PersistentStorage Encoder CanHandler CommandHandler cpp_freertos::Thread ChoosableClass ChoosableClass

Public Member Functions

 ODriveCAN2 ()
 
const ClassIdentifier getInfo ()
 Command handlers always have class infos. Works well with ChoosableClass. More...
 
 ~ODriveCAN2 ()
 
- Public Member Functions inherited from ODriveCAN
 ODriveCAN (uint8_t id)
 
virtual ~ODriveCAN ()
 
void turn (int16_t power) override
 
void stopMotor () override
 
void startMotor () override
 
EncodergetEncoder () override
 
bool hasIntegratedEncoder ()
 
template<class T >
void sendMsg (uint8_t cmd, T value)
 
void sendMsg (uint8_t cmd, float value)
 
void requestMsg (uint8_t cmd)
 
bool motorReady () override
 
void startAnticogging ()
 
void Run ()
 
void setTorque (float torque)
 
void canRxPendCallback (CANPort *port, CAN_rx_msg &msg) override
 
void canErrorCallback (CANPort *port, uint32_t errcode)
 
float getPos_f () override
 
uint32_t getCpr () override
 
int32_t getPos () override
 
void setPos (int32_t pos) override
 
EncoderType getEncoderType () override
 
void setMode (ODriveControlMode controlMode, ODriveInputMode inputMode)
 
void setState (ODriveState state)
 
void readyCb ()
 
void saveFlash () override
 
void restoreFlash () override
 
CommandStatus command (const ParsedCommand &cmd, std::vector< CommandReply > &replies) override
 
void registerCommands ()
 
std::string getHelpstring ()
 
void setCanFilter ()
 
- Public Member Functions inherited from MotorDriver
 MotorDriver ()
 
virtual ~MotorDriver ()
 
const ClassType getClassType () override
 returns the used classchooser selection id of this instance More...
 
virtual void emergencyStop (bool reset=false)
 
virtual void setEncoder (std::shared_ptr< Encoder > &encoder)
 
- Public Member Functions inherited from ChoosableClass
virtual ~ChoosableClass ()
 
uint16_t getSelectionID ()
 
- Public Member Functions inherited from PersistentStorage
 PersistentStorage ()
 
virtual ~PersistentStorage ()
 
void restoreFlashDelayed ()
 
- Public Member Functions inherited from Encoder
 Encoder ()
 
virtual ~Encoder ()
 
virtual int32_t getPosAbs ()
 
virtual float getPosAbs_f ()
 
virtual const ClassType getClassType () override
 returns the used classchooser selection id of this instance More...
 
- Public Member Functions inherited from CanHandler
 CanHandler ()
 
virtual ~CanHandler ()
 
virtual void canRxFullCallback (CANPort *port, uint32_t fifo)
 
virtual void canTxCpltCallback (CANPort *port, uint32_t mailbox)
 
virtual void canTxAbortCallback (CANPort *port, uint32_t mailbox)
 
- Public Member Functions inherited from CommandHandler
virtual const ClassType getClassType ()
 
 CommandHandler (const char *clsname, uint16_t clsid, uint8_t instance=0)
 
virtual ~CommandHandler ()
 
virtual bool hasCommands ()
 
virtual void setCommandsEnabled (bool enable)
 
void registerCommands ()
 
virtual CommandStatus internalCommand (const ParsedCommand &cmd, std::vector< CommandReply > &replies)
 
virtual std::string getCommandsHelpstring ()
 
virtual std::string getCsvHelpstring ()
 
virtual uint8_t getCommandHandlerInstance ()
 
void broadcastCommandReply (CommandReply reply, uint32_t cmdId, CMDtype type)
 
void sendCommandReplyAsync (CommandReply reply, uint32_t cmdId, CMDtype type, CommandInterface *interface=nullptr)
 
virtual uint16_t getCommandHandlerID ()
 
virtual CmdHandlerInfogetCommandHandlerInfo ()
 
virtual bool isValidCommandId (uint32_t cmdid, uint32_t ignoredFlags=0, uint32_t requiredFlag=0)
 
virtual CmdHandlerCommanddefgetCommandFromName (const std::string &cmd, uint32_t ignoredFlags=0)
 
virtual CmdHandlerCommanddefgetCommandFromId (const uint32_t id, uint32_t ignoredFlags=0)
 
template<typename ID >
void registerCommand (const char *cmd, const ID cmdid, const char *help=nullptr, uint32_t flags=0)
 

Static Public Member Functions

static bool isCreatable ()
 
- Static Public Member Functions inherited from ChoosableClass
static bool isCreatable ()
 
- Static Public Member Functions inherited from PersistentStorage
static std::vector< PersistentStorage * > & getFlashHandlers ()
 
static void restoreFlashStartupCb ()
 
- Static Public Member Functions inherited from CanHandler
static std::vector< CanHandler * > & getCANHandlers ()
 
- Static Public Member Functions inherited from CommandHandler
static void logSerial (std::string string)
 Send a log formatted sequence. More...
 
static void logSerialDebug (std::string string)
 Send a log formatted sequence if debug is on. More...
 
static bool logsEnabled ()
 
static void setLogsEnabled (bool enabled)
 
static uint32_t getClassIdFromName (const char *name)
 
static const char * getClassNameFromId (const uint32_t id)
 
static CommandHandlergetHandlerFromHandlerId (const uint16_t cmdhandlerID)
 
static CommandHandlergetHandlerFromId (const uint16_t id, const uint8_t instance=0xFF)
 
static CommandHandlergetHandlerFromClassName (const char *name, const uint8_t instance=0xFF)
 
static std::vector< CommandHandler * > getHandlersFromClassName (const char *name)
 
static std::vector< CommandHandler * > getHandlersFromId (const uint16_t id)
 
static bool isInHandlerList (CommandHandler *handler)
 
static std::string getAllHelpstrings ()
 
static std::vector< CommandHandler * > & getCommandHandlers ()
 
template<typename TVal >
static CommandStatus handleGetSet (const ParsedCommand &cmd, std::vector< CommandReply > &replies, TVal &value)
 
template<typename TVal , class cls , class cls1 >
static CommandStatus handleGetSetFunc (const ParsedCommand &cmd, std::vector< CommandReply > &replies, TVal &value, void(cls1::*setfunc)(TVal), cls *obj)
 
template<typename TVal , class cls , class cls1 , class cls2 >
static CommandStatus handleGetFuncSetFunc (const ParsedCommand &cmd, std::vector< CommandReply > &replies, TVal(cls1::*getfunc)(), void(cls2::*setfunc)(TVal), cls *obj)
 
template<typename TVal , class cls , class cls1 >
static CommandStatus handleGetFuncSet (const ParsedCommand &cmd, std::vector< CommandReply > &replies, TVal &value, TVal(cls1::*getfunc)(), cls *obj)
 

Static Public Attributes

static ClassIdentifier info
 
static bool inUse = false
 
- Static Public Attributes inherited from MotorDriver
static ClassIdentifier info ={.name = "None" , .id=CLSID_MOT_NONE, .visibility = ClassVisibility::visible}
 
static const std::vector< class_entry< MotorDriver > > all_drivers
 
- Static Public Attributes inherited from ChoosableClass
static ClassIdentifier info
 
- Static Public Attributes inherited from Encoder
static ClassIdentifier info ={.name = "None" , .id=CLSID_ENCODER_NONE, .visibility = ClassVisibility::visible}
 
static const std::vector< class_entry< Encoder > > all_encoders
 
- Static Public Attributes inherited from CommandHandler
static bool logEnabled = true
 

Additional Inherited Members

- Protected Member Functions inherited from CommandHandler
void setInstance (uint8_t instance)
 
virtual void addCommandHandler ()
 
virtual void removeCommandHandler ()
 
- Static Protected Member Functions inherited from CommandHandler
static std::vector< uint16_t > & getCommandHandlerIds ()
 
- Protected Attributes inherited from MotorDriver
std::shared_ptr< EncoderdrvEncoder = std::make_shared<Encoder>()
 
- Protected Attributes inherited from ChoosableClass
uint16_t selectionId
 Should only be written by ClassChooser during creation. More...
 
- Protected Attributes inherited from PersistentStorage
bool restoreDelayedFlag = false
 
- Protected Attributes inherited from Encoder
uint32_t cpr = 0
 
- Protected Attributes inherited from CommandHandler
bool commandsEnabled = true
 
std::vector< CmdHandlerCommanddefregisteredCommands
 
CmdHandlerInfo cmdHandlerInfo
 
- Static Protected Attributes inherited from PersistentStorage
static bool startupComplete = false
 

Detailed Description

Instance 2 of ODrive Use for M1 output

Definition at line 149 of file ODriveCAN.h.

Constructor & Destructor Documentation

◆ ODriveCAN2()

ODriveCAN2::ODriveCAN2 ( )
inline

Definition at line 151 of file ODriveCAN.h.

◆ ~ODriveCAN2()

ODriveCAN2::~ODriveCAN2 ( )
inline

Definition at line 153 of file ODriveCAN.h.

Member Function Documentation

◆ getInfo()

const ClassIdentifier ODriveCAN2::getInfo ( )
virtual

Command handlers always have class infos. Works well with ChoosableClass.

Implements ODriveCAN.

Definition at line 28 of file ODriveCAN.cpp.

◆ isCreatable()

bool ODriveCAN2::isCreatable ( )
static

Definition at line 36 of file ODriveCAN.cpp.

Member Data Documentation

◆ info

ClassIdentifier ODriveCAN2::info
static
Initial value:
= {
.name = "ODrive (M1)" ,
.id=CLSID_MOT_ODRV1,
}

Definition at line 155 of file ODriveCAN.h.

◆ inUse

bool ODriveCAN2::inUse = false
static

Definition at line 156 of file ODriveCAN.h.


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