robotis_manipulator.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 
19 #ifndef ROBOTIS_MANIPULATOR_H_
20 #define ROBOTIS_MANIPULATOR_H_
21 
27 
28 #include <algorithm>
29 
31 {
32 
33 #define DYNAMICS_ALL_SOVING 0
34 #define DYNAMICS_GRAVITY_ONLY 1
35 #define DYNAMICS_NOT_SOVING 2
36 
38 {
39 private:
44  std::map<Name, JointActuator *> joint_actuator_;
45  std::map<Name, ToolActuator *> tool_actuator_;
46 
51 
56 
57 private:
58  void startMoving();
59  JointWaypoint getTrajectoryJointValue(double tick_time, int option=0);
60 
61 public:
63  virtual ~RobotisManipulator();
64 
65 
66  /*****************************************************************************
67  ** Initialize Function
68  *****************************************************************************/
69  void addWorld(Name world_name,
70  Name child_name,
71  Eigen::Vector3d world_position = Eigen::Vector3d::Zero(),
72  Eigen::Matrix3d world_orientation = Eigen::Matrix3d::Identity());
73 
74  void addJoint(Name my_name,
75  Name parent_name,
76  Name child_name,
77  Eigen::Vector3d relative_position,
78  Eigen::Matrix3d relative_orientation,
79  Eigen::Vector3d axis_of_rotation = Eigen::Vector3d::Zero(),
80  int8_t joint_actuator_id = -1,
81  double max_position_limit = M_PI,
82  double min_position_limit = -M_PI,
83  double coefficient = 1.0,
84  double mass = 0.0,
85  Eigen::Matrix3d inertia_tensor = Eigen::Matrix3d::Identity(),
86  Eigen::Vector3d center_of_mass = Eigen::Vector3d::Zero(),
87  double torque_coefficient = 1.0);
88 
89  void addTool(Name my_name,
90  Name parent_name,
91  Eigen::Vector3d relative_position,
92  Eigen::Matrix3d relative_orientation,
93  int8_t tool_id = -1,
94  double max_position_limit =M_PI,
95  double min_position_limit = -M_PI,
96  double coefficient = 1.0,
97  double object_mass = 0.0,
98  Eigen::Matrix3d object_inertia_tensor = Eigen::Matrix3d::Identity(),
99  Eigen::Vector3d object_center_of_mass = Eigen::Vector3d::Zero());
100 
101  void addComponentChild(Name my_name, Name child_name);
103 
104  void addKinematics(Kinematics *kinematics);
105  void addDynamics(Dynamics *dynamics);
106  void addJointActuator(Name actuator_name, JointActuator *joint_actuator, std::vector<uint8_t> id_array, const void *arg);
107  void addToolActuator(Name tool_name, ToolActuator *tool_actuator, uint8_t id, const void *arg);
108  void addCustomTrajectory(Name trajectory_name, CustomJointTrajectory *custom_trajectory);
109  void addCustomTrajectory(Name trajectory_name, CustomTaskTrajectory *custom_trajectory);
110 
111  /*****************************************************************************
112  ** Manipulator Function
113  *****************************************************************************/
115 
116  void setTorqueCoefficient(Name component_name, double torque_coefficient);
117 
118  JointValue getJointValue(Name joint_name);
119  JointValue getToolValue(Name tool_name);
120  std::vector<JointValue> getAllActiveJointValue();
121  std::vector<JointValue> getAllJointValue();
122  std::vector<double> getAllToolPosition();
123  std::vector<JointValue> getAllToolValue();
124  KinematicPose getKinematicPose(Name component_name);
125  DynamicPose getDynamicPose(Name component_name);
126  Pose getPose(Name component_name);
127 
128  /*****************************************************************************
129  ** Kinematics Function (Including Virtual Function)
130  *****************************************************************************/
132  Eigen::MatrixXd jacobian(Name tool_name);
133  void solveForwardKinematics();
134  void solveForwardKinematics(std::vector<JointValue> *goal_joint_value);
135  bool solveInverseKinematics(Name tool_name, Pose goal_pose, std::vector<JointValue> *goal_joint_value);
136  void setKinematicsOption(const void* arg);
137 
138  /*****************************************************************************
139  ** Dynamics Function (Including Virtual Function)
140  *****************************************************************************/
142  void solveForwardDynamics(std::map<Name, double> joint_torque);
143  bool solveInverseDynamics(std::map<Name, double> *joint_torque);
144  bool solveGravityTerm(std::map<Name, double> *joint_torque);
145  void setDynamicsOption(STRING param_name, const void* arg);
146  void setDynamicsEnvironments(STRING param_name, const void* arg);
147 
148  /*****************************************************************************
149  ** Actuator Function (Including Virtual Function)
150  *****************************************************************************/
151  JointActuator *getJointActuator(Name actuator_name);
152  ToolActuator *getToolActuator(Name actuator_name);
153  void setJointActuatorMode(Name actuator_name, std::vector<uint8_t> id_array, const void *arg);
154  void setToolActuatorMode(Name actuator_name, const void *arg);
155  std::vector<uint8_t> getJointActuatorId(Name actuator_name);
156  uint8_t getToolActuatorId(Name actuator_name);
157  void enableActuator(Name actuator_name);
158  void disableActuator(Name actuator_name);
159  void enableAllJointActuator();
161  void enableAllToolActuator();
162  void disableAllToolActuator();
163  void enableAllActuator();
164  void disableAllActuator();
165  bool getActuatorEnabledState(Name actuator_name);
166 
167  bool sendJointActuatorValue(Name joint_component_name, JointValue value);
168  bool sendMultipleJointActuatorValue(std::vector<Name> joint_component_name, std::vector<JointValue> value_vector);
169  bool sendAllJointActuatorValue(std::vector<JointValue> value_vector);
170  JointValue receiveJointActuatorValue(Name joint_component_name);
171  std::vector<JointValue> receiveMultipleJointActuatorValue(std::vector<Name> joint_component_name);
172  std::vector<JointValue> receiveAllJointActuatorValue();
173 
174  bool sendToolActuatorValue(Name tool_component_name, JointValue value);
175  bool sendMultipleToolActuatorValue(std::vector<Name> tool_component_name, std::vector<JointValue> value_vector);
176  bool sendAllToolActuatorValue(std::vector<JointValue> value_vector);
177  JointValue receiveToolActuatorValue(Name tool_component_name);
178  std::vector<JointValue> receiveMultipleToolActuatorValue(std::vector<Name> tool_component_name);
179  std::vector<JointValue> receiveAllToolActuatorValue();
180 
181  /*****************************************************************************
182  ** Time Function
183  *****************************************************************************/
184  double getTrajectoryMoveTime();
185  bool getMovingState();
186 
187  /*****************************************************************************
188  ** Check Joint Limit Function
189  *****************************************************************************/
190  bool checkJointLimit(Name component_name, double position);
191  bool checkJointLimit(Name component_name, JointValue value);
192  bool checkJointLimit(std::vector<Name> component_name, std::vector<double> position_vector);
193  bool checkJointLimit(std::vector<Name> component_name, std::vector<JointValue> value_vector);
194 
195  /*****************************************************************************
196  ** Trajectory Control Fuction
197  *****************************************************************************/
205  bool makeJointTrajectoryFromPresentPosition(std::vector<double> delta_goal_joint_position, double move_time, std::vector<JointValue> present_joint_value = {});
212  bool makeJointTrajectory(std::vector<double> goal_joint_position, double move_time, std::vector<JointValue> present_joint_value = {});
219  bool makeJointTrajectory(std::vector<JointValue> goal_joint_value, double move_time, std::vector<JointValue> present_joint_value = {});
227  bool makeJointTrajectory(Name tool_name, Eigen::Vector3d goal_position, double move_time, std::vector<JointValue> present_joint_value = {});
235  bool makeJointTrajectory(Name tool_name, Eigen::Matrix3d goal_orientation, double move_time, std::vector<JointValue> present_joint_value = {});
243  bool makeJointTrajectory(Name tool_name, KinematicPose goal_pose, double move_time, std::vector<JointValue> present_joint_value = {});
251  bool makeTaskTrajectoryFromPresentPose(Name tool_name, Eigen::Vector3d position_meter, double move_time, std::vector<JointValue> present_joint_value = {});
259  bool makeTaskTrajectoryFromPresentPose(Name tool_name, Eigen::Matrix3d orientation_meter, double move_time, std::vector<JointValue> present_joint_value = {});
267  bool makeTaskTrajectoryFromPresentPose(Name tool_name, KinematicPose goal_pose_delta, double move_time, std::vector<JointValue> present_joint_value = {});
275  bool makeTaskTrajectory(Name tool_name, Eigen::Vector3d goal_position, double move_time, std::vector<JointValue> present_joint_value = {});
283  bool makeTaskTrajectory(Name tool_name, Eigen::Matrix3d goal_orientation, double move_time, std::vector<JointValue> present_joint_value = {});
291  bool makeTaskTrajectory(Name tool_name, KinematicPose goal_pose, double move_time, std::vector<JointValue> present_joint_value = {});
292 
298  void setCustomTrajectoryOption(Name trajectory_name, const void* arg);
307  bool makeCustomTrajectory(Name trajectory_name, Name tool_name, const void *arg, double move_time, std::vector<JointValue> present_joint_value = {});
315  bool makeCustomTrajectory(Name trajectory_name, const void *arg, double move_time, std::vector<JointValue> present_joint_value = {});
321  bool sleepTrajectory(double wait_time, std::vector<JointValue> present_joint_value = {});
327  bool makeToolTrajectory(Name tool_name, double tool_goal_position);
333  std::vector<JointValue> getJointGoalValueFromTrajectory(double present_time, int option=DYNAMICS_ALL_SOVING);
338  std::vector<JointValue> getToolGoalValue();
339  std::vector<JointValue> getJointGoalValueFromTrajectoryTickTime(double tick_time);
340 
341  void stopMoving();
342  bool getMovingFailState();
343  void resetMovingFailState();
344 };
345 } // namespace ROBOTIS_MANIPULATOR
346 
347 #endif
bool checkJointLimit(Name component_name, double position)
JointActuator * getJointActuator(Name actuator_name)
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 object_mass=0.0, Eigen::Matrix3d object_inertia_tensor=Eigen::Matrix3d::Identity(), Eigen::Vector3d object_center_of_mass=Eigen::Vector3d::Zero())
std::vector< JointValue > getToolGoalValue()
getToolGoalValue
bool sleepTrajectory(double wait_time, std::vector< JointValue > present_joint_value={})
sleepTrajectory
std::vector< JointValue > receiveAllToolActuatorValue()
std::vector< JointValue > getJointGoalValueFromTrajectoryTickTime(double tick_time)
std::vector< JointValue > getJointGoalValueFromTrajectory(double present_time, int option=DYNAMICS_ALL_SOVING)
getJointGoalValueFromTrajectory
bool makeTaskTrajectoryFromPresentPose(Name tool_name, Eigen::Vector3d position_meter, double move_time, std::vector< JointValue > present_joint_value={})
makeTaskTrajectoryFromPresentPose
void setTorqueCoefficient(Name component_name, double torque_coefficient)
std::vector< JointValue > getAllActiveJointValue()
bool makeTaskTrajectory(Name tool_name, Eigen::Vector3d goal_position, double move_time, std::vector< JointValue > present_joint_value={})
makeTaskTrajectory
JointWaypoint getTrajectoryJointValue(double tick_time, int option=0)
bool makeCustomTrajectory(Name trajectory_name, Name tool_name, const void *arg, double move_time, std::vector< JointValue > present_joint_value={})
makeCustomTrajectory
DynamicPose getDynamicPose(Name component_name)
bool makeJointTrajectory(std::vector< double > goal_joint_position, double move_time, std::vector< JointValue > present_joint_value={})
makeJointTrajectory
bool solveGravityTerm(std::map< Name, double > *joint_torque)
KinematicPose getKinematicPose(Name component_name)
bool sendJointActuatorValue(Name joint_component_name, JointValue value)
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(), double torque_coefficient=1.0)
std::vector< JointValue > JointWaypoint
std::vector< JointValue > getAllJointValue()
std::vector< JointValue > receiveMultipleJointActuatorValue(std::vector< Name > joint_component_name)
uint8_t getToolActuatorId(Name actuator_name)
void addComponentChild(Name my_name, Name child_name)
bool makeJointTrajectoryFromPresentPosition(std::vector< double > delta_goal_joint_position, double move_time, std::vector< JointValue > present_joint_value={})
makeJointTrajectoryFromPresentPosition
std::vector< JointValue > receiveAllJointActuatorValue()
void setToolActuatorMode(Name actuator_name, const void *arg)
void setDynamicsEnvironments(STRING param_name, const void *arg)
bool makeToolTrajectory(Name tool_name, double tool_goal_position)
makeToolTrajectory
ToolActuator * getToolActuator(Name actuator_name)
#define DYNAMICS_ALL_SOVING
bool solveInverseDynamics(std::map< Name, double > *joint_torque)
std::vector< uint8_t > getJointActuatorId(Name actuator_name)
JointValue receiveJointActuatorValue(Name joint_component_name)
bool sendAllToolActuatorValue(std::vector< JointValue > value_vector)
bool sendMultipleJointActuatorValue(std::vector< Name > joint_component_name, std::vector< JointValue > value_vector)
bool sendAllJointActuatorValue(std::vector< JointValue > value_vector)
std::vector< JointValue > receiveMultipleToolActuatorValue(std::vector< Name > tool_component_name)
Eigen::MatrixXd jacobian(Name tool_name)
void setCustomTrajectoryOption(Name trajectory_name, const void *arg)
setCustomTrajectoryOption
std::map< Name, ToolActuator * > tool_actuator_
bool solveInverseKinematics(Name tool_name, Pose goal_pose, std::vector< JointValue > *goal_joint_value)
bool sendMultipleToolActuatorValue(std::vector< Name > tool_component_name, std::vector< JointValue > value_vector)
void solveForwardDynamics(std::map< Name, double > joint_torque)
void addCustomTrajectory(Name trajectory_name, CustomJointTrajectory *custom_trajectory)
bool sendToolActuatorValue(Name tool_component_name, JointValue value)
void addKinematics(Kinematics *kinematics)
JointValue receiveToolActuatorValue(Name tool_component_name)
void setDynamicsOption(STRING param_name, const void *arg)
std::map< Name, JointActuator * > joint_actuator_
void addJointActuator(Name actuator_name, JointActuator *joint_actuator, std::vector< uint8_t > id_array, const void *arg)
void setJointActuatorMode(Name actuator_name, std::vector< uint8_t > id_array, const void *arg)
std::string STRING
void addWorld(Name world_name, Name child_name, Eigen::Vector3d world_position=Eigen::Vector3d::Zero(), Eigen::Matrix3d world_orientation=Eigen::Matrix3d::Identity())
void addToolActuator(Name tool_name, ToolActuator *tool_actuator, uint8_t id, const void *arg)


robotis_manipulator
Author(s): Hye-Jong KIM , Darby Lim , Yong-Ho Na , Ryan Shim
autogenerated on Sat Oct 3 2020 03:14:51