1 #ifndef HRICS_COSTMANAGER_H
2 #define HRICS_COSTMANAGER_H
6 #include "database/semantics/Sem_ActionsManager.hpp"
7 #include <boost/function.hpp>
8 #include <boost/bind.hpp>
9 #include "API/ConfigSpace/localpath.hpp"
10 #include "HRICS_CostSettingType.h"
19 CostManager(
const std::string &global_path,
bool proactive=
false);
30 void updatePlannerSettings();
33 double getCostPath(std::vector<LocalPath*>& path);
34 double getCostAggregationNormalized(std::vector<LocalPath*> &path);
36 boost::function<double (std::vector<LocalPath*>&)> getCostPathFunction(
CostSettingType type);
44 typedef enum{CONF_COST,PATH_COST,PATH_SMOOTHING_COST} CostAppliesWhen_t;
51 bool readActionsCostMapping(std::string path);
52 bool readCostSetting(
const CostSettingType &cost, CostAppliesWhen_t when);
53 bool readCostSetting(std::string path,
const CostSettingType &cost,CostAppliesWhen_t when);
56 bool readAlgoParams(
const Sem::AgentType &agent_type,
const std::string &path);
58 boost::function<double(Configuration&)> jsonToFunction(Json::Value &f);
59 static boost::function<double(double,double)> elementaryOperation(std::string
const &name);
60 static boost::function<double(double)> elementaryFunction(std::string
const &name,
const Json::Value &json);
61 boost::function<double(std::vector<LocalPath*>&)> jsonToFunctionTraj(Json::Value &f);
63 std::string getPath();
64 std::string getPath(CostAppliesWhen_t when);
67 bool proactive()
const;
68 void setProactive(
bool proactive);
70 std::string globalPath()
const;
71 void setGlobalPath(
const std::string &globalPath);
75 bool isSmoothing()
const;
77 double pathCostNormalizationFactor()
const;
78 void setPathCostNormalizationFactor(
double pathCostNormalizationFactor);
80 static double sigmoidFunction(
double val,
double upper,
double lower,
double min,
double max);
81 static double boundFunction(
double val,
double min,
double max);
82 static double affineFunction(
double val,
double a,
double b);
84 Env::boolParameter planningMethod();
86 bool hasControlOnPlanning()
const;
87 void setHasControlOnPlanning(
bool hasControlOnPlanning);
89 std::map<std::string, double>
const &functionCostStack()
const;
92 double getCostStack(std::string
const &name,
Configuration &q);
93 double getCostStackPath(std::string
const &name,std::vector<LocalPath*>& path);
98 bool _hasControlOnPlanning;
100 std::string _globalPath;
102 std::map<Sem::ActionType,CostSettingType> _actionCostMapping;
103 std::map<CostSettingType,boost::function<double(Configuration&)> > _functions;
105 std::map<CostSettingType,boost::function<double(std::vector<LocalPath*>&)> > _functionsTraj;
106 std::map<CostSettingType,boost::function<double(std::vector<LocalPath*>&)> > _functionsTrajSmoothing;
108 std::map<std::string,double> _functionCostStack;
109 bool _lockFunctionsCostStack;
110 std::map<std::string,double> _functionCostStackPath;
111 bool _lockFunctionsCostStackPath;
114 AlgoParams():extStep(0),finalGap(0){}
115 AlgoParams(
double extStep,
double finalGap):extStep(extStep),finalGap(finalGap){}
116 double extStep,finalGap;
119 void updatePlannerSettings(AlgoParams ¶ms);
120 std::map<Sem::AgentType,AlgoParams> _algoParams;
128 double _pathCostNormalizationFactor;
134 #endif // HRICS_COSTMANAGER_H
Definition: Sem_AgentType.hpp:12
void takeControlAndSet()
set the planner and cost space according to given settings
Definition: HRICS_CostManager.cpp:47
Definition: HRICS_CostSettingType.h:9
This file implements macros to help with the logging, in a way similar to ROS, using log4cxx...
Definition: trajectory.hpp:40
Definition: Sem_Actions.hpp:14
Definition: HRICS_CostManager.h:14
Classe représentant une Configuration d'un Robot.
Definition: configuration.hpp:25
bool fetchSettings()
fetchSettings get settings from json files at default emplacement
Definition: HRICS_CostManager.cpp:245