mia_hand_ros_control
rel 1.0.0
|
Class hardware interface of the real Mia hand. More...
#include <mia_hw_interface.h>
Public Member Functions | |
MiaHWInterface () | |
Class constructor. More... | |
~MiaHWInterface () | |
Class distructor. More... | |
bool | init (ros::NodeHandle &root_nh, ros::NodeHandle &mia_hw_nh) override |
Initialize the class hardware interface and the robot hardware. More... | |
void | update (const ros::TimerEvent &e) |
Initialize the class hardware interface and the robot hardware. More... | |
void | read (const ros::Time &time, const ros::Duration &duration) override |
Read state data from the real robot hardware. More... | |
void | write (const ros::Time &time, const ros::Duration &duration) override |
Write data command to the real robot hardware. More... | |
Protected Types | |
enum | ControlMethod { EFFORT, POSITION, VELOCITY } |
Joints control methods. More... | |
Protected Member Functions | |
void | registerJointLimits (const std::string &joint_name, const std::vector< hardware_interface::JointHandle > &joint_handle, const std::vector< ControlMethod > ctrl_method, const ros::NodeHandle &joint_limit_nh, const urdf::Model *const urdf_model, int *const joint_type, double *const lower_limit, double *const upper_limit, double *const effort_limit) |
Register the joint limits of the real mia hardware. More... | |
void | InitBkLastCommands () |
Initialization of the arrays saving the last command received. More... | |
enum ControlMethod | SelectCtrMethod (enum ControlMethod last_joint_control_methods_, const double last_joint_velocity_command_, const double joint_velocity_command_, const double last_joint_position_command_, const double joint_position_command_) |
Select the control method to move the real mia hardware. More... | |
double | GetThumbOppPosition () |
Evaluate the position of the Mia thumb opposition joint. More... | |
std::string | getURDF (std::string param_name) const |
Get the name of the URDF. More... | |
bool | parseTransmissionsFromURDF (const std::string &urdf_string) |
Get the transmission names and type from the loaded URDF Get the trasnsmission names specified in the mia hand URDF to retrieve joints info as name, limits and type etc. More... | |
Protected Attributes | |
CppDriver | mia_ |
Low level driver of the Mia hand. More... | |
int | COM_number_ |
Number of the COM in which the Mia hand is plugged. More... | |
ros::NodeHandle | nh_ |
ROS node handle. More... | |
std::string | robot_description_ |
Generic name of the URDF to look for with #getURDF(std::string param_name). More... | |
std::vector< transmission_interface::TransmissionInfo > | URDFtransmissions_ |
Transmissions declared in the URDF. More... | |
hardware_interface::JointStateInterface | js_interface_ |
Interface for the real Mia joint state. More... | |
hardware_interface::PositionJointInterface | pj_interface_ |
Interface for the real Mia joint position commands. More... | |
hardware_interface::VelocityJointInterface | vj_interface_ |
Interface for the real Mia joint velocity commands. More... | |
hardware_interface::EffortJointInterface | ej_interface_ |
unused More... | |
joint_limits_interface::PositionJointSaturationInterface | pj_sat_interface_ |
Interface for the real Mia joint position saturation limit. More... | |
joint_limits_interface::PositionJointSoftLimitsInterface | pj_limits_interface_ |
Interface for the real joint position soft limit. More... | |
joint_limits_interface::VelocityJointSaturationInterface | vj_sat_interface_ |
Interface for the real Mia joint velocity saturation limit. More... | |
joint_limits_interface::VelocityJointSoftLimitsInterface | vj_limits_interface_ |
Interface for the real Mia joint velocity software limit. More... | |
joint_limits_interface::EffortJointSaturationInterface | ej_sat_interface_ |
unused More... | |
joint_limits_interface::EffortJointSoftLimitsInterface | ej_limits_interface_ |
unused More... | |
transmission_interface::MiaThfleTransmission | ThfleTrans |
Transmissions class implemented for the Mia hand thumb flexion joint. More... | |
transmission_interface::MiaMrlTransmission | MrlTrans |
Transmissions class implemented for the Mia hand mrl flexion joint. More... | |
transmission_interface::MiaIndexTransmission | IndexTrans |
Transmissions class implemented for the Mia hand mrl flexion joint. More... | |
std::vector< transmission_interface::Transmission * > | MiaTrasmissions |
Transmissions vector to handle the transmissions implemented for the real Mia hand. More... | |
std::vector< std::string > | trasmission_names_ |
Actual transmissions name. More... | |
transmission_interface::ActuatorToJointPositionInterface | act_to_jnt_pos_state |
Transmission interface for propagating current actuator position state to joint space. More... | |
transmission_interface::ActuatorToJointVelocityInterface | act_to_jnt_vel_state |
Transmission interface for propagating current velocity actuator state to joint space. More... | |
transmission_interface::JointToActuatorPositionInterface | jnt_to_act_pos |
Transmission interface for propagating joint position commands to actuator space. More... | |
transmission_interface::JointToActuatorVelocityInterface | jnt_to_act_vel |
Transmission interface for propagating joint velocity commands to actuator space Transmission interface used for Mia mrl and thumb flexion joints/actuators. More... | |
transmission_interface::MiaActuatorToJointPositionInterface | index_act_to_jnt_pos_state |
Transmission interface for propagating current actuator position state of the Mia index to joint space. More... | |
transmission_interface::MiaActuatorToJointVelocityInterface | index_act_to_jnt_vel_state |
Transmission interface for propagating current actuator velocity state of the Mia index to joint space. More... | |
transmission_interface::MiaJointToActuatorPositionInterface | index_jnt_to_act_pos |
Transmission interface for propagating joint position commands to actuator space. More... | |
transmission_interface::MiaJointToActuatorVelocityInterface | index_jnt_to_act_vel |
Transmission interface for propagating joint velocity commands to actuator space. More... | |
transmission_interface::ActuatorData | a_state_data [3] |
Actuator state data (one for transmission). More... | |
transmission_interface::ActuatorData | a_cmd_data [3] |
Actuator command data (one for transmission). More... | |
transmission_interface::JointData | j_state_data [3] |
Joint state data (one for transmission). More... | |
transmission_interface::JointData | j_cmd_data [3] |
joint command data (one for transmission). More... | |
mia_hand::thumb_opp_passive_joint | MyTh_opp_passiveJoint |
Class used to evaluate the target position of the Mia simulated thumb opposition joint. More... | |
Joint_index_mapping | joints_ii |
Joint_index_mapping struct. More... | |
unsigned int | write_counter |
Counter of the write method. More... | |
int | n_dof_sim_ |
Number of degree of freedom. More... | |
int | n_actuators_ |
std::vector< std::string > | joint_names_ |
Name of the joints as specified in the URDF. More... | |
std::vector< int > | joint_types_ |
Type of the joints specified in the URDF. More... | |
std::vector< double > | joint_position_state_ |
Actual position state of the joints of the Mia hardware. More... | |
std::vector< double > | joint_velocity_state_ |
Actual velocity state of the joints of the Mia hardware. More... | |
std::vector< double > | joint_effort_state_ |
Useless. More... | |
std::vector< double > | joint_position_command_ |
Actual position joint command for the Mia hardware. More... | |
std::vector< double > | joint_velocity_command_ |
Actual velocity joint command for the Mia hardware. More... | |
std::vector< double > | joint_effort_command_ |
Useless. More... | |
std::vector< double > | last_joint_position_command_ |
Last joint position command received for the Mia hardware. More... | |
std::vector< double > | last_joint_velocity_command_ |
Last joint velocity command received for the Mia hardware. More... | |
std::vector< double > | act_position_state_ |
Actual position state of the actuators of the Mia hardware. More... | |
std::vector< double > | act_velocity_state_ |
Actual velocity state of the actuators of the Mia hardware. More... | |
std::vector< double > | act_effort_state_ |
Useless. More... | |
std::vector< double > | act_position_command_ |
Actual position actuator command for the Mia hardware. More... | |
std::vector< double > | act_velocity_command_ |
Actual velocity actuator command for the Mia hardware. More... | |
std::vector< double > | act_effort_command_ |
Useless. More... | |
std::vector< ControlMethod > | joint_control_methods_ |
Actual control method for the joints of the Mia hardware. More... | |
std::vector< ControlMethod > | last_joint_control_methods_ |
Last control method used for the joints of the Mia hardware. More... | |
std::vector< std::vector< ControlMethod > > | List_joint_control_methods_ |
List of control method available for the joints of the Mia hardware. More... | |
std::vector< double > | joint_lower_limits_ |
Lower position limits of the joints of the Mia hardware (as specified in the URDF) More... | |
std::vector< double > | joint_upper_limits_ |
Upper position limits of the joints of the Mia hardware (as specified in the URDF). More... | |
std::vector< double > | joint_effort_limits_ |
Effort limit of the joints of the Mia hardware specified in the URDF (fake). More... | |
std::vector< double > | old_act_position_state_ |
Last position state of the actuator returned by the Mia hardware in the read() funtion. More... | |
int | read_counter |
Counter for the read() funtion. More... | |
Class hardware interface of the real Mia hand.
This class inherits from public hardware_interface::RobotHW.
Definition at line 77 of file mia_hw_interface.h.
|
protected |
Joints control methods.
All possible joints controlled methods allowed by ROS. NB. EFFORT control method is not allowed with Mia hand. It is included since in the URDF file efforts limits are usually specified.
Enumerator | |
---|---|
EFFORT | |
POSITION | |
VELOCITY |
Definition at line 134 of file mia_hw_interface.h.
mia_hand::MiaHWInterface::MiaHWInterface | ( | ) |
Class constructor.
Definition at line 23 of file mia_hw_interface.cpp.
mia_hand::MiaHWInterface::~MiaHWInterface | ( | ) |
Class distructor.
Definition at line 48 of file mia_hw_interface.cpp.
|
protected |
Evaluate the position of the Mia thumb opposition joint.
Since in the actual Mia hand the opposition of the thumb (passive joint) is coupled to the movement of the index flexion this function uses the sate of the index flexion joint of the mia hand hardware to evaluate the position that the actual thumb opposition has reached at the current time.
period | Time since the last simulation step. |
Definition at line 609 of file mia_hw_interface.cpp.
|
protected |
Get the name of the URDF.
A method taking the ros parameter urdf generic name and return the specific of the loaded URDF.
param_name | generic name of the param to look for. |
Definition at line 642 of file mia_hw_interface.cpp.
|
override |
Initialize the class hardware interface and the robot hardware.
Initialize the hardware driver, connect the COM port in which the Mia hand is plugged and initialize the hardware interface class, registering the needed interfaces and the joint limits.
root_nh | root node handle. |
mia_hw_nh | Mia hardware node handle. |
Definition at line 60 of file mia_hw_interface.cpp.
|
protected |
Initialization of the arrays saving the last command received.
Initialize the values of array variables ( last_joint_position_command_ and last_joint_velocity_command_ ) containing the last received command. They will be used to know which command (velocity or position) to send to the hand.
Definition at line 466 of file mia_hw_interface.cpp.
|
protected |
Get the transmission names and type from the loaded URDF Get the trasnsmission names specified in the mia hand URDF to retrieve joints info as name, limits and type etc.
urdf_string | URDF parameter name. |
Definition at line 676 of file mia_hw_interface.cpp.
|
override |
Read state data from the real robot hardware.
Read joint positions velocities from the real robot hardware.
time | The current time. |
duration | The time passed since the last call to read(). |
Definition at line 351 of file mia_hw_interface.cpp.
|
protected |
Register the joint limits of the real mia hardware.
Register the limits of the joint specified by joint_name and joint_handle. The limits are retrieved from joint_limit_nh. If urdf_model is not NULL, limits are retrieved from it also.
joint_name | Name of the joint whose limits has to be registered. |
joint_handle | Handler of the joint. |
ctrl_method | Array of enum describe the control methods available for that joint. |
joint_limit_nh | Joint node handle. |
urdf_model | URDF model. |
joint_type | Joint type (e.g. urdf::Joint::REVOLUTE). |
lower_limit | Lower position limit of the joint returned by this method. |
upper_limit | Upper position limit of the joint returned by this method. |
effort_limit | Effortlimit of the joint returned by this method (unused). |
Definition at line 485 of file mia_hw_interface.cpp.
|
protected |
Select the control method to move the real mia hardware.
Since velocity and position interfaces are both loaded for each joint, this method recognize wich type of control the received new command requires.
last_joint_control_methods_ | Last type of control method used for the joint. |
last_joint_velocity_command_ | Last velocity command received for the joint. |
joint_velocity_command_ | Actual velocity command received for the joint. |
last_joint_position_command_ | Last position command received for the joint. |
joint_position_command_ | Actual position command received for the joint. |
Definition at line 622 of file mia_hw_interface.cpp.
void mia_hand::MiaHWInterface::update | ( | const ros::TimerEvent & | e | ) |
Initialize the class hardware interface and the robot hardware.
|
override |
Write data command to the real robot hardware.
Write position or velocities command data to the robot hardware.
time | The current time. |
duration | The time passed since the last call to read(). |
Definition at line 396 of file mia_hw_interface.cpp.
|
protected |
Actuator command data (one for transmission).
Definition at line 331 of file mia_hw_interface.h.
|
protected |
Actuator state data (one for transmission).
Definition at line 330 of file mia_hw_interface.h.
|
protected |
Useless.
Definition at line 381 of file mia_hw_interface.h.
|
protected |
Useless.
Definition at line 377 of file mia_hw_interface.h.
|
protected |
Actual position actuator command for the Mia hardware.
Definition at line 379 of file mia_hw_interface.h.
|
protected |
Actual position state of the actuators of the Mia hardware.
Definition at line 375 of file mia_hw_interface.h.
|
protected |
Transmission interface for propagating current actuator position state to joint space.
Transmission interface used for Mia mrl and thumb flexion joints/actuators.
Definition at line 283 of file mia_hw_interface.h.
|
protected |
Transmission interface for propagating current velocity actuator state to joint space.
Transmission interface used for Mia mrl and thumb flexion joints/actuators.
Definition at line 289 of file mia_hw_interface.h.
|
protected |
Actual velocity actuator command for the Mia hardware.
Definition at line 380 of file mia_hw_interface.h.
|
protected |
Actual velocity state of the actuators of the Mia hardware.
Definition at line 376 of file mia_hw_interface.h.
|
protected |
Number of the COM in which the Mia hand is plugged.
Definition at line 217 of file mia_hw_interface.h.
|
protected |
unused
Definition at line 240 of file mia_hw_interface.h.
|
protected |
unused
Definition at line 248 of file mia_hw_interface.h.
|
protected |
unused
Definition at line 247 of file mia_hw_interface.h.
|
protected |
Transmission interface for propagating current actuator position state of the Mia index to joint space.
Transmission interface used for Mia index flexion joints/actuators.
Definition at line 307 of file mia_hw_interface.h.
|
protected |
Transmission interface for propagating current actuator velocity state of the Mia index to joint space.
Transmission interface used for Mia index flexion joints/actuators.
Definition at line 313 of file mia_hw_interface.h.
|
protected |
Transmission interface for propagating joint position commands to actuator space.
Transmission interface used for Mia index flexion joints/actuators.
Definition at line 319 of file mia_hw_interface.h.
|
protected |
Transmission interface for propagating joint velocity commands to actuator space.
Transmission interface used for Mia index flexion joints/actuators.
Definition at line 325 of file mia_hw_interface.h.
|
protected |
Transmissions class implemented for the Mia hand mrl flexion joint.
Definition at line 269 of file mia_hw_interface.h.
|
protected |
joint command data (one for transmission).
Definition at line 334 of file mia_hw_interface.h.
|
protected |
Joint state data (one for transmission).
Definition at line 333 of file mia_hw_interface.h.
|
protected |
Transmission interface for propagating joint position commands to actuator space.
Transmission interface used for Mia mrl and thumb flexion joints/actuators.
Definition at line 295 of file mia_hw_interface.h.
|
protected |
Transmission interface for propagating joint velocity commands to actuator space Transmission interface used for Mia mrl and thumb flexion joints/actuators.
Definition at line 301 of file mia_hw_interface.h.
|
protected |
Actual control method for the joints of the Mia hardware.
Definition at line 384 of file mia_hw_interface.h.
|
protected |
Useless.
Definition at line 370 of file mia_hw_interface.h.
|
protected |
Effort limit of the joints of the Mia hardware specified in the URDF (fake).
Definition at line 391 of file mia_hw_interface.h.
|
protected |
Useless.
Definition at line 366 of file mia_hw_interface.h.
|
protected |
Lower position limits of the joints of the Mia hardware (as specified in the URDF)
Definition at line 388 of file mia_hw_interface.h.
|
protected |
Name of the joints as specified in the URDF.
Definition at line 361 of file mia_hw_interface.h.
|
protected |
Actual position joint command for the Mia hardware.
Definition at line 368 of file mia_hw_interface.h.
|
protected |
Actual position state of the joints of the Mia hardware.
Definition at line 364 of file mia_hw_interface.h.
|
protected |
Type of the joints specified in the URDF.
Definition at line 362 of file mia_hw_interface.h.
|
protected |
Upper position limits of the joints of the Mia hardware (as specified in the URDF).
Definition at line 389 of file mia_hw_interface.h.
|
protected |
Actual velocity joint command for the Mia hardware.
Definition at line 369 of file mia_hw_interface.h.
|
protected |
Actual velocity state of the joints of the Mia hardware.
Definition at line 365 of file mia_hw_interface.h.
|
protected |
Joint_index_mapping struct.
Struct that stores the index number of the simulated mia hand joint as contained in the interfaces and arrays of this class
Definition at line 354 of file mia_hw_interface.h.
|
protected |
Interface for the real Mia joint state.
Definition at line 237 of file mia_hw_interface.h.
|
protected |
Last control method used for the joints of the Mia hardware.
Definition at line 385 of file mia_hw_interface.h.
|
protected |
Last joint position command received for the Mia hardware.
Definition at line 372 of file mia_hw_interface.h.
|
protected |
Last joint velocity command received for the Mia hardware.
Definition at line 373 of file mia_hw_interface.h.
|
protected |
List of control method available for the joints of the Mia hardware.
Definition at line 386 of file mia_hw_interface.h.
|
protected |
Low level driver of the Mia hand.
Definition at line 216 of file mia_hw_interface.h.
|
protected |
Transmissions vector to handle the transmissions implemented for the real Mia hand.
Definition at line 274 of file mia_hw_interface.h.
|
protected |
Transmissions class implemented for the Mia hand mrl flexion joint.
Definition at line 263 of file mia_hw_interface.h.
|
protected |
Class used to evaluate the target position of the Mia simulated thumb opposition joint.
Class describing the relation between the position of the Mia index flexion joint and the dependent one of the thumb opposition. This class is implemented in the mia_hand_description pkg.
Definition at line 343 of file mia_hw_interface.h.
|
protected |
Definition at line 358 of file mia_hw_interface.h.
|
protected |
Number of degree of freedom.
Definition at line 357 of file mia_hw_interface.h.
|
protected |
ROS node handle.
Definition at line 219 of file mia_hw_interface.h.
|
protected |
Last position state of the actuator returned by the Mia hardware in the read() funtion.
Definition at line 394 of file mia_hw_interface.h.
|
protected |
Interface for the real Mia joint position commands.
Definition at line 238 of file mia_hw_interface.h.
|
protected |
Interface for the real joint position soft limit.
Definition at line 243 of file mia_hw_interface.h.
|
protected |
Interface for the real Mia joint position saturation limit.
Definition at line 242 of file mia_hw_interface.h.
|
protected |
Counter for the read() funtion.
Definition at line 395 of file mia_hw_interface.h.
|
protected |
Generic name of the URDF to look for with #getURDF(std::string param_name).
Definition at line 227 of file mia_hw_interface.h.
|
protected |
Transmissions class implemented for the Mia hand thumb flexion joint.
Definition at line 257 of file mia_hw_interface.h.
|
protected |
Actual transmissions name.
Definition at line 276 of file mia_hw_interface.h.
|
protected |
Transmissions declared in the URDF.
Definition at line 232 of file mia_hw_interface.h.
|
protected |
Interface for the real Mia joint velocity commands.
Definition at line 239 of file mia_hw_interface.h.
|
protected |
Interface for the real Mia joint velocity software limit.
Definition at line 245 of file mia_hw_interface.h.
|
protected |
Interface for the real Mia joint velocity saturation limit.
Definition at line 244 of file mia_hw_interface.h.
|
protected |
Counter of the write method.
Definition at line 356 of file mia_hw_interface.h.