00001 /* 00002 * Software License Agreement (Apache License) 00003 * 00004 * Copyright (c) 2013, Southwest Research Institute 00005 * 00006 * Licensed under the Apache License, Version 2.0 (the "License"); 00007 * you may not use this file except in compliance with the License. 00008 * You may obtain a copy of the License at 00009 * 00010 * http://www.apache.org/licenses/LICENSE-2.0 00011 * 00012 * Unless required by applicable law or agreed to in writing, software 00013 * distributed under the License is distributed on an "AS IS" BASIS, 00014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 * See the License for the specific language governing permissions and 00016 * limitations under the License. 00017 */ 00018 00019 00020 #ifndef GOAL_ORIENTATION_H 00021 #define GOAL_ORIENTATION_H 00022 00023 #include "constrained_ik/constraint.h" 00024 00025 namespace constrained_ik 00026 { 00027 namespace constraints 00028 { 00029 00033 class GoalOrientation : public Constraint 00034 { 00035 public: 00036 GoalOrientation(); 00037 virtual ~GoalOrientation() {}; 00038 00044 virtual Eigen::MatrixXd calcJacobian(); 00045 00051 virtual Eigen::VectorXd calcError(); 00052 00058 static double calcAngle(const Eigen::Affine3d &p1, const Eigen::Affine3d &p2); 00059 00065 static Eigen::Vector3d calcAngleError(const Eigen::Affine3d &p1, const Eigen::Affine3d &p2); 00066 00071 virtual bool checkStatus() const; 00072 00076 Eigen::Vector3d getWeight() {return weight_;}; 00077 00080 virtual void reset(); 00081 00085 void setTolerance(double tol) {rot_err_tol_ = tol;}; //TODO turn tolerance into Vector3d 00086 00090 void setWeight(const Eigen::Vector3d &weight) {weight_ = weight;}; 00091 00096 virtual void update(const SolverState &state); 00097 00098 protected: 00099 double rot_err_tol_; // termination criteria 00100 double rot_err_; // current solution error 00101 Eigen::Vector3d weight_; // weight for each direction 00102 00103 }; // class GoalOrientation 00104 00105 } // namespace constraints 00106 } // namespace constrained_ik 00107 00108 00109 #endif // GOAL_ORIENTATION_H 00110