robotis_state.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 /*
18  * Link.cpp
19  *
20  * Created on: Jan 11, 2016
21  * Author: SCH
22  */
23 
25 
26 using namespace robotis_manipulator_h;
27 
29 {
30  is_moving_ = false;
31 
32  cnt_ = 0;
33  mov_time_ = 1.0;
34  smp_time_ = 0.008;
35  all_time_steps_ = int(mov_time_ / smp_time_) + 1;
36 
37  calc_joint_tra_ = Eigen::MatrixXd::Zero(all_time_steps_, MAX_JOINT_ID + 1);
38  calc_task_tra_ = Eigen::MatrixXd::Zero(all_time_steps_, 3);
39 
40  joint_ini_pose_ = Eigen::MatrixXd::Zero( MAX_JOINT_ID + 1, 1);
41 
42  // for inverse kinematics;
43  ik_solve_ = false;
44 
46 
49 
50  ik_id_start_ = 0;
51  ik_id_end_ = 0;
52 }
53 
55 {
56 }
57 
58 void RobotisState::setInverseKinematics(int cnt, Eigen::MatrixXd start_rotation)
59 {
60  for (int dim = 0; dim < 3; dim++)
61  ik_target_position_.coeffRef(dim, 0) = calc_task_tra_.coeff(cnt, dim);
62 
63  Eigen::Quaterniond start_quaternion = robotis_framework::convertRotationToQuaternion(start_rotation);
64 
65  Eigen::Quaterniond target_quaternion(kinematics_pose_msg_.pose.orientation.w,
66  kinematics_pose_msg_.pose.orientation.x,
67  kinematics_pose_msg_.pose.orientation.y,
68  kinematics_pose_msg_.pose.orientation.z);
69 
70  double count = (double) cnt / (double) all_time_steps_;
71 
72  Eigen::Quaterniond quaternion = start_quaternion.slerp(count, target_quaternion);
73 
75 }
76 
Eigen::Quaterniond convertRotationToQuaternion(const Eigen::Matrix3d &rotation)
void setInverseKinematics(int cnt, Eigen::MatrixXd start_rotation)
Eigen::Vector3d getTransitionXYZ(double position_x, double position_y, double position_z)
Eigen::Matrix3d convertQuaternionToRotation(const Eigen::Quaterniond &quaternion)
Eigen::Matrix3d convertRPYToRotation(double roll, double pitch, double yaw)
#define MAX_JOINT_ID
manipulator_h_base_module_msgs::KinematicsPose kinematics_pose_msg_
Definition: robotis_state.h:55


manipulator_h_base_module
Author(s): SCH
autogenerated on Mon Jun 10 2019 14:02:58