00001 00026 #ifndef JOINT_VEL_LIMITS_H_ 00027 #define JOINT_VEL_LIMITS_H_ 00028 00029 #include "constrained_ik/constraint.h" 00030 #include <vector> 00031 00032 namespace constrained_ik 00033 { 00034 namespace constraints 00035 { 00045 class JointVelLimits: public Constraint 00046 { 00047 public: 00048 EIGEN_MAKE_ALIGNED_OPERATOR_NEW 00050 struct JointVelLimitsData: public ConstraintData 00051 { 00052 EIGEN_MAKE_ALIGNED_OPERATOR_NEW 00053 const constraints::JointVelLimits* parent_; 00054 std::vector<int> limited_joints_; 00055 Eigen::VectorXd jvel_; 00058 JointVelLimitsData(const constrained_ik::SolverState &state, const constraints::JointVelLimits* parent); 00059 }; 00060 00061 JointVelLimits(); 00062 00069 void init(const Constrained_IK* ik) override; 00070 00072 constrained_ik::ConstraintResults evalConstraint(const SolverState &state) const override; 00073 00075 void loadParameters(const XmlRpc::XmlRpcValue &constraint_xml) override; 00076 00083 virtual Eigen::MatrixXd calcJacobian(const JointVelLimitsData &cdata) const; 00084 00092 virtual Eigen::VectorXd calcError(const JointVelLimitsData &cdata) const; 00093 00100 virtual bool checkStatus(const JointVelLimitsData &cdata) const { return cdata.limited_joints_.size() == 0; } 00101 00106 virtual double getWeight() const {return weight_;} 00107 00112 virtual void setWeight(const double &weight) {weight_ = weight;} 00113 00118 virtual double getTimestep() const {return timestep_;} 00119 00124 virtual void setTimestep(const double ×tep) {timestep_ = timestep;} 00125 00126 protected: 00127 Eigen::VectorXd vel_limits_; 00128 double weight_; 00129 double timestep_; 00130 }; 00131 00132 } /* namespace constraints */ 00133 } /* namespace constrained_ik */ 00134 #endif /* JOINT_VEL_LIMITS_H_ */