constraint.h
Go to the documentation of this file.
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 CONSTRAINT_H
00021 #define CONSTRAINT_H
00022 
00023 #include "solver_state.h"
00024 #include <boost/scoped_ptr.hpp>
00025 #include <Eigen/Core>
00026 
00027 namespace constrained_ik
00028 {
00029 
00030 // forward-declarations, to avoid circular inclusion
00031 class Constrained_IK;
00032 
00037 class Constraint
00038 {
00039 public:
00040   Constraint() : initialized_(false), debug_(false) {};
00041   virtual ~Constraint() {};
00042 
00043   static void appendError(Eigen::VectorXd &error, const Eigen::VectorXd &addErr);
00044 
00045   static void appendJacobian(Eigen::MatrixXd &jacobian, const Eigen::MatrixXd &addJacobian);
00046 
00047   virtual Eigen::VectorXd calcError() = 0;
00048 
00049   virtual Eigen::MatrixXd calcJacobian() = 0;
00050 
00051   virtual bool checkStatus() const { return false; }
00052 
00053   virtual void init(const Constrained_IK* ik) { initialized_=true; ik_ = ik; }
00054 
00055   virtual void reset() { };
00056 
00060   void setDebug(bool debug = true) {debug_= debug;};
00061 
00062   virtual void update(const SolverState &state) { state_ = state; }
00063 
00064   virtual void updateError(Eigen::VectorXd &error);
00065 
00066   virtual void updateJacobian(Eigen::MatrixXd &jacobian);
00067 
00068   EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00069 
00070 protected:
00071   bool initialized_;
00072   bool debug_;
00073   const Constrained_IK* ik_;
00074   SolverState state_;
00075 
00076   int numJoints();
00077 }; // class Constraint
00078 
00079 
00080 } // namespace constrained_ik
00081 
00082 
00083 #endif // CONSTRAINT_H
00084 


constrained_ik
Author(s): Chris Lewis , Jeremy Zoss , Dan Solomon
autogenerated on Mon Oct 6 2014 00:52:26