14 #include <real_time_tools/threadsafe/threadsafe_timeseries.hpp> 40 template<
typename Type>
using Ptr = std::shared_ptr<Type>;
47 motor_measurement_count};
74 const int& measurement_index)
const = 0;
112 const int& motor_index) = 0;
137 Leg(std::shared_ptr<MotorInterface> hip_motor,
138 std::shared_ptr<MotorInterface> knee_motor)
140 motors_[hip] = hip_motor;
141 motors_[knee] = knee_motor;
162 const int& measurement_index)
const 164 return motors_[motor_index]->get_measurement(measurement_index);
171 return motors_[motor_index]->get_current_target();
176 return motors_[motor_index]->get_sent_current_target();
181 const int& motor_index)
183 motors_[motor_index]->set_current_target(current_target);
189 for(
size_t i = 0; i < motors_.size(); i++)
199 std::array<std::shared_ptr<MotorInterface>, 2>
motors_;
virtual Ptr< const ScalarTimeseries > get_current_target(const int &motor_index) const
Get the actual target current.
Definition: leg.hpp:169
virtual Ptr< const ScalarTimeseries > get_sent_current_target(const int &motor_index) const =0
Get the last sent target current.
virtual void set_current_target(const double ¤t_target, const int &motor_index)
setters ================================================================
Definition: leg.hpp:180
This namespace is the standard namespace of the package.
Definition: const_torque_control.cpp:12
virtual ~Leg()
Destroy the Leg object.
Definition: leg.hpp:147
std::shared_ptr< Type > Ptr
This is a shortcut for creating shared pointer in a simpler writting expression.
Definition: leg.hpp:40
std::array< std::shared_ptr< MotorInterface >, 2 > motors_
========================================================================
Definition: leg.hpp:199
virtual void send_if_input_changed()
sender =================================================================
Definition: leg.hpp:187
This class defines an interface to control a leg.
Definition: leg.hpp:26
virtual Ptr< const ScalarTimeseries > get_motor_measurement(const int &motor_index, const int &measurement_index) const =0
Getters.
Leg(std::shared_ptr< MotorInterface > hip_motor, std::shared_ptr< MotorInterface > knee_motor)
Construct a new Leg object.
Definition: leg.hpp:137
virtual Ptr< const ScalarTimeseries > get_current_target(const int &motor_index) const =0
Get the actual target current.
virtual void set_current_target(const double ¤t_target, const int &motor_index)=0
Setters.
this class exists purely for logical reasons, it does not in itself implement anything.
Definition: device_interface.hpp:36
MotorIndexing
This enum list the motors in the leg.
Definition: leg.hpp:52
real_time_tools::ThreadsafeTimeseries< double > ScalarTimeseries
ScalarTimeseries is a simple shortcut for more intelligible code.
Definition: leg.hpp:32
virtual ~LegInterface()
Destroy the LegInterface object.
Definition: leg.hpp:57
virtual Ptr< const ScalarTimeseries > get_sent_current_target(const int &motor_index) const
Get the last sent target current.
Definition: leg.hpp:174
virtual void send_if_input_changed()=0
Sender.
MotorMeasurementIndexing
MotorMeasurementIndexing this enum allow to access the different kind of sensor measurements in an un...
Definition: leg.hpp:46
virtual Ptr< const ScalarTimeseries > get_motor_measurement(const int &motor_index, const int &measurement_index) const
Getters.
Definition: leg.hpp:161
The leg class is the implementation of the LegInterface.
Definition: leg.hpp:128