1 #ifndef COST_SPACE_HPP_INCLUDED
2 #define COST_SPACE_HPP_INCLUDED
4 #include <boost/function.hpp>
8 #include "API/ConfigSpace/configuration.hpp"
9 #include "API/ConfigSpace/localpath.hpp"
10 #include "API/Roadmap/graph.hpp"
17 typedef Eigen::Matrix<double, 6, 1> Vector6d;
18 typedef Eigen::Matrix<double, 6, 6> Matrix6d;
19 typedef Eigen::Matrix<double, 5, 6> Matrix56d;
25 enum CostSpaceDeltaStepMethod
31 cs_config_cost_and_dist,
40 enum CostSpaceResolutionMethod
56 std::string getSelectedCostName();
59 std::vector<std::string> getAllCost();
61 boost::function<double(Configuration&)> getCostFunction(std::string name);
62 boost::function<double(std::vector<LocalPath*>&)> getCostFunctionTrajectories(std::string name);
65 bool setCost(std::string name);
66 bool setCostTraj(std::string name);
69 void addCost(std::string name,
71 void addCostTrajectories(std::string name,
72 boost::function<
double(std::vector<LocalPath*>&)> f);
75 void deleteCost(std::string name);
76 void deleteCostTraj(std::string name);
84 double cost(std::vector<LocalPath*>::iterator first, std::vector<LocalPath*>::iterator last);
85 double cost(std::vector<LocalPath*>& path);
87 double costAggregationOverTraj(std::vector<LocalPath*> &path);
88 double costAggregationOverTraj(std::vector<LocalPath*>::iterator first, std::vector<LocalPath*>::iterator last);
91 double cost(
LocalPath& path,
int& nb_test);
94 void setNodeCost(
Node* node,
Node* parent);
97 void initMotionPlanning(graph* graph, node* start, node* goal);
100 void setDistanceMethod(CostSpaceResolutionMethod method) { m_resolution = method; }
103 void setDeltaStepMethod(CostSpaceDeltaStepMethod method) { m_deltaMethod = method; }
106 CostSpaceDeltaStepMethod getDeltaStepMethod() {
return m_deltaMethod; }
109 double deltaStepCost(
double cost1,
double cost2,
double length);
110 double edgeCost(confPtr_t from, confPtr_t to);
115 void setCompositeCostFactor(std::string func,
double factor);
116 double getCompositeCostFactor(std::string func);
117 doubleContainer *getCompositeCostFactorObject(std::string func);
119 void initCompositeCostFactors();
120 void setCompositeSumFunction(std::string f);
121 std::vector<std::string> getCompositeSumFunctions(
void);
122 std::string getCompositeSumFunction();
125 double startGoalDist_ratio()
const;
126 void setStartGoalDist_ratio(
double startGoalDist_ratio);
127 double startGoalDist_power()
const;
128 void setStartGoalDist_power(
double startGoalDist_power);
135 std::string mSelectedCostName;
136 boost::function<double(Configuration&)> mSelectedCost;
137 std::map<std::string, boost::function<double(Configuration&)> > mFunctions;
139 std::string mSelectedCostTrajectoriesName;
140 boost::function<double(std::vector<LocalPath*>&)> mSelectedFunctionsTrajectories;
141 std::map<std::string, boost::function<double(std::vector<LocalPath*>&)> > mFunctionsTrajectories;
143 void getPr2ArmConfiguration( Eigen::VectorXd& x, confPtr_t q );
144 double getPr2ArmDistance(
Robot* robot, Eigen::VectorXd& q_i, Eigen::VectorXd& q_f );
148 enum CostSpaceDeltaStepMethod m_deltaMethod;
149 enum CostSpaceResolutionMethod m_resolution;
152 std::map<std::string , doubleContainer* > mCompositionFactors;
153 enum{ COST_COMPOSITE_PLUS, COST_COMPOSITE_MAX, COST_COMPOSITE_MIN} mCompostionFunction;
156 double mStartGoalDist_ratio, mStartGoalDist_power;
182 EIGEN_MAKE_ALIGNED_OPERATOR_NEW;
204 Eigen::Vector3d B[6];
207 double cableLength[6];
210 double admissibleTension[6][2];
216 Eigen::Vector3d wrenchPoint;
225 double quadThrust[3];
228 double offsetAnchorCM[3];
234 Eigen::Vector3d vB[3];
240 Eigen::Vector3d quadWeight[3];
243 namespace GlobalCostSpace
257 double computeLocalpathKinematicCost(p3d_rob* rob, p3d_localpath* LP);
double deltaStepCost(double cost1, double cost2, double length)
ComputeDeltaStepCost Compute the cost of a portion of path.
Definition: cost_space.cpp:366
Classe représentant un Node d'un Graph.
Definition: node.hpp:39
Classe représentant un chemin local.
Definition: localpath.hpp:15
This class holds a the robot represented by a kinematic chain.
Definition: robot.hpp:42
double flyCraneCost(Configuration *conf)
Cost function involving the tensions exerted on the cables and the quadrotor thrusts.
Definition: cost_space.cpp:1015
This file implements macros to help with the logging, in a way similar to ROS, using log4cxx...
void computeQuadAnchorPoints(Configuration *conf)
Compute the coordinates (in the global reference frame) of the anchor points, Aij, of the quadrotors and fill the corresponding attributes in the given configuration.
Definition: cost_space.cpp:982
void initializeFlyCraneCostSpace()
Initialize the FlyCrane cost space.
Definition: cost_space.cpp:876
Classe représentant une Configuration d'un Robot.
Definition: configuration.hpp:25
Class thats holding the CostSpace.
Definition: cost_space.hpp:49
Eigen::Matrix3d RotationMatrix(double orientation[])
Compute the rotation matrix of a given vector of angles.
Definition: cost_space.cpp:968