Robotis Manipulator  1.0.0
robotis_manipulator_trajectory_generator.h
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 #ifndef ROBOTIS_MNAMIPULATOR_TRAJECTORY_GENERATOR_H_
26 #define ROBOTIS_MNAMIPULATOR_TRAJECTORY_GENERATOR_H_
27 
28 #include <math.h>
29 #include <vector>
30 
32 
33 #if defined(__OPENCR__)
34  #include <Eigen.h> // Calls main Eigen matrix class library
35  #include <Eigen/LU> // Calls inverse, determinant, LU decomp., etc.
36  #include <Eigen/QR>
37 #else
38  #include <eigen3/Eigen/Eigen>
39  #include <eigen3/Eigen/LU>
40  #include <eigen3/Eigen/QR>
41 
42  #define PI 3.141592
43 #endif
44 
45 namespace robotis_manipulator
46 {
47 
52 {
53 private:
54  Eigen::VectorXd coefficient_;
55 
56 public:
57  MinimumJerk();
58  virtual ~MinimumJerk();
59 
66  void calcCoefficient(Point start,
67  Point goal,
68  double move_time);
73  Eigen::VectorXd getCoefficient();
74 };
75 
80 {
81 private:
84  Eigen::MatrixXd minimum_jerk_coefficient_;
85 
86 public:
88  virtual ~JointTrajectory();
89 
96  void makeJointTrajectory(double move_time,
97  JointWaypoint start,
98  JointWaypoint goal
99  );
104  Eigen::MatrixXd getMinimumJerkCoefficient();
110  JointWaypoint getJointWaypoint(double tick);
111 };
112 
117 {
118 private:
121  Eigen::MatrixXd minimum_jerk_coefficient_;
122 
123 public:
124  TaskTrajectory();
125  virtual ~TaskTrajectory();
126 
133  void makeTaskTrajectory(double move_time,
134  TaskWaypoint start,
135  TaskWaypoint goal
136  );
141  Eigen::MatrixXd getMinimumJerkCoefficient();
147  TaskWaypoint getTaskWaypoint(double tick);
148 };
149 
150 
151 /*****************************************************************************
152 ** Trajectory Class
153 *****************************************************************************/
154 
159 {
160 private:
164 
167  std::map<Name, CustomJointTrajectory *> cus_joint_;
168  std::map<Name, CustomTaskTrajectory *> cus_task_;
169 
172 
173 public:
176 
177  // Time
182  void setMoveTime(double move_time);
187  void setPresentTime(double present_time);
191  void setStartTimeToPresentTime();
196  void setStartTime(double start_time);
201  double getMoveTime();
206  double getTickTime();
207 
208  // Manipulator
213  void setManipulator(Manipulator manipulator);
218  Manipulator* getManipulator();
219 
220  // Get Trajectory
225  JointTrajectory getJointTrajectory();
230  TaskTrajectory getTaskTrajectory();
236  CustomJointTrajectory* getCustomJointTrajectory(Name name);
242  CustomTaskTrajectory* getCustomTaskTrajectory(Name name);
243 
244  // Custom Trajectory Setting
250  void addCustomTrajectory(Name trajectory_name, CustomJointTrajectory *custom_trajectory);
256  void addCustomTrajectory(Name trajectory_name, CustomTaskTrajectory *custom_trajectory);
262  void setCustomTrajectoryOption(Name trajectory_name, const void* arg);
267  void setPresentControlToolName(Name present_control_tool_name);
272  Name getPresentCustomTrajectoryName();
277  Name getPresentControlToolName();
278 
279  // Waypoint
285  void initTrajectoryWaypoint(Manipulator actual_manipulator, Kinematics *kinematics);
286 
291  void updatePresentWaypoint(Kinematics* kinematics); //forward kinematics,dynamics
296  void setPresentJointWaypoint(JointWaypoint joint_value_vector);
302  void setPresentTaskWaypoint(Name tool_name, TaskWaypoint tool_position_value_vector);
307  JointWaypoint getPresentJointWaypoint();
313  TaskWaypoint getPresentTaskWaypoint(Name tool_name);
319  JointWaypoint removeWaypointDynamicData(JointWaypoint value);
325  TaskWaypoint removeWaypointDynamicData(TaskWaypoint value);
326 
327  // Trajectory
332  void setTrajectoryType(TrajectoryType trajectory_type);
338  bool checkTrajectoryType(TrajectoryType trajectory_type);
344  void makeJointTrajectory(JointWaypoint start_way_point, JointWaypoint goal_way_point);
350  void makeTaskTrajectory(TaskWaypoint start_way_point, TaskWaypoint goal_way_point);
357  void makeCustomTrajectory(Name trajectory_name, JointWaypoint start_way_point, const void *arg);
364  void makeCustomTrajectory(Name trajectory_name, TaskWaypoint start_way_point, const void *arg);
365 
366  // Tool
372  void setToolGoalPosition(Name tool_name, double tool_goal_position);
378  void setToolGoalValue(Name tool_name, JointValue tool_goal_value);
384  double getToolGoalPosition(Name tool_name);
390  JointValue getToolGoalValue(Name tool_name);
391 };
392 
393 } // namespace robotis_manipulator
394 #endif // ROBOTIS_MNAMIPULATOR_TRAJECTORY_GENERATOR_H_
395 
396 
397 
void calcCoefficient(Point start, Point goal, double move_time)
calcCoefficient
main namespace
std::vector< JointValue > JointWaypoint
std::map< Name, CustomJointTrajectory * > cus_joint_
std::map< Name, CustomTaskTrajectory * > cus_task_