libmove3d-planners
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Groups Pages
ConfGenerator.h
1 #ifndef CONFGENERATOR_H
2 #define CONFGENERATOR_H
3 
4 #include "API/Device/robot.hpp"
5 #include "planner/planner.hpp"
6 
7 #include "utils/OtpUtils.hpp"
8 #include "utils/ConfGenerator.h"
9 
10 #include "LightPlanner-pkg.h"
11 #include "planner/TrajectoryOptim/plannarTrajectorySmoothing.hpp"
12 #include "HRI_costspace/HRICS_Natural.hpp"
13 
14 
15 
16 #include <Eigen/Core>
17 #include <Eigen/StdVector>
18 
19 
21 {
22 public:
24  constrainedLink(Robot* first, std::vector<std::vector<double> > matrixRot, std::vector<double> vectTrans);
25  virtual ~constrainedLink();
26  void addRange(std::pair<int,std::vector<std::pair<double,double> > > range);
27 
28 
29  std::string name;
30  Robot* R;
31  std::vector<std::vector<double> > matrixRotation;
32  std::vector<double> vectTranslation;
33 
34  std::map<int,std::vector<std::pair<double,double> > > rangeList;
35  int nbDofs;
36 };
37 
38 
39 //typedef struct linkStruct
40 //{
41 // Robot* first;
42 // Robot* second;
43 // configurationConstraint CC;
44 //}linked;
45 
46 //typedef struct configurationConstraintStruct
47 //{
48 //
49 //}configurationConstraint;
50 
52 {
53 public:
54  ConfGenerator();
55  ConfGenerator(Robot* rob,Robot* human);
56 
60  void setHuman(Robot* human);
61  void setRobot(Robot* rob);
62 
63  std::vector<Eigen::Vector3d> getOTPList(){return m_OTPList;}
64 
68  bool computeRobotIkForGrabing( configPt& q );
69 
75  bool computeRobotIkForGrabing( configPt& q, const Eigen::Vector3d& point );
76 
81  bool computeHandoverConfigFromList( std::pair<confPtr_t,confPtr_t>& best_handover_conf, double& best_cost );
82 
86  bool initialize( std::string filename, HRICS::Natural* reachableSpace );
87 
91  bool sortConfig(std::vector<HRICS::ConfigHR>& configList, int nbNode, bool isStanding, bool isSlice, HRICS::Natural* reachableSpace);
92 
96  void addToList(Eigen::Vector3d WSPoint);
97 
101  Eigen::Vector3d setCurOTP( Eigen::Vector3d WSPoint);
102 
106  std::vector<HRICS::ConfigHR> getConfList();
107 
111  void drawOTPList(bool value);
112 
116  bool placeRobot();
117 
121  std::vector<HRICS::ConfigHR> addConfToList();
122 
126  void removeLastConf();
127 
131  void clearConfList();
132 
136  void saveToXml(std::string filename);
137 
141  std::vector<HRICS::ConfigHR> loadFromXml(std::string filename);
142 
146  double getConfigCost(HRICS::Natural* reachableSpace);
147 
148  //########################################
149  //new version :
150  //########################################
151 
152  bool generateConfiguration(int nbConfs);
153  bool addConstraintToList(constrainedLink CL);
154 
155 
156 private:
157 
163  std::pair<confPtr_t,confPtr_t> setRobotsToConf(const HRICS::ConfigHR& handover_conf);
164 
168  std::vector<Eigen::Vector3d> m_OTPList;
169 
173  std::vector<HRICS::ConfigHR> m_configList;
174 
175  Robot* _robot;
176  Robot* _human;
177 
178  double _maxDist;
179 
180  //########################################
181  //new version :
182  //########################################
183  std::vector<constrainedLink> linkList;
184  std::map<std::string,constrainedLink> linkListFiltred;
185 };
186 
187 #endif // CONFGENERATOR_H
bool initialize(std::string filename, HRICS::Natural *reachableSpace)
Initializes the list config generator.
Definition: ConfGenerator.cpp:43
bool computeRobotIkForGrabing(configPt &q)
Compute a configuration for hand-over.
Definition: ConfGenerator.cpp:54
bool sortConfig(std::vector< HRICS::ConfigHR > &configList, int nbNode, bool isStanding, bool isSlice, HRICS::Natural *reachableSpace)
load and return configs stored in filename
Definition: ConfGenerator.cpp:229
std::vector< HRICS::ConfigHR > addConfToList()
Adding the actual configuration to m_configList.
Definition: ConfGenerator.cpp:393
void saveToXml(std::string filename)
save what's in m_configList to the filename file.
Definition: ConfGenerator.cpp:441
std::vector< HRICS::ConfigHR > loadFromXml(std::string filename)
load and return configs stored in filename
Definition: ConfGenerator.cpp:481
Natural Motion and Arm Confort.
Definition: HRICS_Natural.hpp:33
bool computeHandoverConfigFromList(std::pair< confPtr_t, confPtr_t > &best_handover_conf, double &best_cost)
Compute a handover configuration by iterating through the set of configurations that has been pre-loa...
Definition: ConfGenerator.cpp:165
This class holds a the robot represented by a kinematic chain.
Definition: robot.hpp:42
void drawOTPList(bool value)
draw the OTP list
Definition: ConfGenerator.cpp:156
std::vector< HRICS::ConfigHR > getConfList()
return m_configList
Definition: ConfGenerator.cpp:136
void removeLastConf()
removing the last configuration of m_configList
Definition: ConfGenerator.cpp:429
void clearConfList()
Clear m_configList;.
Definition: ConfGenerator.cpp:435
bool placeRobot()
Compute GIK and place robot base.
Definition: ConfGenerator.cpp:330
void setHuman(Robot *human)
Setters.
Definition: ConfGenerator.cpp:33
Definition: OtpUtils.hpp:55
Eigen::Vector3d setCurOTP(Eigen::Vector3d WSPoint)
Change the current OTP.
Definition: ConfGenerator.cpp:141
void addToList(Eigen::Vector3d WSPoint)
Adding a 3D point to the OTP list This function is used when loading a set of OTPs in order to test t...
Definition: ConfGenerator.cpp:126
Definition: ConfGenerator.h:51
double getConfigCost(HRICS::Natural *reachableSpace)
compute the configuration cost
Definition: ConfGenerator.cpp:284