13 #include "real_time_tools/timer.hpp" 15 #include "real_time_tools/threadsafe/threadsafe_object.hpp" 16 #include "real_time_tools/threadsafe/threadsafe_timeseries.hpp" 41 template<
typename Type>
using Ptr = std::shared_ptr<Type>;
72 const int& index = 0)
const = 0;
137 board_->send_if_input_changed();
188 board_->set_command(command);
192 virtual void print()
const;
227 const double& max_current_target = 2.0,
228 const size_t& history_length = 1000,
229 const double& max_velocity = std::numeric_limits<
230 double>::quiet_NaN());
243 return current_target_;
264 max_current_target_ = max_current_target;
274 max_velocity_ = max_velocity;
virtual void set_command(const MotorBoardCommand &command)=0
Set the command.
std::shared_ptr< Type > Ptr
This a useful alias for the shared Pointer creation.
Definition: motor.hpp:41
This namespace is the standard namespace of the package.
Definition: const_torque_control.cpp:12
This class implements the MotorInterface.
Definition: motor.hpp:114
virtual ~Motor()
Destroy the Motor object.
Definition: motor.hpp:129
This MotorBoardCommand class is a data structurs that defines a command.
Definition: motor_board.hpp:30
virtual Ptr< const ScalarTimeseries > get_current_target() const
Getters.
Definition: motor.hpp:241
virtual Ptr< const ScalarTimeseries > get_current_target() const =0
Get the current target object.
virtual Ptr< const ScalarTimeseries > get_sent_current_target() const =0
Get the history of the sent current targets.
Ptr< ScalarTimeseries > current_target_
History of the target current sent.
Definition: motor.hpp:291
double max_velocity_
max_velocity_ limits the motor velocity.
Definition: motor.hpp:286
This class declares an interface to the motor.
Definition: motor.hpp:28
this class exists purely for logical reasons, it does not in itself implement anything.
Definition: device_interface.hpp:36
virtual void set_command(const MotorBoardCommand &command)
Set the command.
Definition: motor.hpp:186
virtual void send_if_input_changed()=0
Actually send the commands and controls.
Ptr< MotorBoardInterface > board_
The MotorBoard to be used for the communication.
Definition: motor.hpp:198
double max_current_target_
max_current_target_ is the limit of the current.
Definition: motor.hpp:281
virtual Ptr< const ScalarTimeseries > get_measurement(const int &index=0) const =0
Getters.
bool motor_id_
The id of the motor on the MotorBoard.
Definition: motor.hpp:203
real_time_tools::ThreadsafeTimeseries< double > ScalarTimeseries
This is a useful alias.
Definition: motor.hpp:35
virtual void send_if_input_changed()
Actually send the command and controls via the network, See MotorInterface for more information...
Definition: motor.hpp:135
void set_max_current(double max_current_target)
Set the max_current_target_ object.
Definition: motor.hpp:262
void set_max_velocity(double max_velocity)
Set the max_velocity_ constant.
Definition: motor.hpp:272
This class is a safe implementation of the Motor class.
Definition: motor.hpp:215
virtual void set_current_target(const double ¤t_target)=0
Setters.
MeasurementIndex
Here is a list of the different measurement available on the blmc card.
Definition: motor.hpp:47
virtual ~MotorInterface()
Destroy the MotorInterface object.
Definition: motor.hpp:53