File leg.hpp

License:

License BSD-3-Clause

Copyright

Copyright (c) 2019, New York University and Max Planck Gesellschaft.

Date

2019-07-11

namespace blmc_drivers

This namespace is the standard namespace of the package.

class Leg : public blmc_drivers::LegInterface
#include <leg.hpp>

The leg class is the implementation of the LegInterface.

This is the decalartion and the definition of the class as it is very simple.

Public Functions

inline Leg(std::shared_ptr<MotorInterface> hip_motor, std::shared_ptr<MotorInterface> knee_motor)

Construct a new Leg object.

Parameters
  • hip_motor – is the pointer to the hip motor

  • knee_motor – is the pointer to the knee motor

inline virtual ~Leg()

Destroy the Leg object.

inline virtual Ptr<const ScalarTimeseries> get_motor_measurement(const int &motor_index, const int &measurement_index) const

Getters.

Get the motor measurements.

Parameters
  • motor_index

  • measurement_index

Returns

Ptr<const ScalarTimeseries>

inline virtual Ptr<const ScalarTimeseries> get_current_target(const int &motor_index) const

Get the actual target current.

Parameters

motor_index[in] designate the motor from which we want the data from.

Returns

Ptr<const ScalarTimeseries> is the list of the lasts time stamped acquiered.

inline virtual Ptr<const ScalarTimeseries> get_sent_current_target(const int &motor_index) const

Get the last sent target current.

Parameters

motor_index[in] designate the motor from which we want the data from.

Returns

Ptr<const ScalarTimeseries> is the list of the lasts time stamped acquiered.

inline virtual void set_current_target(const double &current_target, const int &motor_index)

setters ================================================================

inline virtual void send_if_input_changed()

sender =================================================================

Private Members

std::array<std::shared_ptr<MotorInterface>, 2> motors_

========================================================================

This list contains pointers to two motors. This motors are respectively the hip and the knee of the leg.

class LegInterface : public blmc_drivers::DeviceInterface
#include <leg.hpp>

This class defines an interface to control a leg.

This legg is composed of 2 motor, one for the hip and one for the knee.

Subclassed by blmc_drivers::Leg

Public Types

enum MotorMeasurementIndexing

MotorMeasurementIndexing this enum allow to access the different kind of sensor measurements in an understandable way in the code.

Values:

enumerator current
enumerator position
enumerator velocity
enumerator encoder_index
enumerator motor_measurement_count
enum MotorIndexing

This enum list the motors in the leg.

Values:

enumerator hip
enumerator knee
enumerator motor_count
typedef time_series::TimeSeries<double> ScalarTimeseries

ScalarTimeseries is a simple shortcut for more intelligible code.

template<typename Type>
using Ptr = std::shared_ptr<Type>

This is a shortcut for creating shared pointer in a simpler writting expression.

Template Parameters

Type – is the template paramer of the shared pointer.

Public Functions

inline virtual ~LegInterface()

Destroy the LegInterface object.

virtual Ptr<const ScalarTimeseries> get_motor_measurement(const int &motor_index, const int &measurement_index) const = 0

Getters.

Get the device output

Parameters
  • motor_index[in] designate the motor from which we want the data from.

  • measurement_index[in] is teh kind of data we are looking for.

Returns

Ptr<const ScalarTimeseries> is the list of the lasts time stamped acquiered.

virtual Ptr<const ScalarTimeseries> get_current_target(const int &motor_index) const = 0

Get the actual target current.

Parameters

motor_index[in] designate the motor from which we want the data from.

Returns

Ptr<const ScalarTimeseries> is the list of the lasts time stamped acquiered.

virtual Ptr<const ScalarTimeseries> get_sent_current_target(const int &motor_index) const = 0

Get the last sent target current.

Parameters

motor_index[in] designate the motor from which we want the data from.

Returns

Ptr<const ScalarTimeseries> is the list of the lasts time stamped acquiered.

virtual void set_current_target(const double &current_target, const int &motor_index) = 0

Setters.

Set the current target saves internally the desired current. This data is not send to the motor yet. Please call send_if_input_changed in order to actually send the data to the card.

Parameters
  • current_target – is the current to achieve on the motor card.

  • motor_index – is the motor to control.

virtual void send_if_input_changed() = 0

Sender.

Actually send the target current to the motor cards.