blmc_drivers
blmc_drivers::SafeMotor Class Reference

This class is a safe implementation of the Motor class. More...

#include <motor.hpp>

Inheritance diagram for blmc_drivers::SafeMotor:
Collaboration diagram for blmc_drivers::SafeMotor:

Public Member Functions

 SafeMotor (Ptr< MotorBoardInterface > board, bool motor_id, const double &max_current_target=2.0, const size_t &history_length=1000, const double &max_velocity=std::numeric_limits< double >::quiet_NaN())
 Construct a new SafeMotor object. More...
 
virtual Ptr< const ScalarTimeseriesget_current_target () const
 Getters. More...
 
virtual void set_current_target (const double &current_target)
 Setters. More...
 
void set_max_current (double max_current_target)
 Set the max_current_target_ object. More...
 
void set_max_velocity (double max_velocity)
 Set the max_velocity_ constant. More...
 
- Public Member Functions inherited from blmc_drivers::Motor
 Motor (Ptr< MotorBoardInterface > board, bool motor_id)
 Construct a new Motor object. More...
 
virtual ~Motor ()
 Destroy the Motor object. More...
 
virtual void send_if_input_changed ()
 Actually send the command and controls via the network, See MotorInterface for more information.
 
virtual Ptr< const ScalarTimeseriesget_measurement (const int &index=0) const
 Getters. More...
 
virtual Ptr< const ScalarTimeseriesget_sent_current_target () const
 Get the already sent current target values. More...
 
virtual void set_command (const MotorBoardCommand &command)
 Set the command. More...
 
virtual void print () const
 Print the motor status and state. More...
 
- Public Member Functions inherited from blmc_drivers::MotorInterface
virtual ~MotorInterface ()
 Destroy the MotorInterface object.
 

Private Attributes

double max_current_target_
 max_current_target_ is the limit of the current.
 
double max_velocity_
 max_velocity_ limits the motor velocity.
 
Ptr< ScalarTimeseriescurrent_target_
 History of the target current sent.
 

Additional Inherited Members

- Public Types inherited from blmc_drivers::MotorInterface
enum  MeasurementIndex {
  current, position, velocity, encoder_index,
  measurement_count
}
 Here is a list of the different measurement available on the blmc card.
 
typedef real_time_tools::ThreadsafeTimeseries< double > ScalarTimeseries
 This is a useful alias.
 
template<typename Type >
using Ptr = std::shared_ptr< Type >
 This a useful alias for the shared Pointer creation. More...
 
- Protected Attributes inherited from blmc_drivers::Motor
Ptr< MotorBoardInterfaceboard_
 The MotorBoard to be used for the communication.
 
bool motor_id_
 The id of the motor on the MotorBoard.
 

Detailed Description

This class is a safe implementation of the Motor class.

It contains utilities to bound the control input. It could also contains some velocity limits at the motor level and why not some temperature management.

Todo:
the velocity limit should be implemented in a smoother way, and the parameters should be passed in the constructor.

Constructor & Destructor Documentation

◆ SafeMotor()

blmc_drivers::SafeMotor::SafeMotor ( Motor::Ptr< MotorBoardInterface board,
bool  motor_id,
const double &  max_current_target = 2.0,
const size_t &  history_length = 1000,
const double &  max_velocity = std::numeric_limits< double>::quiet_NaN() 
)

Construct a new SafeMotor object.

Parameters
board
motor_id
max_current_target
history_length

Member Function Documentation

◆ get_current_target()

virtual Ptr<const ScalarTimeseries> blmc_drivers::SafeMotor::get_current_target ( ) const
inlinevirtual

Getters.

Get the _current_target object

Returns
Ptr<const ScalarTimeseries>

Reimplemented from blmc_drivers::Motor.

◆ set_current_target()

void blmc_drivers::SafeMotor::set_current_target ( const double &  current_target)
virtual

Setters.

Set the current target (Ampere)

Parameters
current_target

Reimplemented from blmc_drivers::Motor.

◆ set_max_current()

void blmc_drivers::SafeMotor::set_max_current ( double  max_current_target)
inline

Set the max_current_target_ object.

Parameters
max_current_target

◆ set_max_velocity()

void blmc_drivers::SafeMotor::set_max_velocity ( double  max_velocity)
inline

Set the max_velocity_ constant.

Parameters
max_velocity

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