mia_hand_ros_control  rel 1.0.0
mia_hw_interface.cpp
Go to the documentation of this file.
1 /*********************************************************************************************************
2  Modifyed by Author: Prensilia srl
3  Desc: Hardware interface of the MIA hand
4 
5  version 1.0
6 
7 **********************************************************************************************************/
8 
9 #include <iostream>
11 
12 using hardware_interface::JointStateHandle;
13 using hardware_interface::JointHandle;
14 using transmission_interface::JointToActuatorPositionHandle;
15 using transmission_interface::JointToActuatorVelocityHandle;
16 using transmission_interface::ActuatorToJointStateHandle;
17 
18 namespace mia_hand
19 {
21  //Class constructor: Initialize com and Urdf name getting ros parameters
24  {
25  robot_description_ = "robot_description"; // default
26  n_dof_sim_ = 6; // as declared in the URDF
27  write_counter = 0;
28  read_counter = 0; // to delete
29  n_actuators_ = 3;
30 
31  //Get Server IP address
32  if (ros::param::has("~Mia_COM_"))
33  {
34  ros::param::get("~Mia_COM_", COM_number_);
35  }
36  else
37  {
38  COM_number_ = 1; // default value
39  ros::param::set("~Mia_COM_", 1);
40 
41  }
42 
43  }
44 
46  //Class distructor: Stop Mia data stream and disconnect mia hardware
49  {
50  // Disable Mia streaming
51  mia_.switchPosStream(false);
52  mia_.switchSpeStream(false);
53 
54  mia_.disconnect();
55  }
56 
58  //init: Initialize class and hardware
60  bool MiaHWInterface::init(ros::NodeHandle &root_nh, ros::NodeHandle &mia_hw_nh)
61  {
62  nh_ = mia_hw_nh;
63  ROS_INFO_NAMED("MiaHWInterface","Initialization of MiaHWInterface" );
64 
65  // Initialize passive joint thumb_opp + Index_fle
66  const bool load = false;
67  MyTh_opp_passiveJoint.init(load); // initialize without loading now URDF
68 
69 
70  // connect Mia hand
71 
72  bool port_opened = mia_.connectToPort(COM_number_);
73 
74  if (port_opened)
75  {
76  std::string info_msg = "/dev/ttyUSB successfully opened.";
77  info_msg.insert(11, std::to_string(COM_number_));
78  ROS_INFO_NAMED("MiaHWInterface", "%s\n", info_msg.c_str());
79  }
80  else
81  {
82  std::string info_msg = "/dev/ttyUSB can not be open.";
83  info_msg.insert(11, std::to_string(COM_number_));
84  ROS_ERROR_NAMED("MiaHWInterface", "%s\n", info_msg.c_str());
85  return false;
86  }
87 
88 
89  if(!ros::isInitialized())
90  {
91  ROS_FATAL_STREAM_NAMED("MiaHWInterface","Ros has not been initialized");
92  return false;
93  }
94 
95  // Get Transmission number declared in the URDF to know which joint are actuated
96  const std::string urdf_string = getURDF(robot_description_);
97 
98 
99 
100  if (!parseTransmissionsFromURDF(urdf_string))
101  {
102  ROS_ERROR_NAMED("MiaHWInterface", "Error parsing URDF in MiaHWInterface, MiaHWInterface not active.\n");
103  return false;
104  }
105 
106  // get URDF model
107  urdf::Model urdf_model;
108  const urdf::Model *const urdf_model_ptr = urdf_model.initString(urdf_string) ? &urdf_model : NULL;
109 
110 
111  // getJointLimits() searches joint_limit_nh for joint limit parameters. The format of each
112  // parameter's name is "joint_limits/<joint name>". An example is "joint_limits/axle_joint".
113  const ros::NodeHandle joint_limit_nh(nh_);
114 
115 
116 
117  // Resize variables
118  joint_names_.resize(n_dof_sim_);
119  joint_types_.resize(n_dof_sim_);
123 
127 
131 
135 
139 
140  MiaTrasmissions.resize(n_dof_sim_);
142 
148 
149  // TO DELETE
151 
152  // scan the joints in the URDF and find the Mia joints and register them
153 
154  int URDF_n_dof_sim_ = URDFtransmissions_.size();
155 
156 
157 
158  for(unsigned int j=0; j < URDF_n_dof_sim_; j++)
159  {
160  // Check that this transmission has one joint
161  if(URDFtransmissions_[j].joints_.size() == 0)
162  {
163  ROS_WARN_STREAM_NAMED("MiaHWInterface","URDFTransmission " << URDFtransmissions_[j].name_
164  << " has no associated joints.");
165  continue;
166  }
167 
168  std::vector<std::string> joint_interfaces = URDFtransmissions_[j].joints_[0].hardware_interfaces_;
169 
170  if (joint_interfaces.empty() &&
171  !(URDFtransmissions_[j].actuators_.empty()) &&
172  !(URDFtransmissions_[j].actuators_[0].hardware_interfaces_.empty())) // Deprecate HW interface specification in actuators in ROS J
173  {
174  joint_interfaces = URDFtransmissions_[j].actuators_[0].hardware_interfaces_;
175  }
176 
177  if (joint_interfaces.empty())
178  {
179  ROS_WARN_STREAM_NAMED("MiaHWInterface", "Joint " << URDFtransmissions_[j].joints_[0].name_ <<
180  " of URDFtransmission " << URDFtransmissions_[j].name_ << " does not specify any hardware interface. " <<
181  "Not adding it to the robot hardware simulation.");
182  continue;
183  }
184 
185  const std::string temp_joint_name = URDFtransmissions_[j].joints_[0].name_;
186 
187 
188  // Add data from URDFtransmission and save the position of eac joints
189  int k ;
190 
191  if (temp_joint_name == "j_thumb_fle" )
192  {
193  k = 0;
196  trasmission_names_[k] = "MiaThumbTrans";
197  }
198  else if (temp_joint_name == "j_index_fle" )
199  {
200  k = 2;
203  trasmission_names_[k] = "MiaIndexTrans";
204 
205  }
206  else if (temp_joint_name == "j_mrl_fle" )
207  {
208  k = 1;
209  joints_ii.j_mrl_flex = k;
211  trasmission_names_[k] = "MiaMrlTrans";
212  }
213  else if (temp_joint_name == "j_ring_fle" )
214  {
215  k = 3;
216  joints_ii.j_mrl_2 = k;
217  }
218  else if (temp_joint_name == "j_little_fle" )
219  {
220  k= 4;
221  joints_ii.j_mrl_3 = k;
222  }
223  else if (temp_joint_name == "j_thumb_opp" )
224  {
225  k = 5;
227  }
228  else
229  {
230  continue; // ignore joints that are not of the MIA Hand
231  }
232 
233 
234  // Initialize vector where to store state commands and actuartor data
235  joint_names_[k] = URDFtransmissions_[j].joints_[0].name_;
236  joint_position_state_[k] = 0;
237  joint_velocity_state_[k] = 0.0;
238  joint_effort_state_[k] = 1.0; // N/m for continuous joints
239 
240  joint_position_command_[k] = 0.0;
241  joint_velocity_command_[k] = 0.0;
242  joint_effort_command_[k] = 0.0;
243 
244 
245  act_position_state_[k] = 0.0;
246  act_velocity_state_[k] = 0.0;
247  act_effort_state_[k] = 0.0;
248 
249  act_position_command_ [k] = 0.0;
250  act_velocity_command_ [k] = 0.0;
251  act_effort_command_ [k] = 0.0;
252 
253  List_joint_control_methods_[k].resize(2);
254 
255 
256  // Register Joint State interface for the joint
257  js_interface_.registerHandle(hardware_interface::JointStateHandle(
259 
260  // Register Joint Position and Joint Velocity interface for the joint
261  std::vector< hardware_interface::JointHandle> joint_handle;
262  joint_handle.resize(2);
263 
266  joint_handle[0] = hardware_interface::JointHandle(js_interface_.getHandle(joint_names_[k]),
268 
269 
270  pj_interface_.registerHandle(joint_handle[0]);
271 
273  joint_handle[1] = hardware_interface::JointHandle(js_interface_.getHandle(joint_names_[k]),
275  vj_interface_.registerHandle(joint_handle[1]);
276 
277 
278  // Get joint Limits
280  joint_limit_nh, urdf_model_ptr,
283 
284 
285 
286 
287  // Initialize trasmission varibales for 3 joints: thumb (k=0) index (k=1) and mrl flex (k=2)
288  if( k >= 0 && k <= 2)
289  {
290  // Wrap state raw data
291  a_state_data[k].position.push_back(&act_position_state_[k]);
292  a_state_data[k].velocity.push_back(&act_velocity_state_[k]);
293  a_state_data[k].effort.push_back(&act_effort_state_[k]);
294 
295  j_state_data[k].position.push_back(&joint_position_state_[k]);
296  j_state_data[k].velocity.push_back(&joint_velocity_state_[k]);
297  j_state_data[k].effort.push_back(&joint_effort_state_[k]);
298 
299  // Wrap command data
300  a_cmd_data[k].position.push_back(&act_position_command_[k]);
301  a_cmd_data[k].velocity.push_back(&act_velocity_command_[k]);
302 
303  j_cmd_data[k].position.push_back(&joint_position_command_[k]);
304  j_cmd_data[k].velocity.push_back(&joint_velocity_command_[k]);
305 
306  // Register transmissions to each interface
307  if( k == joints_ii.j_index_flex ) // IndexTrans
308  {
311 
314  }
315  else
316  {
317  act_to_jnt_pos_state.registerHandle(transmission_interface::ActuatorToJointPositionHandle(trasmission_names_[k], MiaTrasmissions[k], a_state_data[k], j_state_data[k]));
318  act_to_jnt_vel_state.registerHandle(transmission_interface::ActuatorToJointVelocityHandle(trasmission_names_[k], MiaTrasmissions[k], a_state_data[k], j_state_data[k]));
319 
320  jnt_to_act_pos.registerHandle(transmission_interface::JointToActuatorPositionHandle(trasmission_names_[k], MiaTrasmissions[k], a_cmd_data[k], j_cmd_data[k]));
321  jnt_to_act_vel.registerHandle(transmission_interface::JointToActuatorVelocityHandle(trasmission_names_[k], MiaTrasmissions[k], a_cmd_data[k], j_cmd_data[k]));
322  }
323  // ROS_WARN_STREAM_NAMED("MiaHWInterface", "k " << k <<", Name" << joint_names_[k] <<", trasm" << trasmission_names_[k] );
324 
325 
326  }
327 
328  }
329 
330  // Update the passive joints limit
333 
334  // Register interfaces
335  registerInterface(&js_interface_);
336  registerInterface(&ej_interface_);
337  registerInterface(&pj_interface_);
338  registerInterface(&vj_interface_);
339 
340  // Enable Mia streaming
341  mia_.switchPosStream(true);
342  mia_.switchSpeStream(true);
343 
344  return true;
345  }
346 
347 
349  //read: Read actuator state from hardware and propagate to joint spce
351  void MiaHWInterface::read(const ros::Time& time, const ros::Duration& duration)
352  {
353  // Get from Mia hand
354  for (uint8_t jnt = 0; jnt < n_actuators_; jnt++)
355  {
356  act_position_state_[jnt] = (double)mia_.getMotorPos(jnt);
357  act_velocity_state_[jnt] = (double)mia_.getMotorSpe(jnt);
358 
359  if (read_counter== 0 )
360  {
362  read_counter ++ ;
363  }
364  else
365  {
369  }
370  }
371 
372 
373  // propagate state trasmission
374  act_to_jnt_pos_state.propagate();
375  act_to_jnt_vel_state.propagate();
378 
379  // update the sate of the other passive joints (helpfull for visualization tools)
382 
385 
388 
389  return;
390  }
391 
393  //write: Get joint target from ros interfaces, propagate to the actuator space and
394  // Write the actuator target to the hardware.
396  void MiaHWInterface::write(const ros::Time& time, const ros::Duration& duration)
397  {
398  /* Selectively send position or speed command according to
399  * the external commands sent by the controllers.
400  */
401  if(write_counter == 0)
402  {
404  }
405 
406  // Enforce limits
407  pj_sat_interface_.enforceLimits(duration);
408  pj_limits_interface_.enforceLimits(duration);
409  vj_sat_interface_.enforceLimits(duration);
410  vj_limits_interface_.enforceLimits(duration);
411 
412  for(unsigned int j=0; j < n_actuators_; j++)
413  {
414 
415  // Select the control method for the current joint
421 
422  // update backup
425  last_joint_control_methods_[j] = joint_control_methods_[j]; // save for the next iteration
426 
427  switch (joint_control_methods_[j])
428  {
429  case POSITION:
430  {
431  // Propagate cmd to actuator space
432  if(j == joints_ii.j_index_flex)
434 
435  else
436  jnt_to_act_pos.propagate();
437 
438 
439  // send command to Mia
440  mia_.setMotorPos( j, (int16_t)act_position_command_[j]);
441  }
442  break;
443 
444  case VELOCITY:
445  {
446  // Propagate cmd to actuator space
447  if(j == joints_ii.j_index_flex)
449  else
450  jnt_to_act_vel.propagate();
451 
452  // send command to Mia
453  mia_.setMotorSpe( j, (int16_t)act_velocity_command_[j]);
454  }
455  break;
456 
457  } // end switch
458  }// end for joint
459 
460  return;
461  }
462 
464  // InitBkLastCommands: Initialize the arrays saving the last received joint command.
467  {
468  for(unsigned int j=0; j < n_actuators_; j++)
469  {
470  // for the first iteration initialize the last command and the last joint position status
473  //last_joint_effort_command_[j] = joint_effort_command_[j];
474 
476  }
477  write_counter++;
478  }
479 
481  // RegisterJointLimits:Register the limits of the joint specified by joint_name and joint_handle.
482  // The limits are retrieved from joint_limit_nh. If urdf_model is not NULL, limits are retrieved from it also.
483  // Return the joint's type, lower position limit, upper position limit, and effort limit.
485  void MiaHWInterface::registerJointLimits(const std::string& joint_name,
486  const std::vector<hardware_interface::JointHandle>& joint_handle,
487  const std::vector<ControlMethod> ctrl_method,
488  const ros::NodeHandle& joint_limit_nh,
489  const urdf::Model *const urdf_model,
490  int *const joint_type, double *const lower_limit,
491  double *const upper_limit, double *const effort_limit)
492  {
493  // Initialize variables
494  *joint_type = urdf::Joint::UNKNOWN;
495  *lower_limit = -std::numeric_limits<double>::max();
496  *upper_limit = std::numeric_limits<double>::max();
497  *effort_limit = std::numeric_limits<double>::max();
498 
499  joint_limits_interface::JointLimits limits;
500  bool has_limits = false;
501  joint_limits_interface::SoftJointLimits soft_limits;
502  bool has_soft_limits = false;
503 
504  // find limits
505  if (urdf_model != NULL)
506  {
507  const urdf::JointConstSharedPtr urdf_joint = urdf_model->getJoint(joint_name);
508 
509  if (urdf_joint != NULL)
510  {
511  *joint_type = urdf_joint->type;
512 
513  // Get limits from the URDF file.
514  if (joint_limits_interface::getJointLimits(urdf_joint, limits))
515  has_limits = true;
516 
517  if (joint_limits_interface::getSoftJointLimits(urdf_joint, soft_limits))
518  has_soft_limits = true;
519  }
520 
521  }
522 
523  // Get limits from the parameter server.
524  if (joint_limits_interface::getJointLimits(joint_name, joint_limit_nh, limits))
525  has_limits = true;
526 
527  if (!has_limits)
528  return;
529 
530  if (limits.has_position_limits)
531  {
532  *lower_limit = limits.min_position;
533  *upper_limit = limits.max_position;
534  }
535  if (limits.has_effort_limits)
536  *effort_limit = limits.max_effort;
537 
538  if (has_soft_limits)
539  {
540  for (unsigned int cm = 0; cm< ctrl_method.size(); cm++)
541  {
542  switch (ctrl_method[cm])
543  {
544  case EFFORT:
545  {
546  const joint_limits_interface::EffortJointSoftLimitsHandle
547  limits_handle(joint_handle[cm], limits, soft_limits);
548  ej_limits_interface_.registerHandle(limits_handle);
549  }
550  break;
551  case POSITION:
552  {
553  const joint_limits_interface::PositionJointSoftLimitsHandle
554  limits_handle(joint_handle[cm], limits, soft_limits);
555  pj_limits_interface_.registerHandle(limits_handle);
556  }
557  break;
558  case VELOCITY:
559  {
560  const joint_limits_interface::VelocityJointSoftLimitsHandle
561  limits_handle(joint_handle[cm], limits, soft_limits);
562  vj_limits_interface_.registerHandle(limits_handle);
563  }
564  break;
565  }// end switch
566  } // end for
567  }
568  else
569  {
570  for (unsigned int cm = 0; cm< ctrl_method.size(); cm++)
571  {
572  switch (ctrl_method[cm])
573  {
574 
575  case EFFORT:
576  {
577  const joint_limits_interface::EffortJointSaturationHandle
578  sat_handle(joint_handle[cm], limits);
579  ej_sat_interface_.registerHandle(sat_handle);
580  }
581  break;
582  case POSITION:
583  {
584  const joint_limits_interface::PositionJointSaturationHandle
585  sat_handle(joint_handle[cm], limits);
586  pj_sat_interface_.registerHandle(sat_handle);
587  }
588  break;
589  case VELOCITY:
590  {
591  const joint_limits_interface::VelocityJointSaturationHandle
592  sat_handle(joint_handle[cm], limits);
593  vj_sat_interface_.registerHandle(sat_handle);
594  }
595  break;
596 
597  }//endswicth
598  } // end for
599 
600  }//endifelse
601 
602  }//end registerlimits function
603 
604 
606  //GetThumbOppPosition: Get the target position of the Mia thumb_opp joint based on the position of
607  //the Mia index actual position.
610  {
611 
612  double j_index_flex_pos = joint_position_state_[joints_ii.j_index_flex ];
613  double jThOpp_Target_position = MyTh_opp_passiveJoint.GetThumbOppPosition(j_index_flex_pos);
614 
615  return jThOpp_Target_position;
616  }
617 
618 
620  //SelectCtrMethod: Select the method to control a joint.
623  enum MiaHWInterface::ControlMethod last_joint_control_methods_,
624  const double last_joint_velocity_command_,
625  const double joint_velocity_command_,
626  const double last_joint_position_command_,
627  const double joint_position_command_)
628  {
629 
631  return POSITION;
633  return VELOCITY;
634  else // default
636 
637  }
638 
640  //getURDF: Get the URDF XML from the parameter server.
642  std::string MiaHWInterface::getURDF(std::string param_name) const
643  {
644  std::string urdf_string;
645 
646  // search and wait for robot_description on param server
647  while (urdf_string.empty())
648  {
649  std::string search_param_name;
650 
651  if (nh_.searchParam(param_name, search_param_name))
652  {
653  ROS_INFO_ONCE_NAMED("MiaHWInterface", "MiaHWInterface is waiting for model"
654  " URDF in parameter [%s] on the ROS param server.", search_param_name.c_str());
655 
656  nh_.getParam(search_param_name, urdf_string);
657  }
658  else
659  {
660  ROS_INFO_ONCE_NAMED("MiaHWInterface", "MiaHWInterface is waiting for model"
661  " URDF in parameter [%s] on the ROS param server.", robot_description_.c_str());
662 
663  nh_.getParam(param_name, urdf_string);
664  }
665 
666  usleep(100000);
667  }
668  ROS_DEBUG_STREAM_NAMED("MiaHWInterface", "Recieved urdf from param server, parsing...");
669 
670  return urdf_string;
671  }
672 
674  //parseTransmissionsFromURDF: Get the transmissions declared into the URDF file.
676  bool MiaHWInterface::parseTransmissionsFromURDF(const std::string& urdf_string)
677  {
678 
679  transmission_interface::TransmissionParser::parse(urdf_string, URDFtransmissions_);
680  return true;
681  }
682 
683 } // namespace
mia_hand::MiaHWInterface::joint_position_command_
std::vector< double > joint_position_command_
Actual position joint command for the Mia hardware.
Definition: mia_hw_interface.h:368
transmission_interface::MiaActuatorToJointPositionHandle
Class handling for propagating actuator positions to joint positions for a given MiaIndexTransmission...
Definition: mia_transmission_interface.h:243
mia_hand::MiaHWInterface::SelectCtrMethod
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.
Definition: mia_hw_interface.cpp:622
transmission_interface::MiaActuatorToJointVelocityHandle
Class handling for propagating actuator velocity to joint velocity for a given MiaIndexTransmission.
Definition: mia_transmission_interface.h:271
mia_hand::MiaHWInterface::MrlTrans
transmission_interface::MiaMrlTransmission MrlTrans
Transmissions class implemented for the Mia hand mrl flexion joint.
Definition: mia_hw_interface.h:263
mia_hand::MiaHWInterface::n_dof_sim_
int n_dof_sim_
Number of degree of freedom.
Definition: mia_hw_interface.h:357
mia_hand::MiaHWInterface::read
void read(const ros::Time &time, const ros::Duration &duration) override
Read state data from the real robot hardware.
Definition: mia_hw_interface.cpp:351
mia_hand::MiaHWInterface::act_effort_state_
std::vector< double > act_effort_state_
Useless.
Definition: mia_hw_interface.h:377
mia_hand::MiaHWInterface::vj_interface_
hardware_interface::VelocityJointInterface vj_interface_
Interface for the real Mia joint velocity commands.
Definition: mia_hw_interface.h:239
mia_hand::MiaHWInterface::vj_sat_interface_
joint_limits_interface::VelocityJointSaturationInterface vj_sat_interface_
Interface for the real Mia joint velocity saturation limit.
Definition: mia_hw_interface.h:244
mia_hand::MiaHWInterface::index_act_to_jnt_pos_state
transmission_interface::MiaActuatorToJointPositionInterface index_act_to_jnt_pos_state
Transmission interface for propagating current actuator position state of the Mia index to joint spac...
Definition: mia_hw_interface.h:307
mia_hand::MiaHWInterface::act_velocity_command_
std::vector< double > act_velocity_command_
Actual velocity actuator command for the Mia hardware.
Definition: mia_hw_interface.h:380
mia_hand::MiaHWInterface::write_counter
unsigned int write_counter
Counter of the write method.
Definition: mia_hw_interface.h:356
mia_hand::Joint_index_mapping::j_mrl_3
int j_mrl_3
Definition: mia_hw_interface.h:76
mia_hand::MiaHWInterface::joint_effort_limits_
std::vector< double > joint_effort_limits_
Effort limit of the joints of the Mia hardware specified in the URDF (fake).
Definition: mia_hw_interface.h:391
mia_hand::MiaHWInterface::index_jnt_to_act_vel
transmission_interface::MiaJointToActuatorVelocityInterface index_jnt_to_act_vel
Transmission interface for propagating joint velocity commands to actuator space.
Definition: mia_hw_interface.h:325
mia_hand::MiaHWInterface::MiaHWInterface
MiaHWInterface()
Class constructor.
Definition: mia_hw_interface.cpp:23
mia_hand::MiaHWInterface::pj_sat_interface_
joint_limits_interface::PositionJointSaturationInterface pj_sat_interface_
Interface for the real Mia joint position saturation limit.
Definition: mia_hw_interface.h:242
mia_hand::MiaHWInterface::a_cmd_data
transmission_interface::ActuatorData a_cmd_data[3]
Actuator command data (one for transmission).
Definition: mia_hw_interface.h:331
mia_hand::MiaHWInterface::mia_
CppDriver mia_
Low level driver of the Mia hand.
Definition: mia_hw_interface.h:216
mia_hand::Joint_index_mapping::j_mrl_flex
int j_mrl_flex
Definition: mia_hw_interface.h:74
mia_hand::MiaHWInterface::init
bool init(ros::NodeHandle &root_nh, ros::NodeHandle &mia_hw_nh) override
Initialize the class hardware interface and the robot hardware.
Definition: mia_hw_interface.cpp:60
transmission_interface::MiaJointToActuatorPositionHandle
Class handling for propagating joint positions to actuator positions for a given MiaIndexTransmission...
Definition: mia_transmission_interface.h:334
mia_hand::MiaHWInterface::last_joint_control_methods_
std::vector< ControlMethod > last_joint_control_methods_
Last control method used for the joints of the Mia hardware.
Definition: mia_hw_interface.h:385
mia_hand::MiaHWInterface::joint_velocity_state_
std::vector< double > joint_velocity_state_
Actual velocity state of the joints of the Mia hardware.
Definition: mia_hw_interface.h:365
mia_hand::MiaHWInterface::act_position_command_
std::vector< double > act_position_command_
Actual position actuator command for the Mia hardware.
Definition: mia_hw_interface.h:379
mia_hand::MiaHWInterface::joint_position_state_
std::vector< double > joint_position_state_
Actual position state of the joints of the Mia hardware.
Definition: mia_hw_interface.h:364
transmission_interface::MiaJointToActuatorVelocityHandle
Class handling for propagating joint velocities to actuator velocities for a given MiaIndexTransmissi...
Definition: mia_transmission_interface.h:365
mia_hand::MiaHWInterface::act_to_jnt_vel_state
transmission_interface::ActuatorToJointVelocityInterface act_to_jnt_vel_state
Transmission interface for propagating current velocity actuator state to joint space.
Definition: mia_hw_interface.h:289
mia_hand::MiaHWInterface::act_effort_command_
std::vector< double > act_effort_command_
Useless.
Definition: mia_hw_interface.h:381
mia_hand::MiaHWInterface::robot_description_
std::string robot_description_
Generic name of the URDF to look for with #getURDF(std::string param_name).
Definition: mia_hw_interface.h:227
mia_hand::Joint_index_mapping::j_index_flex
int j_index_flex
Definition: mia_hw_interface.h:73
mia_hand::MiaHWInterface::joint_control_methods_
std::vector< ControlMethod > joint_control_methods_
Actual control method for the joints of the Mia hardware.
Definition: mia_hw_interface.h:384
mia_hand::MiaHWInterface::EFFORT
@ EFFORT
Definition: mia_hw_interface.h:134
mia_hand::MiaHWInterface::ThfleTrans
transmission_interface::MiaThfleTransmission ThfleTrans
Transmissions class implemented for the Mia hand thumb flexion joint.
Definition: mia_hw_interface.h:257
mia_hand::MiaHWInterface::act_velocity_state_
std::vector< double > act_velocity_state_
Actual velocity state of the actuators of the Mia hardware.
Definition: mia_hw_interface.h:376
mia_hand::MiaHWInterface::ej_interface_
hardware_interface::EffortJointInterface ej_interface_
unused
Definition: mia_hw_interface.h:240
mia_hand::MiaHWInterface::COM_number_
int COM_number_
Number of the COM in which the Mia hand is plugged.
Definition: mia_hw_interface.h:217
mia_hand::MiaHWInterface::write
void write(const ros::Time &time, const ros::Duration &duration) override
Write data command to the real robot hardware.
Definition: mia_hw_interface.cpp:396
mia_hand::MiaHWInterface::ej_sat_interface_
joint_limits_interface::EffortJointSaturationInterface ej_sat_interface_
unused
Definition: mia_hw_interface.h:247
mia_hand::Joint_index_mapping::j_thumb_opp
int j_thumb_opp
Definition: mia_hw_interface.h:71
mia_hand::MiaHWInterface::pj_interface_
hardware_interface::PositionJointInterface pj_interface_
Interface for the real Mia joint position commands.
Definition: mia_hw_interface.h:238
mia_hand::MiaHWInterface::joint_effort_state_
std::vector< double > joint_effort_state_
Useless.
Definition: mia_hw_interface.h:366
mia_hand::MiaHWInterface::joint_effort_command_
std::vector< double > joint_effort_command_
Useless.
Definition: mia_hw_interface.h:370
mia_hand::MiaHWInterface::pj_limits_interface_
joint_limits_interface::PositionJointSoftLimitsInterface pj_limits_interface_
Interface for the real joint position soft limit.
Definition: mia_hw_interface.h:243
mia_hand::MiaHWInterface::List_joint_control_methods_
std::vector< std::vector< ControlMethod > > List_joint_control_methods_
List of control method available for the joints of the Mia hardware.
Definition: mia_hw_interface.h:386
mia_hand::MiaHWInterface::jnt_to_act_vel
transmission_interface::JointToActuatorVelocityInterface jnt_to_act_vel
Transmission interface for propagating joint velocity commands to actuator space Transmission interfa...
Definition: mia_hw_interface.h:301
mia_hand::MiaHWInterface::j_cmd_data
transmission_interface::JointData j_cmd_data[3]
joint command data (one for transmission).
Definition: mia_hw_interface.h:334
mia_hand::MiaHWInterface::vj_limits_interface_
joint_limits_interface::VelocityJointSoftLimitsInterface vj_limits_interface_
Interface for the real Mia joint velocity software limit.
Definition: mia_hw_interface.h:245
mia_hand::MiaHWInterface::MyTh_opp_passiveJoint
mia_hand::thumb_opp_passive_joint MyTh_opp_passiveJoint
Class used to evaluate the target position of the Mia simulated thumb opposition joint.
Definition: mia_hw_interface.h:343
mia_hand::MiaHWInterface::joint_lower_limits_
std::vector< double > joint_lower_limits_
Lower position limits of the joints of the Mia hardware (as specified in the URDF)
Definition: mia_hw_interface.h:388
mia_hand::MiaHWInterface::ej_limits_interface_
joint_limits_interface::EffortJointSoftLimitsInterface ej_limits_interface_
unused
Definition: mia_hw_interface.h:248
mia_hand::MiaHWInterface::js_interface_
hardware_interface::JointStateInterface js_interface_
Interface for the real Mia joint state.
Definition: mia_hw_interface.h:237
mia_hand::MiaHWInterface::joint_upper_limits_
std::vector< double > joint_upper_limits_
Upper position limits of the joints of the Mia hardware (as specified in the URDF).
Definition: mia_hw_interface.h:389
mia_hand::MiaHWInterface::last_joint_velocity_command_
std::vector< double > last_joint_velocity_command_
Last joint velocity command received for the Mia hardware.
Definition: mia_hw_interface.h:373
mia_hand::MiaHWInterface::~MiaHWInterface
~MiaHWInterface()
Class distructor.
Definition: mia_hw_interface.cpp:48
mia_hand::MiaHWInterface::registerJointLimits
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.
Definition: mia_hw_interface.cpp:485
mia_hand::MiaHWInterface::read_counter
int read_counter
Counter for the read() funtion.
Definition: mia_hw_interface.h:395
mia_hand::MiaHWInterface::trasmission_names_
std::vector< std::string > trasmission_names_
Actual transmissions name.
Definition: mia_hw_interface.h:276
mia_hand
Definition: mia_hw_interface.h:50
transmission_interface::MiaTransmissionInterface::propagate
void propagate()
Definition: mia_transmission_interface.h:407
mia_hand::MiaHWInterface::index_act_to_jnt_vel_state
transmission_interface::MiaActuatorToJointVelocityInterface index_act_to_jnt_vel_state
Transmission interface for propagating current actuator velocity state of the Mia index to joint spac...
Definition: mia_hw_interface.h:313
mia_hw_interface.h
mia_hand::MiaHWInterface::last_joint_position_command_
std::vector< double > last_joint_position_command_
Last joint position command received for the Mia hardware.
Definition: mia_hw_interface.h:372
mia_hand::MiaHWInterface::nh_
ros::NodeHandle nh_
ROS node handle.
Definition: mia_hw_interface.h:219
mia_hand::MiaHWInterface::MiaTrasmissions
std::vector< transmission_interface::Transmission * > MiaTrasmissions
Transmissions vector to handle the transmissions implemented for the real Mia hand.
Definition: mia_hw_interface.h:274
mia_hand::MiaHWInterface::index_jnt_to_act_pos
transmission_interface::MiaJointToActuatorPositionInterface index_jnt_to_act_pos
Transmission interface for propagating joint position commands to actuator space.
Definition: mia_hw_interface.h:319
mia_hand::MiaHWInterface::a_state_data
transmission_interface::ActuatorData a_state_data[3]
Actuator state data (one for transmission).
Definition: mia_hw_interface.h:330
mia_hand::MiaHWInterface::act_position_state_
std::vector< double > act_position_state_
Actual position state of the actuators of the Mia hardware.
Definition: mia_hw_interface.h:375
mia_hand::MiaHWInterface::IndexTrans
transmission_interface::MiaIndexTransmission IndexTrans
Transmissions class implemented for the Mia hand mrl flexion joint.
Definition: mia_hw_interface.h:269
mia_hand::MiaHWInterface::joint_names_
std::vector< std::string > joint_names_
Name of the joints as specified in the URDF.
Definition: mia_hw_interface.h:361
mia_hand::MiaHWInterface::joint_types_
std::vector< int > joint_types_
Type of the joints specified in the URDF.
Definition: mia_hw_interface.h:362
mia_hand::MiaHWInterface::URDFtransmissions_
std::vector< transmission_interface::TransmissionInfo > URDFtransmissions_
Transmissions declared in the URDF.
Definition: mia_hw_interface.h:232
mia_hand::MiaHWInterface::joints_ii
Joint_index_mapping joints_ii
Joint_index_mapping struct.
Definition: mia_hw_interface.h:354
mia_hand::MiaHWInterface::act_to_jnt_pos_state
transmission_interface::ActuatorToJointPositionInterface act_to_jnt_pos_state
Transmission interface for propagating current actuator position state to joint space.
Definition: mia_hw_interface.h:283
mia_hand::MiaHWInterface::POSITION
@ POSITION
Definition: mia_hw_interface.h:134
mia_hand::MiaHWInterface::old_act_position_state_
std::vector< double > old_act_position_state_
Last position state of the actuator returned by the Mia hardware in the read() funtion.
Definition: mia_hw_interface.h:394
mia_hand::MiaHWInterface::VELOCITY
@ VELOCITY
Definition: mia_hw_interface.h:134
mia_hand::MiaHWInterface::InitBkLastCommands
void InitBkLastCommands()
Initialization of the arrays saving the last command received.
Definition: mia_hw_interface.cpp:466
mia_hand::MiaHWInterface::joint_velocity_command_
std::vector< double > joint_velocity_command_
Actual velocity joint command for the Mia hardware.
Definition: mia_hw_interface.h:369
mia_hand::MiaHWInterface::GetThumbOppPosition
double GetThumbOppPosition()
Evaluate the position of the Mia thumb opposition joint.
Definition: mia_hw_interface.cpp:609
mia_hand::MiaHWInterface::n_actuators_
int n_actuators_
Definition: mia_hw_interface.h:358
mia_hand::MiaHWInterface::jnt_to_act_pos
transmission_interface::JointToActuatorPositionInterface jnt_to_act_pos
Transmission interface for propagating joint position commands to actuator space.
Definition: mia_hw_interface.h:295
mia_hand::MiaHWInterface::j_state_data
transmission_interface::JointData j_state_data[3]
Joint state data (one for transmission).
Definition: mia_hw_interface.h:333
mia_hand::Joint_index_mapping::j_mrl_2
int j_mrl_2
Definition: mia_hw_interface.h:75
mia_hand::Joint_index_mapping::j_thumb_flex
int j_thumb_flex
Definition: mia_hw_interface.h:72
mia_hand::MiaHWInterface::getURDF
std::string getURDF(std::string param_name) const
Get the name of the URDF.
Definition: mia_hw_interface.cpp:642
mia_hand::MiaHWInterface::parseTransmissionsFromURDF
bool parseTransmissionsFromURDF(const std::string &urdf_string)
Get the transmission names and type from the loaded URDF Get the trasnsmission names specified in the...
Definition: mia_hw_interface.cpp:676
mia_hand::MiaHWInterface::ControlMethod
ControlMethod
Joints control methods.
Definition: mia_hw_interface.h:134