Class solo::SoloX¶
-
template<int X>
class SoloX¶ Interface for the Solo robots using the master board.
This class is templated with the number of joints and can be used for both Solo8 and Solo12 by setting the corresponding number.
Solo8¶
TODO
Solo12¶
Mapping between the DOF and driver boards + motor ports:
FL_HAA: motor board 0, motor port 0, motor index 0
FL_HFE: motor board 1, motor port 1, motor index 3
FL_KFE: motor board 1, motor port 0, motor index 2
FR_HAA: motor board 0, motor port 1, motor index 1
FR_HFE: motor board 2, motor port 1, motor index 5
FR_KFE: motor board 2, motor port 0, motor index 4
HL_HAA: motor board 3, motor port 0, motor index 6
HL_HFE: motor board 4, motor port 1, motor index 9
HL_KFE: motor board 4, motor port 0, motor index 8
HR_HAA: motor board 3, motor port 1, motor index 7
HR_HFE: motor board 5, motor port 1, motor index 11
HR_KFE: motor board 5, motor port 0, motor index 10
This class is templated with the number of joints and can be used for both Solo8 and Solo12 by setting the corresponding number.
Solo8¶
TODO
Solo12¶
Mapping between the DOF and driver boards + motor ports:
FL_HAA: motor board 0, motor port 0, motor index 0
FL_HFE: motor board 1, motor port 1, motor index 3
FL_KFE: motor board 1, motor port 0, motor index 2
FR_HAA: motor board 0, motor port 1, motor index 1
FR_HFE: motor board 2, motor port 1, motor index 5
FR_KFE: motor board 2, motor port 0, motor index 4
HL_HAA: motor board 3, motor port 0, motor index 6
HL_HFE: motor board 4, motor port 1, motor index 9
HL_KFE: motor board 4, motor port 0, motor index 8
HR_HAA: motor board 3, motor port 1, motor index 7
HR_HFE: motor board 5, motor port 1, motor index 11
HR_KFE: motor board 5, motor port 0, motor index 10
- Template Parameters:
X – Number of joints of the robot. Should be either 8 or 12.
X – Number of joints of the robot. Should be either 8 or 12.
Public Functions
-
SoloX()¶
Solo is the constructor of the class.
-
void initialize(const std::string &network_id, const std::string &slider_box_port = "auto")¶
Initialize the robot by setting aligning the motors and calibrate the sensors to 0.
- Parameters:
network_id – Name of the network interface for connection to the robot.
slider_box_port – Name of the serial port to which the slider box is connected. Set to “” or “none” if no slider box is used. Set to “auto” to auto-detect the port.
-
void set_max_current(const double &max_current)¶
Sets the maximum joint torques.
-
void wait_until_ready()¶
Wait that the robot enters into the ready states.
-
bool is_ready()¶
Check if the robot is ready.
-
void send_target_joint_torque(const Eigen::Ref<Vectord<X>> target_joint_torque)¶
send_target_torques sends the target currents to the motors.
-
void send_target_joint_position(const Eigen::Ref<Vectord<X>> target_joint_position)¶
Sets the desired joint position of the P controller running on the card.
-
void send_target_joint_velocity(const Eigen::Ref<Vectord<X>> target_joint_velocity)¶
Sets the desired joint velocity of the D controller running on the card.
-
void send_target_joint_position_gains(const Eigen::Ref<Vectord<X>> target_joint_position_gains)¶
Sets the desired joint position gain P for the P controller running on the card.
-
void send_target_joint_velocity_gains(const Eigen::Ref<Vectord<X>> target_joint_velocity_gains)¶
Sets the desired joint velocity gain D for the D controller running on the card.
-
void acquire_sensors()¶
acquire_sensors acquire all available sensors, WARNING !!!! this method has to be called prior to any getter to have up to date data.
-
bool request_calibration(const Vectord<X> &home_offset_rad)¶
Asynchronously request for the calibration.
- Parameters:
home_offset_rad – This is the angle between the index and the zero pose.
- Returns:
true in case of success.
- Returns:
false in case of failure.
-
inline const Eigen::Ref<Vectord<X>> get_motor_inertias()¶
Joint properties.
get_motor_inertias in [kg m^2]
- Returns:
Motor inertias.
-
inline const Eigen::Ref<Vectord<X>> get_motor_torque_constants()¶
get_motor_torque_constants in []
- Returns:
Torque constants of each motor.
-
inline const Eigen::Ref<Vectord<X>> get_joint_gear_ratios()¶
get_joint_gear_ratios
- Returns:
Joint gear ratios
-
inline const Eigen::Ref<Vectord<X>> get_motor_max_current()¶
get_max_torque
- Todo:
Parametrize the maximum current via yaml or something else.
- Returns:
the max torque that has been hardcoded in the constructor of this class.
-
inline const Eigen::Ref<Vectord<X>> get_joint_positions()¶
Sensor Data.
get_joint_positions
- Returns:
the joint angle of each module WARNING !!!! The method <acquire_sensors>”()” has to be called prior to any getter to have up to date data.
-
inline const Eigen::Ref<Vectord<X>> get_joint_velocities()¶
get_joint_velocities
- Returns:
the joint velocities WARNING !!!! The method <acquire_sensors>”()” has to be called prior to any getter to have up to date data.
-
inline const Eigen::Ref<Vectord<X>> get_joint_torques()¶
get_joint_torques
- Returns:
the joint torques WARNING !!!! The method <acquire_sensors>”()” has to be called prior to any getter to have up to date data.
-
inline const Eigen::Ref<Vectord<X>> get_joint_target_torques()¶
get_joint_torques
- Returns:
the target joint torques WARNING !!!! The method <acquire_sensors>”()” has to be called prior to any getter to have up to date data.
-
inline const Eigen::Ref<Vectord<X>> get_joint_encoder_index()¶
get_joint_encoder_index
- Returns:
the position of the index of the encoders a the motor level WARNING !!!! The method <acquire_sensors>”()” has to be called prior to any getter to have up to date data.
-
inline const Eigen::Ref<Eigen::Vector4d> get_contact_sensors_states()¶
get_contact_sensors_states
- Returns:
the state of the contacts states WARNING !!!! The method <acquire_sensors>”()” has to be called prior to any getter to have up to date data.
-
inline const Eigen::Ref<Eigen::Vector4d> get_slider_positions()¶
get_slider_positions
- Returns:
the current sliders positions. WARNING !!!! The method <acquire_sensors>”()” has to be called prior to any getter to have up to date data.
-
inline const Eigen::Ref<Eigen::Vector3d> get_imu_accelerometer()¶
base accelerometer from imu.
- Returns:
WARNING !!!! The method <acquire_sensors>”()” has to be called prior to any getter to have up to date data.
-
inline const Eigen::Ref<Eigen::Vector3d> get_imu_gyroscope()¶
base gyroscope from imu.
- Returns:
WARNING !!!! The method <acquire_sensors>”()” has to be called prior to any getter to have up to date data.
-
inline const Eigen::Ref<Eigen::Vector4d> get_imu_attitude()¶
base attitude quaternion (ordered {x, y, z, w}) from imu.
- Returns:
WARNING !!!! The method <acquire_sensors>”()” has to be called prior to any getter to have up to date data.
-
inline const Eigen::Ref<Eigen::Vector3d> get_imu_linear_acceleration()¶
base linear acceleration from imu.
- Returns:
WARNING !!!! The method <acquire_sensors>”()” has to be called prior to any getter to have up to date data.
-
inline const std::array<bool, X> &get_motor_enabled()¶
get_motor_enabled
- Returns:
This gives the status (enabled/disabled) of each motors using the joint ordering convention.
-
inline const std::array<bool, X> &get_motor_ready()¶
get_motor_ready
- Returns:
This gives the status (enabled/disabled) of each motors using the joint ordering convention.
-
inline const std::array<bool, X / 2> &get_motor_board_enabled()¶
get_motor_board_enabled
- Returns:
This gives the status (enabled/disabled of the onboard control cards).
-
inline const std::array<int, X / 2> &get_motor_board_errors()¶
get_motor_board_errors
- Returns:
This gives the status (enabled/disabled of the onboard control cards).
-
inline bool has_error() const¶
has_error
- Returns:
Returns true if the robot hardware has an error, false otherwise.
-
inline bool is_calibrating()¶
is_calibrating()
- Returns:
Returns true if the calibration procedure is running right now.
-
inline int get_num_sent_command_packets() const¶
Get total number of command packets sent to the robot.
-
inline int get_num_lost_command_packets() const¶
Get number of lost command packets.
-
inline int get_num_sent_sensor_packets() const¶
Get total number of sensor packets sent by the robot.
-
inline int get_num_lost_sensor_packets() const¶
Get number of lost sensor packets.
-
SoloX()
Solo is the constructor of the class.
-
void initialize(const std::string &network_id, const std::string &slider_box_port = "auto")
Initialize the robot by setting aligning the motors and calibrate the sensors to 0.
- Parameters:
network_id – Name of the network interface for connection to the robot.
slider_box_port – Name of the serial port to which the slider box is connected. Set to “” or “none” if no slider box is used. Set to “auto” to auto-detect the port.
-
void set_max_current(const double &max_current)
Sets the maximum joint torques.
-
void wait_until_ready()
Wait that the robot enters into the ready states.
-
bool is_ready()
Check if the robot is ready.
-
void send_target_joint_torque(const Eigen::Ref<Vectord<X>> target_joint_torque)
send_target_torques sends the target currents to the motors.
-
void send_target_joint_position(const Eigen::Ref<Vectord<X>> target_joint_position)
Sets the desired joint position of the P controller running on the card.
-
void send_target_joint_velocity(const Eigen::Ref<Vectord<X>> target_joint_velocity)
Sets the desired joint velocity of the D controller running on the card.
-
void send_target_joint_position_gains(const Eigen::Ref<Vectord<X>> target_joint_position_gains)
Sets the desired joint position gain P for the P controller running on the card.
-
void send_target_joint_velocity_gains(const Eigen::Ref<Vectord<X>> target_joint_velocity_gains)
Sets the desired joint velocity gain D for the D controller running on the card.
-
void acquire_sensors()
acquire_sensors acquire all available sensors, WARNING !!!! this method has to be called prior to any getter to have up to date data.
-
bool request_calibration(const Vectord<X> &home_offset_rad)
Asynchronously request for the calibration.
- Parameters:
home_offset_rad – This is the angle between the index and the zero pose.
- Returns:
true in case of success.
- Returns:
false in case of failure.
-
inline const Eigen::Ref<Vectord<X>> get_motor_inertias()
Joint properties.
get_motor_inertias in [kg m^2]
- Returns:
Motor inertias.
-
inline const Eigen::Ref<Vectord<X>> get_motor_torque_constants()
get_motor_torque_constants in []
- Returns:
Torque constants of each motor.
-
inline const Eigen::Ref<Vectord<X>> get_joint_gear_ratios()
get_joint_gear_ratios
- Returns:
Joint gear ratios
-
inline const Eigen::Ref<Vectord<X>> get_motor_max_current()
get_max_torque
- Todo:
Parametrize the maximum current via yaml or something else.
- Returns:
the max torque that has been hardcoded in the constructor of this class.
-
inline const Eigen::Ref<Vectord<X>> get_joint_positions()
Sensor Data.
get_joint_positions
- Returns:
the joint angle of each module WARNING !!!! The method <acquire_sensors>”()” has to be called prior to any getter to have up to date data.
-
inline const Eigen::Ref<Vectord<X>> get_joint_velocities()
get_joint_velocities
- Returns:
the joint velocities WARNING !!!! The method <acquire_sensors>”()” has to be called prior to any getter to have up to date data.
-
inline const Eigen::Ref<Vectord<X>> get_joint_torques()
get_joint_torques
- Returns:
the joint torques WARNING !!!! The method <acquire_sensors>”()” has to be called prior to any getter to have up to date data.
-
inline const Eigen::Ref<Vectord<X>> get_joint_target_torques()
get_joint_torques
- Returns:
the target joint torques WARNING !!!! The method <acquire_sensors>”()” has to be called prior to any getter to have up to date data.
-
inline const Eigen::Ref<Vectord<X>> get_joint_encoder_index()
get_joint_encoder_index
- Returns:
the position of the index of the encoders a the motor level WARNING !!!! The method <acquire_sensors>”()” has to be called prior to any getter to have up to date data.
-
inline const Eigen::Ref<Eigen::Vector4d> get_contact_sensors_states()
get_contact_sensors_states
- Returns:
the state of the contacts states WARNING !!!! The method <acquire_sensors>”()” has to be called prior to any getter to have up to date data.
-
inline const Eigen::Ref<Eigen::Vector4d> get_slider_positions()
get_slider_positions
- Returns:
the current sliders positions. WARNING !!!! The method <acquire_sensors>”()” has to be called prior to any getter to have up to date data.
-
inline const Eigen::Ref<Eigen::Vector3d> get_imu_accelerometer()
base accelerometer from imu.
- Returns:
WARNING !!!! The method <acquire_sensors>”()” has to be called prior to any getter to have up to date data.
-
inline const Eigen::Ref<Eigen::Vector3d> get_imu_gyroscope()
base gyroscope from imu.
- Returns:
WARNING !!!! The method <acquire_sensors>”()” has to be called prior to any getter to have up to date data.
-
inline const Eigen::Ref<Eigen::Vector4d> get_imu_attitude()
base attitude quaternion (ordered {x, y, z, w}) from imu.
- Returns:
WARNING !!!! The method <acquire_sensors>”()” has to be called prior to any getter to have up to date data.
-
inline const Eigen::Ref<Eigen::Vector3d> get_imu_linear_acceleration()
base linear acceleration from imu.
- Returns:
WARNING !!!! The method <acquire_sensors>”()” has to be called prior to any getter to have up to date data.
-
inline const std::array<bool, X> &get_motor_enabled()
get_motor_enabled
- Returns:
This gives the status (enabled/disabled) of each motors using the joint ordering convention.
-
inline const std::array<bool, X> &get_motor_ready()
get_motor_ready
- Returns:
This gives the status (enabled/disabled) of each motors using the joint ordering convention.
-
inline const std::array<bool, X / 2> &get_motor_board_enabled()
get_motor_board_enabled
- Returns:
This gives the status (enabled/disabled of the onboard control cards).
-
inline const std::array<int, X / 2> &get_motor_board_errors()
get_motor_board_errors
- Returns:
This gives the status (enabled/disabled of the onboard control cards).
-
inline bool has_error() const
has_error
- Returns:
Returns true if the robot hardware has an error, false otherwise.
-
inline bool is_calibrating()
is_calibrating()
- Returns:
Returns true if the calibration procedure is running right now.
-
inline int get_num_sent_command_packets() const
Get total number of command packets sent to the robot.
-
inline int get_num_lost_command_packets() const
Get number of lost command packets.
-
inline int get_num_sent_sensor_packets() const
Get total number of sensor packets sent by the robot.
-
inline int get_num_lost_sensor_packets() const
Get number of lost sensor packets.