mia_hand_gazebo
rel 1.0.0
|
Class hardware sim interface of the simulated Mia hand. More...
#include <Mia_hw_sim.h>
Public Member Functions | |
virtual bool | initSim (const std::string &robot_namespace, ros::NodeHandle model_nh, gazebo::physics::ModelPtr parent_model, const urdf::Model *const urdf_model, std::vector< transmission_interface::TransmissionInfo > transmissions) |
Initialize the simulated robot hardware. More... | |
virtual void | readSim (ros::Time time, ros::Duration period) |
Read state data from the simulated robot hardware. More... | |
virtual void | writeSim (ros::Time time, ros::Duration period) |
Send commands to the simulated robot hardware. More... | |
virtual void | eStopActive (const bool active) |
Unused. More... | |
Protected Types | |
enum | ControlMethod { EFFORT, POSITION, POSITION_PID, VELOCITY, VELOCITY_PID } |
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 simulated hardware. More... | |
double | GetThumbOppPosition (ros::Duration period) |
Evaluate the position of the Mia thumb opposition joint. More... | |
bool | GetMiddlePosition (double joint_position_m, double joint_position_r, double joint_position_l, double flex_direction) |
Evaluate if any of the Mia simulated middle ring or little flexion joint is stuck. More... | |
enum ControlMethod | SelectCtrMethod (enum MiaHWSim::ControlMethod Default_joint_control_methods_, 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 simulated hardware. More... | |
Protected Attributes | |
Joint_index_mapping | joints_ii |
Joint_index_mapping struct. More... | |
unsigned int | n_dof_ |
Number of degree of freedom of the simulated hardware. More... | |
unsigned int | write_counter |
Counter of the write method. More... | |
hardware_interface::JointStateInterface | js_interface_ |
Interface for simulated joint state. More... | |
hardware_interface::EffortJointInterface | ej_interface_ |
Interface for simulated joint effort commands. More... | |
hardware_interface::PositionJointInterface | pj_interface_ |
Interface for simulated joint position commands. More... | |
hardware_interface::VelocityJointInterface | vj_interface_ |
Interface for simulated joint velocity commands. More... | |
joint_limits_interface::EffortJointSaturationInterface | ej_sat_interface_ |
Interface for simulated joint effort saturation limit. More... | |
joint_limits_interface::EffortJointSoftLimitsInterface | ej_limits_interface_ |
Interface for simulated joint effort soft limit. More... | |
joint_limits_interface::PositionJointSaturationInterface | pj_sat_interface_ |
Interface for simulated joint position saturation limit. More... | |
joint_limits_interface::PositionJointSoftLimitsInterface | pj_limits_interface_ |
Interface for simulated joint position sodt limit. More... | |
joint_limits_interface::VelocityJointSaturationInterface | vj_sat_interface_ |
Interface for simulated joint velocity saturation limit. More... | |
joint_limits_interface::VelocityJointSoftLimitsInterface | vj_limits_interface_ |
Interface for simulated joint velocity soft limit. More... | |
std::vector< std::string > | joint_names_ |
Name of the joints of the simulated hardware. More... | |
std::vector< int > | joint_types_ |
Type of the joints of the simulated hardware. More... | |
std::vector< double > | joint_lower_limits_ |
Lower position limits of the joints of the simulated hardware. More... | |
std::vector< double > | joint_upper_limits_ |
Upper position limits of the joints of the simulated hardware. More... | |
std::vector< double > | joint_effort_limits_ |
Effort upper limits of the joints of the simulated hardware. More... | |
std::vector< double > | joint_position_ |
Actual position state of the joints of the simulated hardware. More... | |
std::vector< double > | joint_velocity_ |
Actual velocity state of the joints of the simulated hardware. More... | |
std::vector< double > | joint_effort_ |
Actual effort state of the joints of the simulated hardware. More... | |
std::vector< double > | joint_effort_command_ |
Actual effort command of the joints of the simulated hardware. More... | |
std::vector< double > | last_joint_effort_command_ |
Last effort command of the joints of the simulated hardware. More... | |
std::vector< double > | joint_position_command_ |
Actual position command of the joints of the simulated hardware. More... | |
std::vector< double > | last_joint_position_command_ |
Last position command of the joints of the simulated hardware. More... | |
std::vector< double > | joint_velocity_command_ |
Actual velocity command of the joints of the simulated hardware. More... | |
std::vector< double > | last_joint_velocity_command_ |
Last velocity command of the joints of the simulated hardware. More... | |
std::vector< ControlMethod > | last_joint_control_methods_ |
Last control method used for the joints of the simulated hardware. More... | |
std::vector< ControlMethod > | joint_control_methods_ |
Actual control method for the joints of the simulated hardware. More... | |
std::vector< std::vector< ControlMethod > > | List_joint_control_methods_ |
List of control method available for the joints of the simulated hardware. More... | |
std::vector< control_toolbox::Pid > | pid_controllers_ |
double * | j_index_flex_pos |
Pointer to the position status of Mia simulated index flexion joint. More... | |
double | j_index_flex_pos_Th |
Threshold used for the simulated index flexion position control to switch its sign. More... | |
int | j_index_flex_sign |
Current sign of the Mia simulated index flexion joint. More... | |
double | jThOpp_Target_position |
Target position of the Mia simulated thumb opposition joint evaluated by this class. More... | |
double | jMiddle_StackTarget_position |
Target position of the Mia simulated middle flexion joint when ring and/or little get stuck. More... | |
bool | mrl_united |
If True then middle ring little fingers are physical connected in the URDF, False if they ate independent joints. 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... | |
std::vector< gazebo::physics::JointPtr > | sim_joints_ |
Gazebo joint pointer. More... | |
bool | e_stop_active_ |
bool | last_e_stop_active_ |
Unused. More... | |
Class hardware sim interface of the simulated Mia hand.
This class inherits from public gazebo_ros_control::RobotHWSim and it can be used also when the Mia hand is mounted on another robots that work with the gazebo_ros_control::DefaultRobotHWSim class. In this case this class is able to control both the simulated mia hand and the other robot components.
Definition at line 71 of file Mia_hw_sim.h.
|
protected |
Joints control methods.
All possible joints controlled methods allowed by ROS control
Enumerator | |
---|---|
EFFORT | |
POSITION | |
POSITION_PID | |
VELOCITY | |
VELOCITY_PID |
Definition at line 117 of file Mia_hw_sim.h.
|
virtual |
Unused.
Definition at line 1258 of file Mia_hw_sim.cpp.
|
protected |
Evaluate if any of the Mia simulated middle ring or little flexion joint is stuck.
Since in the actual Mia hand the middle, little and ring flexion JointState are coupled, while in the Mia simulated model are not (since they have different rotation axis) this fucntion has the aim to avoid that the difference among the position of these joints exceeds a certain threshold, simulating the behaviour of coupled joints.
joint_position_m | Position of the Mia simulated middle flexion joint. |
joint_position_r | Position of the Mia simulated ring flexion joint. |
joint_position_l | Position of the Mia simulated little flexion joint. |
flex_direction | direction of the ongoing flexion movement. |
Definition at line 1211 of file Mia_hw_sim.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 simulated mia hand to evaluate the position that the simulated thumb opposition joint has to reach at every simulation step.
period | Time since the last simulation step. |
Definition at line 1186 of file Mia_hw_sim.cpp.
|
virtual |
Initialize the simulated robot hardware.
Initialize the simulated robot hardware by register the correct ros control interfaces and the joint limits.
robot_namespace | Robot namespace. |
model_nh | Model node handle. |
parent_model | Parent model. |
urdf_model | URDF model. |
transmissions | Transmissions. |
Definition at line 31 of file Mia_hw_sim.cpp.
|
virtual |
Read state data from the simulated robot hardware.
Read joint positions velocities and efforts from the simulated robot hardware.
time | Simulation time. |
period | Time since the last simulation step. |
Definition at line 501 of file Mia_hw_sim.cpp.
|
protected |
Register the joint limits of the simulated 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. |
Definition at line 365 of file Mia_hw_sim.cpp.
|
protected |
Select the control method to move the simulated hardware.
Since velocity and position interfaces are both loaded for each joint, this method recognize wich type of control the received new command requires.
Default_joint_control_methods_ | Default control method for the joint. |
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 1161 of file Mia_hw_sim.cpp.
|
virtual |
Send commands to the simulated robot hardware.
Send command as joint positions or velocities or efforts to the simulated robot hardware.
time | Simulation time. |
period | Time since the last simulation step. |
Definition at line 575 of file Mia_hw_sim.cpp.
|
protected |
Definition at line 257 of file Mia_hw_sim.h.
|
protected |
Interface for simulated joint effort commands.
Definition at line 202 of file Mia_hw_sim.h.
|
protected |
Interface for simulated joint effort soft limit.
Definition at line 207 of file Mia_hw_sim.h.
|
protected |
Interface for simulated joint effort saturation limit.
Definition at line 206 of file Mia_hw_sim.h.
|
protected |
Pointer to the position status of Mia simulated index flexion joint.
Definition at line 237 of file Mia_hw_sim.h.
|
protected |
Threshold used for the simulated index flexion position control to switch its sign.
Definition at line 238 of file Mia_hw_sim.h.
|
protected |
Current sign of the Mia simulated index flexion joint.
Definition at line 239 of file Mia_hw_sim.h.
|
protected |
Target position of the Mia simulated middle flexion joint when ring and/or little get stuck.
Definition at line 241 of file Mia_hw_sim.h.
|
protected |
Actual control method for the joints of the simulated hardware.
Definition at line 231 of file Mia_hw_sim.h.
|
protected |
Actual effort state of the joints of the simulated hardware.
Definition at line 222 of file Mia_hw_sim.h.
|
protected |
Actual effort command of the joints of the simulated hardware.
Definition at line 223 of file Mia_hw_sim.h.
|
protected |
Effort upper limits of the joints of the simulated hardware.
Definition at line 218 of file Mia_hw_sim.h.
|
protected |
Lower position limits of the joints of the simulated hardware.
Definition at line 216 of file Mia_hw_sim.h.
|
protected |
Name of the joints of the simulated hardware.
Definition at line 214 of file Mia_hw_sim.h.
|
protected |
Actual position state of the joints of the simulated hardware.
Definition at line 220 of file Mia_hw_sim.h.
|
protected |
Actual position command of the joints of the simulated hardware.
Definition at line 225 of file Mia_hw_sim.h.
|
protected |
Type of the joints of the simulated hardware.
Definition at line 215 of file Mia_hw_sim.h.
|
protected |
Upper position limits of the joints of the simulated hardware.
Definition at line 217 of file Mia_hw_sim.h.
|
protected |
Actual velocity state of the joints of the simulated hardware.
Definition at line 221 of file Mia_hw_sim.h.
|
protected |
Actual velocity command of the joints of the simulated hardware.
Definition at line 227 of file Mia_hw_sim.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 195 of file Mia_hw_sim.h.
|
protected |
Interface for simulated joint state.
Definition at line 201 of file Mia_hw_sim.h.
|
protected |
Target position of the Mia simulated thumb opposition joint evaluated by this class.
Definition at line 240 of file Mia_hw_sim.h.
|
protected |
Unused.
Definition at line 257 of file Mia_hw_sim.h.
|
protected |
Last control method used for the joints of the simulated hardware.
Definition at line 229 of file Mia_hw_sim.h.
|
protected |
Last effort command of the joints of the simulated hardware.
Definition at line 224 of file Mia_hw_sim.h.
|
protected |
Last position command of the joints of the simulated hardware.
Definition at line 226 of file Mia_hw_sim.h.
|
protected |
Last velocity command of the joints of the simulated hardware.
Definition at line 228 of file Mia_hw_sim.h.
|
protected |
List of control method available for the joints of the simulated hardware.
Definition at line 232 of file Mia_hw_sim.h.
|
protected |
If True then middle ring little fingers are physical connected in the URDF, False if they ate independent joints.
Definition at line 242 of file Mia_hw_sim.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 251 of file Mia_hw_sim.h.
|
protected |
Number of degree of freedom of the simulated hardware.
Definition at line 197 of file Mia_hw_sim.h.
|
protected |
Definition at line 234 of file Mia_hw_sim.h.
|
protected |
Interface for simulated joint position commands.
Definition at line 203 of file Mia_hw_sim.h.
|
protected |
Interface for simulated joint position sodt limit.
Definition at line 209 of file Mia_hw_sim.h.
|
protected |
Interface for simulated joint position saturation limit.
Definition at line 208 of file Mia_hw_sim.h.
|
protected |
Gazebo joint pointer.
Definition at line 254 of file Mia_hw_sim.h.
|
protected |
Interface for simulated joint velocity commands.
Definition at line 204 of file Mia_hw_sim.h.
|
protected |
Interface for simulated joint velocity soft limit.
Definition at line 211 of file Mia_hw_sim.h.
|
protected |
Interface for simulated joint velocity saturation limit.
Definition at line 210 of file Mia_hw_sim.h.
|
protected |
Counter of the write method.
Definition at line 198 of file Mia_hw_sim.h.