00001 00028 #ifndef CONSTRAINT_H 00029 #define CONSTRAINT_H 00030 00031 #include "solver_state.h" 00032 #include <boost/scoped_ptr.hpp> 00033 #include <Eigen/Core> 00034 #include <constrained_ik/constraint_results.h> 00035 #include <constrained_ik/constrained_ik_utils.h> 00036 #include <XmlRpc.h> 00037 00038 namespace constrained_ik 00039 { 00040 00041 // forward-declarations, to avoid circular inclusion 00042 class Constrained_IK; 00043 00048 class Constraint 00049 { 00050 public: 00051 EIGEN_MAKE_ALIGNED_OPERATOR_NEW 00052 00057 struct ConstraintData 00058 { 00059 EIGEN_MAKE_ALIGNED_OPERATOR_NEW 00060 00062 SolverState state_; 00063 00068 ConstraintData(const constrained_ik::SolverState &state) { state_ = state; } 00069 }; 00070 00071 Constraint() : initialized_(false), debug_(false) {} 00072 00078 virtual constrained_ik::ConstraintResults evalConstraint(const SolverState &state) const = 0; 00079 00084 virtual void init(const Constrained_IK* ik) { initialized_=true; ik_ = ik;} 00085 00090 virtual void loadParameters(const XmlRpc::XmlRpcValue &constraint_xml) {} 00091 00096 void setDebug(bool debug = true) {debug_= debug;} 00097 00098 protected: 00099 bool initialized_; 00100 bool debug_; 00101 const Constrained_IK* ik_; 00107 virtual int numJoints() const; 00108 00109 }; // class Constraint 00110 00111 00112 } // namespace constrained_ik 00113 00114 00115 #endif // CONSTRAINT_H 00116