Robotis Manipulator  1.0.0
robotis_manipulator.cpp
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright 2018 ROBOTIS CO., LTD.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *******************************************************************************/
16 
17 /* Authors: Darby Lim, Hye-Jong KIM, Ryan Shim, Yong-Ho Na */
18 
25 #include "../../include/robotis_manipulator/robotis_manipulator.h"
26 
27 using namespace robotis_manipulator;
28 
29 
30 /*****************************************************************************
31 ** Constructor and Destructor
32 *****************************************************************************/
34 {
35  moving_state_ = false;
36  actuator_added_stete_ = false;
37  step_moving_state_ = false;
39 }
40 
42 
43 
44 /*****************************************************************************
45 ** Initialize Function
46 *****************************************************************************/
47 
49  Name child_name,
50  Eigen::Vector3d world_position,
51  Eigen::Matrix3d world_orientation)
52 {
53  manipulator_.addWorld(world_name, child_name, world_position, world_orientation);
54 }
55 
57  Name parent_name,
58  Name child_name,
59  Eigen::Vector3d relative_position,
60  Eigen::Matrix3d relative_orientation,
61  Eigen::Vector3d axis_of_rotation,
62  int8_t joint_actuator_id,
63  double max_position_limit,
64  double min_position_limit,
65  double coefficient,
66  double mass,
67  Eigen::Matrix3d inertia_tensor,
68  Eigen::Vector3d center_of_mass)
69 {
70  manipulator_.addJoint(my_name, parent_name, child_name,
71  relative_position, relative_orientation, axis_of_rotation, joint_actuator_id,
72  max_position_limit, min_position_limit, coefficient, mass,
73  inertia_tensor, center_of_mass);
74 }
75 
77 {
78  manipulator_.addComponentChild(my_name, child_name);
79 }
80 
82  Name parent_name,
83  Eigen::Vector3d relative_position,
84  Eigen::Matrix3d relative_orientation,
85  int8_t tool_id,
86  double max_position_limit,
87  double min_position_limit,
88  double coefficient,
89  double mass,
90  Eigen::Matrix3d inertia_tensor,
91  Eigen::Vector3d center_of_mass)
92 {
93  manipulator_.addTool(my_name, parent_name,
94  relative_position, relative_orientation, tool_id,
95  max_position_limit, min_position_limit, coefficient, mass,
96  inertia_tensor, center_of_mass);
97 }
98 
100 {
102 }
103 
105 {
106  kinematics_= kinematics;
107 }
108 
109 void RobotisManipulator::addJointActuator(Name actuator_name, JointActuator *joint_actuator, std::vector<uint8_t> id_array, const void *arg)
110 {
111  joint_actuator_.insert(std::make_pair(actuator_name, joint_actuator));
112  if(joint_actuator_.find(actuator_name) != joint_actuator_.end())
113  {
114  joint_actuator_.at(actuator_name)->init(id_array, arg);
115  }
116  else
117  {
118  //error
119  }
120  for(uint32_t index = 0; index < id_array.size(); index++)
121  {
123  }
124  actuator_added_stete_ = true;
125 }
126 
127 void RobotisManipulator::addToolActuator(Name actuator_name, ToolActuator *tool_actuator, uint8_t id, const void *arg)
128 {
129  tool_actuator_.insert(std::make_pair(actuator_name, tool_actuator));
130  if(tool_actuator_.find(actuator_name) != tool_actuator_.end())
131  {
132  tool_actuator_.at(actuator_name)->init(id, arg);
133  }
134  else
135  {
136  //error
137  }
139  actuator_added_stete_ = true;
140 }
141 
142 void RobotisManipulator::addCustomTrajectory(Name trajectory_name, CustomJointTrajectory *custom_trajectory)
143 {
144  trajectory_.addCustomTrajectory(trajectory_name, custom_trajectory);
145 }
146 
147 void RobotisManipulator::addCustomTrajectory(Name trajectory_name, CustomTaskTrajectory *custom_trajectory)
148 {
149  trajectory_.addCustomTrajectory(trajectory_name, custom_trajectory);
150 }
151 
152 
153 /*****************************************************************************
154 ** Manipulator Function
155 *****************************************************************************/
157 {
158  return &manipulator_;
159 }
160 
162 {
163  return manipulator_.getJointValue(joint_name);
164 }
165 
167 {
168  return manipulator_.getJointValue(tool_name);
169 }
170 
172 {
174 }
175 
176 std::vector<JointValue> RobotisManipulator::getAllJointValue()
177 {
179 }
180 
182 {
184 }
185 
186 std::vector<JointValue> RobotisManipulator::getAllToolValue()
187 {
188  return manipulator_.getAllToolValue();
189 }
190 
192 {
193  return manipulator_.getComponentKinematicPoseFromWorld(component_name);
194 }
195 
197 {
198  return manipulator_.getComponentDynamicPoseFromWorld(component_name);
199 }
200 
202 {
203  return manipulator_.getComponentPoseFromWorld(component_name);
204 }
205 
206 
207 /*****************************************************************************
208 ** Kinematics Function (Including Virtual Function)
209 *****************************************************************************/
210 Eigen::MatrixXd RobotisManipulator::jacobian(Name tool_name)
211 {
212  return kinematics_->jacobian(&manipulator_, tool_name);
213 }
214 
216 {
218 }
219 
220 bool RobotisManipulator::solveInverseKinematics(Name tool_name, Pose goal_pose, std::vector<JointValue>* goal_joint_value)
221 {
222  return kinematics_->solveInverseKinematics(&manipulator_, tool_name, goal_pose, goal_joint_value);
223 }
224 
226 {
227  kinematics_->setOption(arg);
228 }
229 
230 
231 /*****************************************************************************
232 ** Actuator Function (Including Virtual Function)
233 *****************************************************************************/
234 void RobotisManipulator::setJointActuatorMode(Name actuator_name, std::vector<uint8_t> id_array, const void *arg)
235 {
237  {
238  if(joint_actuator_.find(actuator_name) != joint_actuator_.end())
239  {
240  joint_actuator_.at(actuator_name)->setMode(id_array, arg);
241  }
242  else
243  {
244  robotis_manipulator::log::error("[jointActuatorSetMode] Worng Actuator Name.");
245  }
246  }
247 }
248 
249 void RobotisManipulator::setToolActuatorMode(Name actuator_name, const void *arg)
250 {
252  {
253  if(tool_actuator_.find(actuator_name) != tool_actuator_.end())
254  {
255  tool_actuator_.at(actuator_name)->setMode(arg);
256  }
257  else
258  {
259  //error
260  }
261  }
262 }
263 
264 std::vector<uint8_t> RobotisManipulator::getJointActuatorId(Name actuator_name)
265 {
267  {
268  if(joint_actuator_.find(actuator_name) != joint_actuator_.end())
269  {
270  return joint_actuator_.at(actuator_name)->getId();
271  }
272  else
273  {
274  //error
275  }
276  }
277  return {};
278 }
279 
281 {
283  {
284  if(tool_actuator_.find(actuator_name) != tool_actuator_.end())
285  {
286  return tool_actuator_.at(actuator_name)->getId();
287  }
288  else
289  {
290  //error
291  }
292  }
293  return {};
294 }
295 
297 {
299  {
300  if(joint_actuator_.find(actuator_name) != joint_actuator_.end())
301  {
302  joint_actuator_.at(actuator_name)->enable();
303  }
304  else if(tool_actuator_.find(actuator_name) != tool_actuator_.end())
305  {
306  tool_actuator_.at(actuator_name)->enable();
307  }
308  else
309  {
310  //error
311  }
312  }
314 }
315 
317 {
319  {
320  if(joint_actuator_.find(actuator_name) != joint_actuator_.end())
321  {
322  joint_actuator_.at(actuator_name)->disable();
323  }
324  else if(tool_actuator_.find(actuator_name) != tool_actuator_.end())
325  {
326  tool_actuator_.at(actuator_name)->disable();
327  }
328  else
329  {
330  //error
331  }
332  }
333 }
334 
336 {
338  {
339  std::map<Name, JointActuator *>::iterator it_joint_actuator;
340  for(it_joint_actuator = joint_actuator_.begin(); it_joint_actuator != joint_actuator_.end(); it_joint_actuator++)
341  {
342  joint_actuator_.at(it_joint_actuator->first)->enable();
343  }
344  }
346 }
347 
349 {
351  {
352  std::map<Name, JointActuator *>::iterator it_joint_actuator;
353  for(it_joint_actuator = joint_actuator_.begin(); it_joint_actuator != joint_actuator_.end(); it_joint_actuator++)
354  {
355  joint_actuator_.at(it_joint_actuator->first)->disable();
356  }
357  }
358 }
359 
361 {
363  {
364  std::map<Name, ToolActuator *>::iterator it_tool_actuator;
365  for(it_tool_actuator = tool_actuator_.begin(); it_tool_actuator != tool_actuator_.end(); it_tool_actuator++)
366  {
367  tool_actuator_.at(it_tool_actuator->first)->enable();
368  }
369  }
371 }
372 
374 {
376  {
377  std::map<Name, ToolActuator *>::iterator it_tool_actuator;
378  for(it_tool_actuator = tool_actuator_.begin(); it_tool_actuator != tool_actuator_.end(); it_tool_actuator++)
379  {
380  tool_actuator_.at(it_tool_actuator->first)->disable();
381  }
382  }
383 }
384 
386 {
388  {
389  std::map<Name, JointActuator *>::iterator it_joint_actuator;
390  for(it_joint_actuator = joint_actuator_.begin(); it_joint_actuator != joint_actuator_.end(); it_joint_actuator++)
391  {
392  joint_actuator_.at(it_joint_actuator->first)->enable();
393  }
394  std::map<Name, ToolActuator *>::iterator it_tool_actuator;
395  for(it_tool_actuator = tool_actuator_.begin(); it_tool_actuator != tool_actuator_.end(); it_tool_actuator++)
396  {
397  tool_actuator_.at(it_tool_actuator->first)->enable();
398  }
399  }
401 }
402 
404 {
406  {
407  std::map<Name, JointActuator *>::iterator it_joint_actuator;
408  for(it_joint_actuator = joint_actuator_.begin(); it_joint_actuator != joint_actuator_.end(); it_joint_actuator++)
409  {
410  joint_actuator_.at(it_joint_actuator->first)->disable();
411  }
412  std::map<Name, ToolActuator *>::iterator it_tool_actuator;
413  for(it_tool_actuator = tool_actuator_.begin(); it_tool_actuator != tool_actuator_.end(); it_tool_actuator++)
414  {
415  tool_actuator_.at(it_tool_actuator->first)->disable();
416  }
417  }
418 }
419 
421 {
423  {
424  if(joint_actuator_.find(actuator_name) != joint_actuator_.end())
425  {
426  return joint_actuator_.at(actuator_name)->getEnabledState();
427  }
428  else if(tool_actuator_.find(actuator_name) != tool_actuator_.end())
429  {
430  return tool_actuator_.at(actuator_name)->getEnabledState();
431  }
432  else
433  {
434  return {};
435  }
436  }
437  return {};
438 }
439 
441 {
442  // trajectory manipulator set
443  // trajectory_.getManipulator()->setJointValue(joint_component_name,value);
444  // trajectory_.updatePresentWayPoint(kinematics_dynamics_);
445 
447  {
448  double coefficient = manipulator_.getCoefficient(joint_component_name);
449  value.position = value.position / coefficient;
450  value.velocity = value.velocity / coefficient;
451  value.acceleration = value.acceleration / coefficient;
452  value.effort = value.effort;
453 
454  std::vector<uint8_t> id;
455  std::vector<JointValue> value_vector;
456  id.push_back(manipulator_.getId(joint_component_name));
457  value_vector.push_back(value);
458 
459  //send to actuator
460  return joint_actuator_.at(manipulator_.getComponentActuatorName(joint_component_name))->sendJointActuatorValue(id, value_vector);
461  }
462  else
463  {
464  manipulator_.setJointValue(joint_component_name, value);
465  return true;
466  }
467  return false;
468 }
469 
470 bool RobotisManipulator::sendMultipleJointActuatorValue(std::vector<Name> joint_component_name, std::vector<JointValue> value_vector)
471 {
472  if(joint_component_name.size() != value_vector.size())
473  return false; //error;
474 
475  // trajectory manipulator set
476  // for(uint8_t index = 0; index < joint_component_name.size(); index++)
477  // trajectory_.getManipulator()->setJointValue(joint_component_name.at(index), value_vector.at(index));
478  // trajectory_.updatePresentWayPoint(kinematics_dynamics_);
479 
481  {
482  std::vector<int8_t> joint_id;
483  for(uint32_t index = 0; index < value_vector.size(); index++)
484  {
485  double coefficient = manipulator_.getCoefficient(joint_component_name.at(index));
486  value_vector.at(index).position = value_vector.at(index).position / coefficient;
487  value_vector.at(index).velocity = value_vector.at(index).velocity / coefficient;
488  value_vector.at(index).acceleration = value_vector.at(index).acceleration / coefficient;
489  value_vector.at(index).effort = value_vector.at(index).effort;
490  joint_id.push_back(manipulator_.getId(joint_component_name.at(index)));
491  }
492 
493  std::vector<uint8_t> single_actuator_id;
494  std::vector<JointValue> single_value_vector;
495  std::map<Name, JointActuator *>::iterator it_joint_actuator;
496  for(it_joint_actuator = joint_actuator_.begin(); it_joint_actuator != joint_actuator_.end(); it_joint_actuator++)
497  {
498  single_actuator_id = joint_actuator_.at(it_joint_actuator->first)->getId();
499  for(uint32_t index = 0; index < single_actuator_id.size(); index++)
500  {
501  for(uint32_t index2=0; index2 < joint_id.size(); index2++)
502  {
503  if(single_actuator_id.at(index) == joint_id.at(index2))
504  {
505  single_value_vector.push_back(value_vector.at(index2));
506  }
507  }
508  }
509  joint_actuator_.at(it_joint_actuator->first)->sendJointActuatorValue(single_actuator_id, single_value_vector);
510  }
511  return true;
512  }
513  else
514  {
515  //set to manipulator
516  for(uint8_t index = 0; index < joint_component_name.size(); index++)
517  manipulator_.setJointValue(joint_component_name.at(index), value_vector.at(index));
518  return true;
519  }
520  return false;
521 }
522 
523 bool RobotisManipulator::sendAllJointActuatorValue(std::vector<JointValue> value_vector)
524 {
525  // trajectory manipulator set
526  // trajectory_.setPresentJointWayPoint(value_vector);
527  // trajectory_.updatePresentWayPoint(kinematics_dynamics_);
528 
530  {
531  std::map<Name, Component>::iterator it;
532  std::vector<int8_t> joint_id;
533  int index = 0;
534  for (it = manipulator_.getIteratorBegin(); it != manipulator_.getIteratorEnd(); it++)
535  {
537  {
538  double coefficient = manipulator_.getCoefficient(it->first);
539  value_vector.at(index).position = value_vector.at(index).position / coefficient;
540  value_vector.at(index).velocity = value_vector.at(index).velocity / coefficient;
541  value_vector.at(index).acceleration = value_vector.at(index).acceleration / coefficient;
542  value_vector.at(index).effort = value_vector.at(index).effort;
543  joint_id.push_back(manipulator_.getId(it->first));
544  index++;
545  }
546  }
547 
548  std::vector<uint8_t> single_actuator_id;
549  std::vector<JointValue> single_value_vector;
550  std::map<Name, JointActuator *>::iterator it_joint_actuator;
551  for(it_joint_actuator = joint_actuator_.begin(); it_joint_actuator != joint_actuator_.end(); it_joint_actuator++)
552  {
553  single_actuator_id = joint_actuator_.at(it_joint_actuator->first)->getId();
554  for(uint32_t index = 0; index < single_actuator_id.size(); index++)
555  {
556  for(uint32_t index2=0; index2 < joint_id.size(); index2++)
557  {
558  if(single_actuator_id.at(index) == joint_id.at(index2))
559  {
560  single_value_vector.push_back(value_vector.at(index2));
561  }
562  }
563  }
564  joint_actuator_.at(it_joint_actuator->first)->sendJointActuatorValue(single_actuator_id, single_value_vector);
565  }
566  return true;
567  }
568  else
569  {
570  //set to manipulator
571  manipulator_.setAllActiveJointValue(value_vector);
572  }
573  return false;
574 }
575 
577 {
579  {
580  std::vector<uint8_t> actuator_id;
581  std::vector<JointValue> result;
582 
583  actuator_id.push_back(manipulator_.getId(joint_component_name));
584 
585  result = joint_actuator_.at(manipulator_.getComponentActuatorName(joint_component_name))->receiveJointActuatorValue(actuator_id);
586 
587  double coefficient = manipulator_.getCoefficient(joint_component_name);
588  result.at(0).position = result.at(0).position * coefficient;
589  result.at(0).velocity = result.at(0).velocity * coefficient;
590  result.at(0).acceleration = result.at(0).acceleration * coefficient;
591  result.at(0).effort = result.at(0).effort;
592 
593  manipulator_.setJointValue(joint_component_name, result.at(0));
594  return result.at(0);
595  }
596  return {};
597 }
598 
599 std::vector<JointValue> RobotisManipulator::receiveMultipleJointActuatorValue(std::vector<Name> joint_component_name)
600 {
602  {
603  std::vector<JointValue> get_value_vector;
604  std::vector<uint8_t> get_actuator_id;
605 
606  std::vector<JointValue> single_value_vector;
607  std::vector<uint8_t> single_actuator_id;
608  std::map<Name, JointActuator *>::iterator it_joint_actuator;
609  for(it_joint_actuator = joint_actuator_.begin(); it_joint_actuator != joint_actuator_.end(); it_joint_actuator++)
610  {
611  single_actuator_id = joint_actuator_.at(it_joint_actuator->first)->getId();
612  single_value_vector = joint_actuator_.at(it_joint_actuator->first)->receiveJointActuatorValue(single_actuator_id);
613  for(uint32_t index=0; index < single_actuator_id.size(); index++)
614  {
615  get_actuator_id.push_back(single_actuator_id.at(index));
616  get_value_vector.push_back(single_value_vector.at(index));
617  }
618  }
619 
620  std::vector<JointValue> result_vector;
621  JointValue result;
622 
623  for(uint32_t index = 0; index < joint_component_name.size(); index++)
624  {
625  for(uint32_t index2 = 0; index2 < get_actuator_id.size(); index2++)
626  {
627  if(manipulator_.getId(joint_component_name.at(index)) == get_actuator_id.at(index2))
628  {
629  double coefficient = manipulator_.getCoefficient(joint_component_name.at(index));
630  result.position = get_value_vector.at(index2).position * coefficient;
631  result.velocity = get_value_vector.at(index2).velocity * coefficient;
632  result.acceleration = get_value_vector.at(index2).acceleration * coefficient;
633  result.effort = get_value_vector.at(index2).effort;
634  manipulator_.setJointValue(joint_component_name.at(index), result);
635  result_vector.push_back(result);
636  }
637  }
638  }
639 
640  return result_vector;
641  }
642  return {};
643 }
644 
646 {
648  {
649  std::vector<JointValue> get_value_vector;
650  std::vector<uint8_t> get_actuator_id;
651 
652  std::vector<JointValue> single_value_vector;
653  std::vector<uint8_t> single_actuator_id;
654  std::map<Name, JointActuator *>::iterator it_joint_actuator;
655  for(it_joint_actuator = joint_actuator_.begin(); it_joint_actuator != joint_actuator_.end(); it_joint_actuator++)
656  {
657  single_actuator_id = joint_actuator_.at(it_joint_actuator->first)->getId();
658  single_value_vector = joint_actuator_.at(it_joint_actuator->first)->receiveJointActuatorValue(single_actuator_id);
659  for(uint32_t index=0; index < single_actuator_id.size(); index++)
660  {
661  get_actuator_id.push_back(single_actuator_id.at(index));
662  get_value_vector.push_back(single_value_vector.at(index));
663  }
664  }
665 
666  std::map<Name, Component>::iterator it;
667  std::vector<JointValue> result_vector;
668  JointValue result;
669 
670  for (it = manipulator_.getIteratorBegin(); it != manipulator_.getIteratorEnd(); it++)
671  {
672  for(uint32_t index2 = 0; index2 < get_actuator_id.size(); index2++)
673  {
674  if(manipulator_.checkComponentType(it->first,ACTIVE_JOINT_COMPONENT) && manipulator_.getId(it->first) == get_actuator_id.at(index2))
675  {
676  double coefficient = manipulator_.getCoefficient(it->first);
677  result.position = get_value_vector.at(index2).position * coefficient;
678  result.velocity = get_value_vector.at(index2).velocity * coefficient;
679  result.acceleration = get_value_vector.at(index2).acceleration * coefficient;
680  result.effort = get_value_vector.at(index2).effort;
681  manipulator_.setJointValue(it->first, result);
682  result_vector.push_back(result);
683  }
684  }
685  }
686 
687  return result_vector;
688  }
689  return {};
690 }
692 
694 {
695  // trajectory manipulator set
696  // trajectory_.getManipulator()->setJointValue(tool_component_name,value);
697 
699  {
700  double coefficient;
701  coefficient = manipulator_.getCoefficient(tool_component_name);
702  value.position = value.position / coefficient;
703  value.velocity = value.velocity / coefficient;
704  value.acceleration = value.acceleration / coefficient;
705  value.effort = value.effort;
706 
707  return tool_actuator_.at(manipulator_.getComponentActuatorName(tool_component_name))->sendToolActuatorValue(value);
708  }
709  else
710  {
711  //set to manipulator
712  manipulator_.setJointValue(tool_component_name, value);
713  return true;
714  }
715  return false;
716 }
717 
718 bool RobotisManipulator::sendMultipleToolActuatorValue(std::vector<Name> tool_component_name, std::vector<JointValue> value_vector)
719 {
720  // trajectory manipulator set
721  // for(uint8_t index = 0; index < tool_component_name.size(); index++)
722  // trajectory_.getManipulator()->setJointValue(tool_component_name.at(index), value_vector.at(index));
723 
725  {
726  for (uint32_t index = 0; index < tool_component_name.size(); index++)
727  {
728  double coefficient = manipulator_.getCoefficient(tool_component_name.at(index));
729  value_vector.at(index).position = value_vector.at(index).position / coefficient;
730  value_vector.at(index).velocity = value_vector.at(index).velocity / coefficient;
731  value_vector.at(index).acceleration = value_vector.at(index).acceleration / coefficient;
732 
733  if(!tool_actuator_.at(manipulator_.getComponentActuatorName(tool_component_name.at(index)))->sendToolActuatorValue(value_vector.at(index)))
734  return false;
735  }
736  return true;
737  }
738  else
739  {
740  //set to manipulator
741  for(uint8_t index = 0; index < tool_component_name.size(); index++)
742  manipulator_.setJointValue(tool_component_name.at(index), value_vector.at(index));
743  return true;
744  }
745  return false;
746 }
747 
748 bool RobotisManipulator::sendAllToolActuatorValue(std::vector<JointValue> value_vector)
749 {
750  // trajectory manipulator set
751  // trajectory_.getManipulator()->setAllToolValue(value_vector);
752 
754  {
755  std::vector<Name> tool_component_name;
756  tool_component_name = manipulator_.getAllToolComponentName();
757  for (uint32_t index = 0; index < tool_component_name.size(); index++)
758  {
759  double coefficient = manipulator_.getCoefficient(tool_component_name.at(index));
760  value_vector.at(index).position = value_vector.at(index).position / coefficient;
761  value_vector.at(index).velocity = value_vector.at(index).velocity / coefficient;
762  value_vector.at(index).acceleration = value_vector.at(index).acceleration / coefficient;
763 
764  if(!tool_actuator_.at(manipulator_.getComponentActuatorName(tool_component_name.at(index)))->sendToolActuatorValue(value_vector.at(index)))
765  return false;
766  }
767  return true;
768  }
769  else
770  {
771  //set to manipualtor
772  manipulator_.setAllToolValue(value_vector);
773  }
774  return false;
775 }
776 
778 {
780  {
781  JointValue result;
783 
784  double coefficient = manipulator_.getCoefficient(tool_component_name);
785  result.position = result.position * coefficient;
786  result.velocity = result.velocity * coefficient;
787  result.acceleration = result.acceleration * coefficient;
788 
789  manipulator_.setJointValue(tool_component_name, result);
790  return result;
791  }
792  return {};
793 }
794 
795 std::vector<JointValue> RobotisManipulator::receiveMultipleToolActuatorValue(std::vector<Name> tool_component_name)
796 {
798  {
799  std::vector<JointValue> result_vector;
800  ActuatorValue result;
801  for (uint32_t index = 0; index < tool_component_name.size(); index++)
802  {
803  result = tool_actuator_.at(manipulator_.getComponentActuatorName(tool_component_name.at(index)))->receiveToolActuatorValue();
804 
805  double coefficient = manipulator_.getCoefficient(tool_component_name.at(index));
806  result.position = result.position * coefficient;
807  result.velocity = result.velocity * coefficient;
808  result.acceleration = result.acceleration * coefficient;
809 
810  manipulator_.setJointValue(tool_component_name.at(index), result);
811  result_vector.push_back(result);
812  }
813  return result_vector;
814  }
815  return {};
816 }
817 
819 {
821  {
822  std::vector<Name> tool_component_name;
823  tool_component_name = manipulator_.getAllToolComponentName();
824  std::vector<JointValue> result_vector;
825  ActuatorValue result;
826  for (uint32_t index = 0; index < tool_component_name.size(); index++)
827  {
828  result = tool_actuator_.at(manipulator_.getComponentActuatorName(tool_component_name.at(index)))->receiveToolActuatorValue();
829 
830  double coefficient = manipulator_.getCoefficient(tool_component_name.at(index));
831  result.position = result.position * coefficient;
832  result.velocity = result.velocity * coefficient;
833  result.acceleration = result.acceleration * coefficient;
834 
835  manipulator_.setJointValue(tool_component_name.at(index), result);
836  result_vector.push_back(result);
837  }
838  return result_vector;
839  }
840  return {};
841 }
842 
843 
844 
845 /*****************************************************************************
846 ** Time Function
847 *****************************************************************************/
849 {
850  moving_state_ = true;
852 }
853 
855 {
856  return trajectory_.getMoveTime();
857 }
858 
860 {
861  return moving_state_;
862 }
863 
864 
865 /*****************************************************************************
866 ** Check Joint Limit Function
867 *****************************************************************************/
868 bool RobotisManipulator::checkJointLimit(Name component_name, double joint_position)
869 {
870  if(trajectory_.getManipulator()->checkJointLimit(component_name, joint_position))
871  return true;
872  else
873  {
874  log::error("[checkJointLimit] Goal value exceeded limit at " + STRING(component_name) + ".");
875  return false;
876  }
877 }
878 
880 {
881  if(trajectory_.getManipulator()->checkJointLimit(component_name, value.position))
882  return true;
883  else
884  {
885  log::error("[checkJointLimit] Goal value exceeded limit at " + STRING(component_name) + ".");
886  return false;
887  }
888 }
889 
890 bool RobotisManipulator::checkJointLimit(std::vector<Name> component_name, std::vector<double> position_vector)
891 {
892  for(uint32_t index = 0; index < component_name.size(); index++)
893  {
894  if(!trajectory_.getManipulator()->checkJointLimit(component_name.at(index), position_vector.at(index)))
895  {
896  log::error("[checkJointLimit] Goal value exceeded limit at " + STRING(component_name.at(index)) + ".");
897  return false;
898  }
899  }
900  return true;
901 }
902 
903 bool RobotisManipulator::checkJointLimit(std::vector<Name> component_name, std::vector<JointValue> value_vector)
904 {
905  for(uint32_t index = 0; index < component_name.size(); index++)
906  {
907  if(!trajectory_.getManipulator()->checkJointLimit(component_name.at(index), value_vector.at(index).position))
908  {
909  log::error("[checkJointLimit] Goal value exceeded limit at " + STRING(component_name.at(index)) + ".");
910  return false;
911  }
912  }
913  return true;
914 }
915 
916 
917 /*****************************************************************************
918 ** Trajectory Control Fuction
919 *****************************************************************************/
921 {
922  return &trajectory_;
923 }
924 
925 void RobotisManipulator::makeJointTrajectoryFromPresentPosition(std::vector<double> delta_goal_joint_position, double move_time, std::vector<JointValue> present_joint_value)
926 {
927  if(present_joint_value.size() != 0)
928  {
929  trajectory_.setPresentJointWaypoint(present_joint_value);
931  }
932 
933  JointWaypoint present_way_point = trajectory_.getPresentJointWaypoint();
934  std::vector<double> goal_joint_position;
935  for(int i = 0; i < trajectory_.getManipulator()->getDOF(); i ++)
936  goal_joint_position.push_back(present_way_point.at(i).position + delta_goal_joint_position.at(i));
937 
938  makeJointTrajectory(goal_joint_position, move_time);
939 }
940 
941 void RobotisManipulator::makeJointTrajectory(std::vector<double> goal_joint_position, double move_time, std::vector<JointValue> present_joint_value)
942 {
944  trajectory_.setMoveTime(move_time);
945 
946  if(present_joint_value.size() != 0)
947  {
948  trajectory_.setPresentJointWaypoint(present_joint_value);
950  }
951 
952  JointWaypoint present_way_point = trajectory_.getPresentJointWaypoint();
953 
954  JointValue goal_way_point_temp;
955  JointWaypoint goal_way_point;
956  for (uint8_t index = 0; index < trajectory_.getManipulator()->getDOF(); index++)
957  {
958  goal_way_point_temp.position = goal_joint_position.at(index);
959  goal_way_point_temp.velocity = 0.0;
960  goal_way_point_temp.acceleration = 0.0;
961  goal_way_point_temp.effort = 0.0;
962 
963  goal_way_point.push_back(goal_way_point_temp);
964  }
965 
966  if(getMovingState())
967  {
968  moving_state_=false;
969  while(!step_moving_state_);
970  }
971  trajectory_.makeJointTrajectory(present_way_point, goal_way_point);
972  startMoving();
973 }
974 
975 void RobotisManipulator::makeJointTrajectory(std::vector<JointValue> goal_joint_value, double move_time, std::vector<JointValue> present_joint_value)
976 {
978  trajectory_.setMoveTime(move_time);
979 
980  if(present_joint_value.size() != 0)
981  {
982  trajectory_.setPresentJointWaypoint(present_joint_value);
984  }
985 
986  JointWaypoint present_way_point = trajectory_.getPresentJointWaypoint();
987 
988  if(getMovingState())
989  {
990  moving_state_=false;
991  while(!step_moving_state_);
992  }
993  trajectory_.makeJointTrajectory(present_way_point, goal_joint_value);
994  startMoving();
995 }
996 
997 void RobotisManipulator::makeJointTrajectory(Name tool_name, Eigen::Vector3d goal_position, double move_time, std::vector<JointValue> present_joint_value)
998 {
999  if(present_joint_value.size() != 0)
1000  {
1001  trajectory_.setPresentJointWaypoint(present_joint_value);
1003  }
1004 
1005  KinematicPose goal_pose;
1006 
1007  goal_pose.position = goal_position;
1009  makeJointTrajectory(tool_name, goal_pose, move_time);
1010 }
1011 
1012 void RobotisManipulator::makeJointTrajectory(Name tool_name, Eigen::Matrix3d goal_orientation, double move_time, std::vector<JointValue> present_joint_value)
1013 {
1014  if(present_joint_value.size() != 0)
1015  {
1016  trajectory_.setPresentJointWaypoint(present_joint_value);
1018  }
1019 
1020  KinematicPose goal_pose;
1021 
1023  goal_pose.orientation = goal_orientation;
1024  makeJointTrajectory(tool_name, goal_pose, move_time);
1025 }
1026 
1027 void RobotisManipulator::makeJointTrajectory(Name tool_name, KinematicPose goal_pose, double move_time, std::vector<JointValue> present_joint_value)
1028 {
1029  if(present_joint_value.size() != 0)
1030  {
1031  trajectory_.setPresentJointWaypoint(present_joint_value);
1033  }
1034 
1036  trajectory_.setMoveTime(move_time);
1037 
1038  JointWaypoint present_way_point = trajectory_.getPresentJointWaypoint();
1039 
1040  Pose temp_goal_pose;
1041  temp_goal_pose.kinematic = goal_pose;
1042  temp_goal_pose = trajectory_.removeWaypointDynamicData(temp_goal_pose);
1043  std::vector<JointValue> goal_joint_angle;
1044  if(kinematics_->solveInverseKinematics(trajectory_.getManipulator(), tool_name, temp_goal_pose, &goal_joint_angle))
1045  {
1046  if(getMovingState())
1047  {
1048  moving_state_=false;
1049  while(!step_moving_state_) ;
1050  }
1051  trajectory_.makeJointTrajectory(present_way_point, goal_joint_angle);
1052  startMoving();
1053  }
1054  else
1055  log::error("[JOINT_TRAJECTORY] Fail to solve IK");
1056 }
1057 
1058 void RobotisManipulator::makeTaskTrajectoryFromPresentPose(Name tool_name, Eigen::Vector3d position_meter, double move_time, std::vector<JointValue> present_joint_value)
1059 {
1060  if(present_joint_value.size() != 0)
1061  {
1062  trajectory_.setPresentJointWaypoint(present_joint_value);
1064  }
1065 
1066  KinematicPose goal_pose;
1067 
1068  goal_pose.position = trajectory_.getManipulator()->getComponentPositionFromWorld(tool_name) + position_meter;
1070  makeTaskTrajectory(tool_name, goal_pose, move_time);
1071 }
1072 
1073 void RobotisManipulator::makeTaskTrajectoryFromPresentPose(Name tool_name, Eigen::Matrix3d orientation_meter, double move_time, std::vector<JointValue> present_joint_value)
1074 {
1075  if(present_joint_value.size() != 0)
1076  {
1077  trajectory_.setPresentJointWaypoint(present_joint_value);
1079  }
1080 
1081  KinematicPose goal_pose;
1082 
1084  goal_pose.orientation = orientation_meter * trajectory_.getManipulator()->getComponentOrientationFromWorld(tool_name);
1085  makeTaskTrajectory(tool_name, goal_pose, move_time);
1086 }
1087 
1088 void RobotisManipulator::makeTaskTrajectoryFromPresentPose(Name tool_name, KinematicPose goal_pose_delta, double move_time, std::vector<JointValue> present_joint_value)
1089 {
1090  if(present_joint_value.size() != 0)
1091  {
1092  trajectory_.setPresentJointWaypoint(present_joint_value);
1094  }
1095 
1096  KinematicPose goal_pose;
1097 
1098  goal_pose.position = trajectory_.getManipulator()->getComponentPositionFromWorld(tool_name) + goal_pose_delta.position;
1099  goal_pose.orientation = goal_pose_delta.orientation * trajectory_.getManipulator()->getComponentOrientationFromWorld(tool_name);
1100  makeTaskTrajectory(tool_name, goal_pose, move_time);
1101 }
1102 
1103 
1104 void RobotisManipulator::makeTaskTrajectory(Name tool_name, Eigen::Vector3d goal_position, double move_time, std::vector<JointValue> present_joint_value)
1105 {
1106  if(present_joint_value.size() != 0)
1107  {
1108  trajectory_.setPresentJointWaypoint(present_joint_value);
1110  }
1111 
1112  KinematicPose goal_pose;
1113 
1114  goal_pose.position = goal_position;
1116  makeTaskTrajectory(tool_name, goal_pose, move_time);
1117 }
1118 
1119 void RobotisManipulator::makeTaskTrajectory(Name tool_name, Eigen::Matrix3d goal_orientation, double move_time, std::vector<JointValue> present_joint_value)
1120 {
1121  if(present_joint_value.size() != 0)
1122  {
1123  trajectory_.setPresentJointWaypoint(present_joint_value);
1125  }
1126 
1127  KinematicPose goal_pose;
1128 
1130  goal_pose.orientation = goal_orientation;
1131  makeTaskTrajectory(tool_name, goal_pose, move_time);
1132 }
1133 
1134 void RobotisManipulator::makeTaskTrajectory(Name tool_name, KinematicPose goal_pose, double move_time, std::vector<JointValue> present_joint_value)
1135 {
1138  trajectory_.setMoveTime(move_time);
1139 
1140  if(present_joint_value.size() != 0)
1141  {
1142  trajectory_.setPresentJointWaypoint(present_joint_value);
1144  }
1145 
1146  TaskWaypoint present_task_way_point = trajectory_.getPresentTaskWaypoint(tool_name);
1147 
1148  TaskWaypoint goal_task_way_point; //data conversion
1149  goal_task_way_point.kinematic = goal_pose;
1150  goal_task_way_point = trajectory_.removeWaypointDynamicData(goal_task_way_point);
1151 
1152  if(getMovingState())
1153  {
1154  moving_state_=false;
1155  while(!step_moving_state_) ;
1156  }
1157  trajectory_.makeTaskTrajectory(present_task_way_point, goal_task_way_point);
1158  startMoving();
1159 }
1160 
1161 void RobotisManipulator::setCustomTrajectoryOption(Name trajectory_name, const void* arg)
1162 {
1163  trajectory_.setCustomTrajectoryOption(trajectory_name, arg);
1164 }
1165 
1166 void RobotisManipulator::makeCustomTrajectory(Name trajectory_name, Name tool_name, const void *arg, double move_time, std::vector<JointValue> present_joint_value)
1167 {
1170  trajectory_.setMoveTime(move_time);
1171 
1172  if(present_joint_value.size() != 0)
1173  {
1174  trajectory_.setPresentJointWaypoint(present_joint_value);
1176  }
1177 
1178  TaskWaypoint present_task_way_point = trajectory_.getPresentTaskWaypoint(tool_name);
1179 
1180  if(getMovingState())
1181  {
1182  moving_state_=false;
1183  while(!step_moving_state_) ;
1184  }
1185  trajectory_.makeCustomTrajectory(trajectory_name, present_task_way_point, arg);
1186  startMoving();
1187 }
1188 
1189 void RobotisManipulator::makeCustomTrajectory(Name trajectory_name, const void *arg, double move_time, std::vector<JointValue> present_joint_value)
1190 {
1192  trajectory_.setMoveTime(move_time);
1193 
1194  if(present_joint_value.size() != 0)
1195  {
1196  trajectory_.setPresentJointWaypoint(present_joint_value);
1198  }
1199 
1200  JointWaypoint present_joint_way_point = trajectory_.getPresentJointWaypoint();
1201 
1202  if(getMovingState())
1203  {
1204  moving_state_=false;
1205  while(!step_moving_state_) ;
1206  }
1207  trajectory_.makeCustomTrajectory(trajectory_name, present_joint_way_point, arg);
1208  startMoving();
1209 }
1210 
1211 void RobotisManipulator::sleepTrajectory(double wait_time, std::vector<JointValue> present_joint_value)
1212 {
1214  trajectory_.setMoveTime(wait_time);
1215 
1216  if(present_joint_value.size() != 0)
1217  {
1218  trajectory_.setPresentJointWaypoint(present_joint_value);
1220  }
1221 
1222  JointWaypoint present_joint_way_point = trajectory_.getPresentJointWaypoint();
1223  JointWaypoint goal_way_point_vector = trajectory_.getPresentJointWaypoint();
1224  goal_way_point_vector = trajectory_.removeWaypointDynamicData(goal_way_point_vector);
1225 
1226  if(getMovingState())
1227  {
1228  moving_state_= false;
1229  while(!step_moving_state_) ;
1230  }
1231  trajectory_.makeJointTrajectory(present_joint_way_point, goal_way_point_vector);
1232  startMoving();
1233 }
1234 
1235 void RobotisManipulator::makeToolTrajectory(Name tool_name, double tool_goal_position)
1236 {
1237  JointValue tool_value;
1238  tool_value.position = tool_goal_position;
1239  tool_value.velocity = 0.0;
1240  tool_value.acceleration = 0.0;
1241  tool_value.effort =0.0;
1242 
1243  if(checkJointLimit(tool_name, tool_value))
1244  {
1245  trajectory_.setToolGoalValue(tool_name, tool_value);
1246  }
1247 }
1248 
1249 
1250 
1252 {
1253  JointWaypoint joint_way_point_value;
1254 
1257  {
1258  joint_way_point_value = trajectory_.getJointTrajectory().getJointWaypoint(tick_time);
1259 
1261  {
1263  moving_state_ = false;
1264  }
1265  }
1270  {
1271  TaskWaypoint task_way_point;
1272  task_way_point = trajectory_.getTaskTrajectory().getTaskWaypoint(tick_time);
1273 
1274  if(kinematics_->solveInverseKinematics(trajectory_.getManipulator(), trajectory_.getPresentControlToolName(), task_way_point, &joint_way_point_value))
1275  {
1277  {
1279  moving_state_ = false;
1280  }
1281  }
1282  else
1283  {
1285  log::error("[TASK_TRAJECTORY] fail to solve IK");
1286  moving_state_ = false;
1287  }
1288  }
1293  {
1294  joint_way_point_value = trajectory_.getCustomJointTrajectory(trajectory_.getPresentCustomTrajectoryName())->getJointWaypoint(tick_time);
1295 
1297  {
1299  moving_state_ = false;
1300  }
1301  }
1303  {
1304  TaskWaypoint task_way_point;
1305  task_way_point = trajectory_.getCustomTaskTrajectory(trajectory_.getPresentCustomTrajectoryName())->getTaskWaypoint(tick_time);
1306 
1307  if(kinematics_->solveInverseKinematics(trajectory_.getManipulator(), trajectory_.getPresentControlToolName(), task_way_point, &joint_way_point_value))
1308  {
1310  {
1312  moving_state_ = false;
1313  }
1314  }
1315  else
1316  {
1318  log::error("[CUSTOM_TASK_TRAJECTORY] fail to solve IK");
1319  moving_state_ = false;
1320  }
1321  }
1323  //set present joint task value to trajectory manipulator
1324  trajectory_.setPresentJointWaypoint(joint_way_point_value);
1326 
1327 // Eigen::Vector3d print_temp = trajectory_.getManipulator()->getComponentDynamicPoseFromWorld("gripper").angular.velocity;
1328 // log::PRINT("ang vel");
1329 // log::PRINT_VECTOR(print_temp);
1330 
1331  return joint_way_point_value;
1332 }
1333 
1334 std::vector<JointValue> RobotisManipulator::getJointGoalValueFromTrajectory(double present_time)
1335 {
1336  trajectory_.setPresentTime(present_time);
1337 
1339  {
1342  }
1343 
1344  if(moving_state_)
1345  {
1346  step_moving_state_ = false;
1347  JointWaypoint joint_goal_way_point;
1348  double tick_time = trajectory_.getTickTime();
1349 
1350  if(tick_time < trajectory_.getMoveTime())
1351  {
1352  moving_state_ = true;
1353  joint_goal_way_point = getTrajectoryJointValue(tick_time);
1354  }
1355  else
1356  {
1357  moving_state_ = false;
1358  joint_goal_way_point = getTrajectoryJointValue(trajectory_.getMoveTime());
1359  }
1360  step_moving_state_ = true;
1361  return joint_goal_way_point;
1362  }
1363  return {};
1364 }
1365 
1366 std::vector<JointValue> RobotisManipulator::getJointGoalValueFromTrajectoryTickTime(double tick_time)
1367 {
1369  {
1372  }
1373 
1374  if(moving_state_)
1375  {
1376  step_moving_state_ = false;
1377  JointWaypoint joint_goal_way_point ;
1378  if(tick_time < trajectory_.getMoveTime())
1379  {
1380  moving_state_ = true;
1381  joint_goal_way_point = getTrajectoryJointValue(tick_time);
1382  }
1383  else
1384  {
1385  moving_state_ = false;
1386  joint_goal_way_point = getTrajectoryJointValue(trajectory_.getMoveTime());
1387  }
1388  step_moving_state_ = true;
1389  return joint_goal_way_point;
1390  }
1391  return {};
1392 }
1393 
1394 std::vector<JointValue> RobotisManipulator::getToolGoalValue()
1395 {
1396  std::vector<JointValue> result_vector;
1397  std::vector<Name> tool_component_name = trajectory_.getManipulator()->getAllToolComponentName();
1398  for(uint32_t index =0; index<tool_component_name.size(); index++)
1399  {
1400  result_vector.push_back(trajectory_.getToolGoalValue(tool_component_name.at(index)));
1401  }
1402  return result_vector;
1403 }
uint8_t getToolActuatorId(Name actuator_name)
getToolActuatorId
CustomTaskTrajectory * getCustomTaskTrajectory(Name name)
getCustomTaskTrajectory
void setAllToolValue(std::vector< JointValue > tool_value_vector)
setAllToolValue
void printManipulatorSetting()
printManipulatorSetting
void setPresentControlToolName(Name present_control_tool_name)
setPresentControlToolName
void enableAllToolActuator()
enableAllToolActuator
void makeToolTrajectory(Name tool_name, double tool_goal_position)
makeToolTrajectory
std::vector< JointValue > getToolGoalValue()
getToolGoalValue
std::vector< JointValue > receiveMultipleToolActuatorValue(std::vector< Name > tool_component_name)
receiveMultipleToolActuatorValue
std::vector< JointValue > getAllToolValue()
getAllToolValue
bool getActuatorEnabledState(Name actuator_name)
getActuatorEnabledState
int8_t getId(Name component_name)
getId
void disableActuator(Name actuator_name)
disableActuator
void addCustomTrajectory(Name trajectory_name, CustomJointTrajectory *custom_trajectory)
addCustomTrajectory
std::vector< JointValue > receiveAllJointActuatorValue()
receiveAllJointActuatorValue
TaskWaypoint getPresentTaskWaypoint(Name tool_name)
getPresentTaskWaypoint
void makeCustomTrajectory(Name trajectory_name, JointWaypoint start_way_point, const void *arg)
makeCustomTrajectory
std::vector< JointValue > getAllActiveJointValue()
getAllActiveJointValue
void addJoint(Name my_name, Name parent_name, Name child_name, Eigen::Vector3d relative_position, Eigen::Matrix3d relative_orientation, Eigen::Vector3d axis_of_rotation=Eigen::Vector3d::Zero(), int8_t joint_actuator_id=-1, double max_position_limit=M_PI, double min_position_limit=-M_PI, double coefficient=1.0, double mass=0.0, Eigen::Matrix3d inertia_tensor=Eigen::Matrix3d::Identity(), Eigen::Vector3d center_of_mass=Eigen::Vector3d::Zero())
addJoint
void setCustomTrajectoryOption(Name trajectory_name, const void *arg)
setCustomTrajectoryOption
void disableAllJointActuator()
disableAllJointActuator
bool sendAllToolActuatorValue(std::vector< JointValue > value_vector)
sendAllToolActuatorValue
JointValue getToolValue(Name tool_name)
getToolValue
KinematicPose getKinematicPose(Name component_name)
getKinematicPose
main namespace
TaskWaypoint getTaskWaypoint(double tick)
getTaskWaypoint
bool sendMultipleJointActuatorValue(std::vector< Name > joint_component_name, std::vector< JointValue > value_vector)
sendMultipleJointActuatorValue
double getCoefficient(Name component_name)
getCoefficient
virtual void solveForwardKinematics(Manipulator *manipulator)=0
solveForwardKinematics
void setAllActiveJointValue(std::vector< JointValue > joint_value_vector)
setAllActiveJointValue
void addWorld(Name world_name, Name child_name, Eigen::Vector3d world_position=Eigen::Vector3d::Zero(), Eigen::Matrix3d world_orientation=Eigen::Matrix3d::Identity())
addWorld
std::vector< JointValue > receiveMultipleJointActuatorValue(std::vector< Name > joint_component_name)
receiveMultipleJointActuatorValue
JointValue receiveToolActuatorValue(Name tool_component_name)
receiveToolActuatorValue
std::vector< Name > getAllActiveJointComponentName()
getAllActiveJointComponentName
void setToolActuatorMode(Name actuator_name, const void *arg)
setToolActuatorMode
Name getComponentActuatorName(Name component_name)
getComponentActuatorName
std::vector< JointValue > getAllJointValue()
getAllJointValue
std::vector< JointValue > getJointGoalValueFromTrajectoryTickTime(double tick_time)
getJointGoalValueFromTrajectoryTickTime
DynamicPose getComponentDynamicPoseFromWorld(Name component_name)
getComponentDynamicPoseFromWorld
std::vector< JointValue > receiveAllToolActuatorValue()
receiveAllToolActuatorValue
Name findComponentNameUsingId(int8_t id)
findComponentNameUsingId
virtual bool solveInverseKinematics(Manipulator *manipulator, Name tool_name, Pose target_pose, std::vector< JointValue > *goal_joint_position)=0
solveInverseKinematics
std::map< Name, Component >::iterator getIteratorEnd()
getIteratorEnd
std::vector< JointValue > JointWaypoint
JointWaypoint getPresentJointWaypoint()
getPresentJointWaypoint
void makeJointTrajectory(std::vector< double > goal_joint_position, double move_time, std::vector< JointValue > present_joint_value={})
makeJointTrajectory
Trajectory * getTrajectory()
getTrajectory
void addToolActuator(Name tool_name, ToolActuator *tool_actuator, uint8_t id, const void *arg)
addToolActuator
void sleepTrajectory(double wait_time, std::vector< JointValue > present_joint_value={})
sleepTrajectory
void setPresentJointWaypoint(JointWaypoint joint_value_vector)
setPresentJointWaypoint
std::vector< JointValue > getAllJointValue()
getAllJointValue
JointValue getJointValue(Name joint_name)
getJointValue
std::vector< JointValue > getJointGoalValueFromTrajectory(double present_time)
getJointGoalValueFromTrajectory
bool sendAllJointActuatorValue(std::vector< JointValue > value_vector)
sendAllJointActuatorValue
void addComponentChild(Name my_name, Name child_name)
addComponentChild
void enableAllJointActuator()
enableAllJointActuator
void updatePresentWaypoint(Kinematics *kinematics)
updatePresentWaypoint
void solveForwardKinematics()
solveForwardKinematics
double getTrajectoryMoveTime()
getTrajectoryMoveTime
JointValue getToolGoalValue(Name tool_name)
getToolGoalValue
bool sendMultipleToolActuatorValue(std::vector< Name > tool_component_name, std::vector< JointValue > value_vector)
sendMultipleToolActuatorValue
void setToolGoalValue(Name tool_name, JointValue tool_goal_value)
setToolGoalValue
void disableAllToolActuator()
disableAllToolActuator
bool checkJointLimit(Name component_name, double position)
checkJointLimit
void setComponentActuatorName(Name component_name, Name actuator_name)
setComponentActuatorName
Pose getComponentPoseFromWorld(Name component_name)
getComponentPoseFromWorld
void makeTaskTrajectoryFromPresentPose(Name tool_name, Eigen::Vector3d position_meter, double move_time, std::vector< JointValue > present_joint_value={})
makeTaskTrajectoryFromPresentPose
std::vector< JointValue > getAllActiveJointValue()
getAllActiveJointValue
JointValue getJointValue(Name component_name)
getJointValue
bool checkTrajectoryType(TrajectoryType trajectory_type)
checkTrajectoryType
std::map< Name, Component >::iterator getIteratorBegin()
getIteratorBegin
JointWaypoint getJointWaypoint(double tick)
getJointWaypoint
std::vector< double > getAllToolPosition()
getAllToolPosition
std::map< Name, ToolActuator * > tool_actuator_
void setJointActuatorMode(Name actuator_name, std::vector< uint8_t > id_array, const void *arg)
setJointActuatorMode
DynamicPose getDynamicPose(Name component_name)
getDynamicPose
Eigen::Vector3d getComponentPositionFromWorld(Name component_name)
getComponentPositionFromWorld
std::vector< uint8_t > getJointActuatorId(Name actuator_name)
getJointActuatorId
virtual void setOption(const void *arg)=0
setOption
void addKinematics(Kinematics *kinematics)
addKinematics
virtual Eigen::MatrixXd jacobian(Manipulator *manipulator, Name tool_name)=0
jacobian
void enableActuator(Name actuator_name)
enableActuator
void makeJointTrajectoryFromPresentPosition(std::vector< double > delta_goal_joint_position, double move_time, std::vector< JointValue > present_joint_value={})
makeJointTrajectoryFromPresentPosition
std::vector< double > getAllToolPosition()
getAllToolPosition
Eigen::Matrix3d getComponentOrientationFromWorld(Name component_name)
getComponentOrientationFromWorld
bool checkComponentType(Name component_name, ComponentType component_type)
checkComponentType
bool sendToolActuatorValue(Name tool_component_name, JointValue value)
sendToolActuatorValue
void setKinematicsOption(const void *arg)
setKinematicsOption
void addTool(Name my_name, Name parent_name, Eigen::Vector3d relative_position, Eigen::Matrix3d relative_orientation, int8_t tool_id=-1, double max_position_limit=M_PI, double min_position_limit=-M_PI, double coefficient=1.0, double mass=0.0, Eigen::Matrix3d inertia_tensor=Eigen::Matrix3d::Identity(), Eigen::Vector3d center_of_mass=Eigen::Vector3d::Zero())
addTool
void initTrajectoryWaypoint(Manipulator actual_manipulator, Kinematics *kinematics)
initTrajectoryWaypoint
bool checkJointLimit(Name Component_name, double value)
checkJointLimit
void addTool(Name my_name, Name parent_name, Eigen::Vector3d relative_position, Eigen::Matrix3d relative_orientation, int8_t tool_id=-1, double max_position_limit=M_PI, double min_position_limit=-M_PI, double coefficient=1.0, double mass=0.0, Eigen::Matrix3d inertia_tensor=Eigen::Matrix3d::Identity(), Eigen::Vector3d center_of_mass=Eigen::Vector3d::Zero())
addTool
KinematicPose getComponentKinematicPoseFromWorld(Name component_name)
getComponentKinematicPoseFromWorld
JointWaypoint getTrajectoryJointValue(double tick_time)
getTrajectoryJointValue
bool solveInverseKinematics(Name tool_name, Pose goal_pose, std::vector< JointValue > *goal_joint_value)
solveInverseKinematics
JointWaypoint removeWaypointDynamicData(JointWaypoint value)
removeWaypointDynamicData
void makeTaskTrajectory(Name tool_name, Eigen::Vector3d goal_position, double move_time, std::vector< JointValue > present_joint_value={})
makeTaskTrajectory
void addWorld(Name world_name, Name child_name, Eigen::Vector3d world_position=Eigen::Vector3d::Zero(), Eigen::Matrix3d world_orientation=Eigen::Matrix3d::Identity())
addWorld
Eigen::MatrixXd jacobian(Name tool_name)
jacobian
std::vector< Name > getAllToolComponentName()
getAllToolComponentName
std::map< Name, JointActuator * > joint_actuator_
std::vector< JointValue > getAllToolValue()
getAllToolValue
void addCustomTrajectory(Name trajectory_name, CustomJointTrajectory *custom_trajectory)
addCustomTrajectory
JointTrajectory getJointTrajectory()
getJointTrajectory
void addJoint(Name my_name, Name parent_name, Name child_name, Eigen::Vector3d relative_position, Eigen::Matrix3d relative_orientation, Eigen::Vector3d axis_of_rotation=Eigen::Vector3d::Zero(), int8_t joint_actuator_id=-1, double max_position_limit=M_PI, double min_position_limit=-M_PI, double coefficient=1.0, double mass=0.0, Eigen::Matrix3d inertia_tensor=Eigen::Matrix3d::Identity(), Eigen::Vector3d center_of_mass=Eigen::Vector3d::Zero())
addJoint
Manipulator * getManipulator()
getManipulator
void makeTaskTrajectory(TaskWaypoint start_way_point, TaskWaypoint goal_way_point)
makeTaskTrajectory
Name getPresentCustomTrajectoryName()
getPresentCustomTrajectoryName
void setPresentTime(double present_time)
setPresentTime
void setCustomTrajectoryOption(Name trajectory_name, const void *arg)
setCustomTrajectoryOption
void printManipulatorSetting()
printManipulatorSetting
void makeJointTrajectory(JointWaypoint start_way_point, JointWaypoint goal_way_point)
makeJointTrajectory
std::string STRING
void addComponentChild(Name my_name, Name child_name)
addComponentChild
void makeCustomTrajectory(Name trajectory_name, Name tool_name, const void *arg, double move_time, std::vector< JointValue > present_joint_value={})
makeCustomTrajectory
CustomJointTrajectory * getCustomJointTrajectory(Name name)
getCustomJointTrajectory
void setTrajectoryType(TrajectoryType trajectory_type)
setTrajectoryType
void setJointValue(Name name, JointValue joint_value)
setJointValue
Pose getPose(Name component_name)
getPose
void addJointActuator(Name actuator_name, JointActuator *joint_actuator, std::vector< uint8_t > id_array, const void *arg)
addJointActuator
JointValue receiveJointActuatorValue(Name joint_component_name)
receiveJointActuatorValue
bool sendJointActuatorValue(Name joint_component_name, JointValue value)
sendJointActuatorValue