goal_minimize_change.cpp
Go to the documentation of this file.
00001 
00026 #include "constrained_ik/constrained_ik.h"
00027 #include "constrained_ik/constraints/goal_minimize_change.h"
00028 #include <pluginlib/class_list_macros.h>
00029 PLUGINLIB_EXPORT_CLASS(constrained_ik::constraints::GoalMinimizeChange, constrained_ik::Constraint)
00030 
00031 const double DEFAULT_WEIGHT = 1.0; 
00033 namespace constrained_ik
00034 {
00035 namespace constraints
00036 {
00037 
00038 using namespace Eigen;
00039 
00040 // initialize limits/tolerances to default values
00041 GoalMinimizeChange::GoalMinimizeChange() : Constraint(), weight_(DEFAULT_WEIGHT)
00042 {
00043 }
00044 
00045 constrained_ik::ConstraintResults GoalMinimizeChange::evalConstraint(const SolverState &state) const
00046 {
00047   constrained_ik::ConstraintResults output;
00048   GoalMinimizeChange::ConstraintData cdata(state);
00049 
00050   output.error = calcError(cdata);
00051   output.jacobian = calcJacobian(cdata);
00052   output.status = checkStatus(cdata);
00053 
00054   return output;
00055 }
00056 
00057 Eigen::VectorXd GoalMinimizeChange::calcError(const GoalMinimizeChange::ConstraintData &cdata) const
00058 {
00059     VectorXd err = cdata.state_.joint_seed - cdata.state_.joints;
00060     err *= weight_;
00061     return err;
00062 }
00063 
00064 Eigen::MatrixXd GoalMinimizeChange::calcJacobian(const GoalMinimizeChange::ConstraintData &cdata) const
00065 {
00066     size_t n = numJoints();    // number of joints
00067     MatrixXd  J = MatrixXd::Identity(n,n) * weight_;
00068     return J;
00069 }
00070 
00071 void GoalMinimizeChange::loadParameters(const XmlRpc::XmlRpcValue &constraint_xml)
00072 {
00073   XmlRpc::XmlRpcValue local_xml = constraint_xml;
00074   if (!getParam(local_xml, "weights", weight_))
00075   {
00076     ROS_WARN("Goal Minimize Change: Unable to retrieve weights member, default parameter will be used.");
00077   }
00078 
00079   if (!getParam(local_xml, "debug", debug_))
00080   {
00081     ROS_WARN("Goal Minimize Change: Unable to retrieve debug member, default parameter will be used.");
00082   }
00083 }
00084 
00085 } // namespace constraints
00086 } // namespace constrained_ik
00087 


constrained_ik
Author(s): Chris Lewis , Jeremy Zoss , Dan Solomon
autogenerated on Sat Jun 8 2019 19:23:45