Haptic Controller
Loading...
Searching...
No Matches
OdriveController< CAN > Class Template Reference

Class that abstracts operations with the ODrive/. More...

Public Member Functions

 OdriveController ()=default
 
 ~OdriveController ()=default
 
 OdriveController (FlexCAN_T4< CAN, RX_SIZE_256, TX_SIZE_256 > &odrive_can, int CAN_ID, ODriveUserData &odrv_user_data)
 Constructor for the ODriveController.
 
bool set_params ()
 Set parameters on the ODrive.
 
bool full_calibration ()
 Run the full calibration sequence given by ODrive.
 
bool move_to_limits ()
 Move to the upper and lower limits of the joint.
 
bool enable_anticogging (bool doCalibration=false)
 Set parameters for anticogging and enable it.
 
bool startup_odrive_checks ()
 Set parameters and set the motor to torque control.
 
void set_torque (float torque)
 Function to set the torque values based on the joint limits recorded from the startup_calibration.
 

Public Attributes

FlexCAN_T4< CAN, RX_SIZE_256, TX_SIZE_256 > & odrive_can_
 Address of canline for this odrive.
 
ODriveCAN odrv_
 Odrive object to control.
 
ODriveUserDataodrv_user_data_
 struct to store user data in
 
Limits< float > motor_limits_
 : Limits on motor torques
 
float alpha_ = 0.95
 

Detailed Description

template<CAN_DEV_TABLE CAN>
class OdriveController< CAN >

Class that abstracts operations with the ODrive/.

Template Parameters
CAN- CAN bus that the ODrive is connected to

Definition at line 15 of file odrive_controller.hpp.

Constructor & Destructor Documentation

◆ OdriveController() [1/2]

template<CAN_DEV_TABLE CAN>
OdriveController< CAN >::OdriveController ( )
default

◆ ~OdriveController()

template<CAN_DEV_TABLE CAN>
OdriveController< CAN >::~OdriveController ( )
default

◆ OdriveController() [2/2]

template<CAN_DEV_TABLE CAN>
OdriveController< CAN >::OdriveController ( FlexCAN_T4< CAN, RX_SIZE_256, TX_SIZE_256 > & odrive_can,
int CAN_ID,
ODriveUserData & odrv_user_data )
inline

Constructor for the ODriveController.

Parameters
odrive_can- CAN bus that the ODrive is connected to
CAN_ID- CAN ID of the ODrive
odrv_user_dataReference to the ODriveUserData object

Definition at line 25 of file odrive_controller.hpp.

References ODriveUserData::node_id, OdriveController< CAN >::odrv_, OdriveController< CAN >::odrv_user_data_, onFeedback(), onHeartbeat(), and onTemperature().

Member Function Documentation

◆ enable_anticogging()

template<CAN_DEV_TABLE CAN>
bool OdriveController< CAN >::enable_anticogging ( bool doCalibration = false)
inline

Set parameters for anticogging and enable it.

Parameters
doCalibration- If true, will run the anticogging calibration

Definition at line 115 of file odrive_controller.hpp.

References Set_Reboot_msg_t::Action, banticogging_config_params(), benable_config_param, Set_Param_msg_t< T >::Endpoint_ID, fanticogging_config_params(), OdriveController< CAN >::odrive_can_, OdriveController< CAN >::odrv_, and Set_Param_msg_t< T >::Value.

◆ full_calibration()

template<CAN_DEV_TABLE CAN>
bool OdriveController< CAN >::full_calibration ( )
inline

Run the full calibration sequence given by ODrive.

Definition at line 84 of file odrive_controller.hpp.

References OdriveController< CAN >::odrv_.

◆ move_to_limits()

template<CAN_DEV_TABLE CAN>
bool OdriveController< CAN >::move_to_limits ( )
inline

Move to the upper and lower limits of the joint.

Definition at line 94 of file odrive_controller.hpp.

References Limits< T >::lower, OdriveController< CAN >::motor_limits_, OdriveController< CAN >::odrv_, and Limits< T >::upper.

◆ set_params()

template<CAN_DEV_TABLE CAN>
bool OdriveController< CAN >::set_params ( )
inline

◆ set_torque()

template<CAN_DEV_TABLE CAN>
void OdriveController< CAN >::set_torque ( float torque)
inline

Function to set the torque values based on the joint limits recorded from the startup_calibration.

Parameters
torqueRequested torque in N/m
Note
torque is reduced when entering the buffer region.

Definition at line 190 of file odrive_controller.hpp.

References OdriveController< CAN >::alpha_, ODriveUserData::last_feedback, Limits< T >::lower, OdriveController< CAN >::motor_limits_, OdriveController< CAN >::odrv_, OdriveController< CAN >::odrv_user_data_, pos, and Limits< T >::upper.

◆ startup_odrive_checks()

template<CAN_DEV_TABLE CAN>
bool OdriveController< CAN >::startup_odrive_checks ( )
inline

Set parameters and set the motor to torque control.

Definition at line 170 of file odrive_controller.hpp.

References OdriveController< CAN >::odrv_, and OdriveController< CAN >::set_params().

Referenced by CommsController< ODRIVE_CAN0, ODRIVE_CAN1 >::Initialize().

Member Data Documentation

◆ alpha_

template<CAN_DEV_TABLE CAN>
float OdriveController< CAN >::alpha_ = 0.95

Definition at line 51 of file odrive_controller.hpp.

Referenced by OdriveController< CAN >::set_torque().

◆ motor_limits_

template<CAN_DEV_TABLE CAN>
Limits<float> OdriveController< CAN >::motor_limits_

: Limits on motor torques

Definition at line 49 of file odrive_controller.hpp.

Referenced by OdriveController< CAN >::move_to_limits(), and OdriveController< CAN >::set_torque().

◆ odrive_can_

template<CAN_DEV_TABLE CAN>
FlexCAN_T4<CAN, RX_SIZE_256, TX_SIZE_256>& OdriveController< CAN >::odrive_can_

Address of canline for this odrive.

Definition at line 40 of file odrive_controller.hpp.

Referenced by OdriveController< CAN >::enable_anticogging(), and OdriveController< CAN >::set_params().

◆ odrv_

◆ odrv_user_data_


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