hpp-corbaserver  4.9.0
Corba server for Humanoid Path Planner applications
problem.impl.hh
Go to the documentation of this file.
1 // Copyright (C) 2009, 2010 by Florent Lamiraux, Thomas Moulard, JRL.
2 //
3 // This file is part of the hpp-corbaserver.
4 //
5 // This software is provided "as is" without warranty of any kind,
6 // either expressed or implied, including but not limited to the
7 // implied warranties of fitness for a particular purpose.
8 //
9 // See the COPYING file for more information.
10 
11 #ifndef HPP_CORBASERVER_PROBLEM_IMPL_HH
12 # define HPP_CORBASERVER_PROBLEM_IMPL_HH
13 # include <vector>
14 # include <stdlib.h>
15 
16 # include "hpp/corbaserver/fwd.hh"
17 # include "hpp/corbaserver/problem-idl.hh"
19 
20 # include "hpp/core_idl/distances-idl.hh"
21 # include "hpp/core_idl/_problem-idl.hh"
22 
23 # include "hpp/corbaserver/deprecated.hh"
24 
25 namespace hpp
26 {
27  namespace corbaServer
28  {
29  namespace impl
30  {
31  using CORBA::Any;
32  using CORBA::Boolean;
33  using CORBA::Long;
34  using CORBA::ULong;
35  using CORBA::UShort;
36 
38  class Problem : public virtual POA_hpp::corbaserver::Problem
39  {
40  public:
41  Problem ();
42 
43  void setServer (ServerPlugin* server)
44  {
45  server_ = server;
46  }
47 
48  virtual Names_t* getAvailable (const char* what);
49 
50  virtual Names_t* getSelected (const char* what);
51 
52  virtual void setParameter (const char* name, const Any& value);
53 
54  virtual Any* getParameter (const char* name);
55 
56  virtual char* getParameterDoc (const char* name);
57 
58  virtual bool selectProblem (const char* problemName);
59 
60  virtual void resetProblem ();
61 
62  virtual bool loadPlugin (const char* pluginName);
63 
64  virtual void movePathToProblem (ULong pathId, const char* problemName,
65  const Names_t& jointNames);
66 
67  virtual void setMaxNumThreads (UShort n);
68 
69  virtual UShort getMaxNumThreads ();
70 
71  virtual void
72  setRandomSeed (const Long seed) {
73  srand ((int) seed);
74  }
75 
76  virtual void
77  setInitialConfig (const hpp::floatSeq& dofArray);
78 
79  virtual hpp::floatSeq*
81 
82  virtual void
83  addGoalConfig (const hpp::floatSeq& dofArray);
84 
85  virtual hpp::floatSeqSeq* getGoalConfigs ();
86 
87  virtual void
88  resetGoalConfigs () ;
89 
90  virtual void createOrientationConstraint
91  (const char* constraintName, const char* joint1Name,
92  const char* joint2Name, const Double* p, const hpp::boolSeq& mask);
93 
95  (const char* constraintName, const char* joint1Name,
96  const char* joint2Name, const Transform_ p, const hpp::boolSeq& mask);
97 
99  (const char* constraintName, const char* joint1Name,
100  const char* joint2Name, const Transform_ frame1,
101  const Transform_ frame2, const hpp::boolSeq& mask);
102 
104  (const char* constraintName, const char* joint1Name,
105  const char* joint2Name, const Transform_ frame1,
106  const Transform_ frame2, const hpp::boolSeq& mask);
107 
108  virtual void createLockedJoint (const char* lockedJointName,
109  const char* jointName,
110  const hpp::floatSeq& value);
111 
112  virtual void createLockedExtraDof (const char* lockedDofName,
113  ULong index,
114  const hpp::floatSeq& value);
115 
116  virtual void createManipulability (const char* name, const char* function);
117 
118  void createRelativeComConstraint (const char* constraintName,
119  const char* comn, const char* jointName, const floatSeq& point,
120  const hpp::boolSeq& mask);
121 
122  void createComBeetweenFeet (const char* constraintName, const char* comn,
123  const char* jointLName, const char* jointRName,
124  const floatSeq& pointL, const floatSeq& pointR,
125  const char* jointRefName, const floatSeq& pRef,
126  const hpp::boolSeq& mask);
127 
129  (const char* constraintName, const Names_t& floorJoints,
130  const Names_t& objectJoints,
131  const hpp::floatSeqSeq& points, const hpp::intSeqSeq& objTriangles,
132  const hpp::intSeqSeq& floorTriangles);
133 
135  const char* constraintName, const hpp::Names_t& jointNames,
136  const hpp::floatSeqSeq& points, const hpp::floatSeqSeq& normals,
137  const char* comRootJointName);
138 
139  virtual void createPositionConstraint (const char* constraintName,
140  const char* joint1Name,
141  const char* joint2Name,
142  const hpp::floatSeq& point1,
143  const hpp::floatSeq& point2,
144  const hpp::boolSeq& mask);
145 
146  virtual void createConfigurationConstraint (const char* constraintName,
147  const hpp::floatSeq& goal,
148  const hpp::floatSeq& weights);
149 
151  (const char* constraintName, const char* joint1Name,
152  const char* joint2Name, Double distance);
153 
155  (const char* constraintName, const char* joint1Name,
156  const hpp::Names_t& objects, Double distance);
157 
158  virtual void createIdentityConstraint
159  (const char* constraintName, const Names_t& inJoints,
160  const hpp::Names_t& outJoints);
161 
162  virtual bool applyConstraints (const hpp::floatSeq& input,
163  hpp::floatSeq_out output,
164  Double& residualError);
165 
166  virtual bool optimize (const hpp::floatSeq& input,
167  hpp::floatSeq_out output,
168  hpp::floatSeq_out residualError);
169 
170  virtual void computeValueAndJacobian
171  (const hpp::floatSeq& config, hpp::floatSeq_out value,
172  hpp::floatSeqSeq_out jacobian);
173 
174  virtual bool generateValidConfig (ULong maxIter,
175  hpp::floatSeq_out output,
176  Double& residualError);
177 
178  virtual void addPassiveDofs (const char* constraintName,
179  const hpp::Names_t& dofName);
180 
181  virtual void getConstraintDimensions (const char* constraintName,
182  ULong& inputSize , ULong& inputDerivativeSize,
183  ULong& outputSize, ULong& outputDerivativeSize);
184 
185  virtual void setConstantRightHandSide (const char* constraintName,
186  CORBA::Boolean constant);
187 
188  virtual bool getConstantRightHandSide (const char* constraintName);
189 
190  virtual floatSeq* getRightHandSide ();
191 
192  virtual void setRightHandSide (const hpp::floatSeq& rhs);
193 
194  virtual void setRightHandSideFromConfig (const hpp::floatSeq& config);
195 
196  virtual void setRightHandSideByName (const char* constraintName,
197  const hpp::floatSeq& rhs);
198 
199  virtual void setRightHandSideFromConfigByName (const char* constraintName,
200  const hpp::floatSeq& config);
201 
202  virtual void resetConstraints ();
203  virtual void resetConstraintMap ();
204  virtual void addNumericalConstraints
205  (const char* constraintName, const hpp::Names_t& constraintNames,
206  const hpp::intSeq& priorities);
208  (const bool optional);
209 
210  virtual void addLockedJointConstraints
211  (const char* configProjName,const hpp::Names_t& lockedJointNames);
212 
213  virtual char* displayConstraints ();
214 
215  virtual void filterCollisionPairs ();
216  virtual Double getErrorThreshold ();
217  virtual void setErrorThreshold (Double threshold);
218  virtual void setDefaultLineSearchType (const char* type);
219  virtual ULong getMaxIterProjection ();
220  virtual void setMaxIterProjection (ULong iterations);
221  virtual ULong getMaxIterPathPlanning ();
222  virtual void setMaxIterPathPlanning (ULong iterations);
223  virtual void setTimeOutPathPlanning (double timeOut);
224  virtual double getTimeOutPathPlanning ();
225 
226 
227  virtual void addPathOptimizer (const char* pathOptimizerType);
228 
229  virtual void clearPathOptimizers ();
230 
231  virtual void addConfigValidation (const char* configValidationType);
232 
233  virtual void clearConfigValidations ();
234 
235  virtual void selectPathValidation (const char* pathValidationType,
236  Double tolerance);
237 
238  virtual void selectPathProjector (const char* pathProjectorType,
239  Double tolerance);
240 
241  virtual void selectPathPlanner (const char* pathPlannerType);
242 
243  virtual void selectDistance (const char* distanceType);
244 
245  virtual void selectSteeringMethod (const char* steeringMethodType);
246 
247  virtual void selectConfigurationShooter (const char* configurationShooterType);
248 
249  virtual bool prepareSolveStepByStep ();
250  virtual bool executeOneStep ();
251  virtual void finishSolveStepByStep ();
252 
253  virtual hpp::intSeq* solve ();
254 
255  virtual bool directPath (const hpp::floatSeq& startConfig,
256  const hpp::floatSeq& endConfig,
257  CORBA::Boolean validate,
258  ULong& pathId,
259  CORBA::String_out report);
260 
261  virtual bool reversePath(ULong pathId, ULong& reversedPathId);
262 
263  virtual void addConfigToRoadmap (const hpp::floatSeq& config);
264 
265  virtual void addEdgeToRoadmap (const hpp::floatSeq& config1,
266  const hpp::floatSeq& config2,
267  ULong pathId, bool bothEdges);
268 
269  virtual void appendDirectPath (ULong pathId,
270  const hpp::floatSeq& config,
271  Boolean validate);
272 
273  virtual void concatenatePath (ULong startId, ULong endId);
274 
275  virtual void extractPath (ULong pathId, Double start, Double end);
276 
277  virtual void erasePath (ULong pathId);
278 
279  virtual bool projectPath (ULong pathId);
280 
281  virtual void interruptPathPlanning ();
282 
283  virtual Long numberPaths ();
284 
285  virtual hpp::intSeq* optimizePath (ULong pathId);
286 
287  virtual Double pathLength (ULong pathId);
288 
289  virtual hpp::floatSeq* configAtParam (ULong pathId,
290  Double atDistance);
291 
292  virtual hpp::floatSeq* derivativeAtParam (ULong pathId,
293  ULong order,
294  Double atDistance);
295 
296  virtual hpp::floatSeqSeq* getWaypoints (ULong inPathId, floatSeq_out times);
297  virtual hpp::floatSeqSeq* nodes ();
298  virtual Long numberEdges ();
299  virtual void edge (ULong edgeId, hpp::floatSeq_out q1,
300  hpp::floatSeq_out q2);
301  virtual Long connectedComponentOfEdge (ULong edgeId);
302  virtual hpp::floatSeq* node (ULong nodeId);
303  virtual Long connectedComponentOfNode (ULong nodeId);
304  virtual Long numberNodes ();
305  virtual Long numberConnectedComponents ();
306  virtual hpp::floatSeqSeq*
307  nodesConnectedComponent (ULong connectedComponentId);
308 
309  virtual hpp::floatSeq*
310  getNearestConfig (const hpp::floatSeq& config, const Long connectedComponentId,
311  hpp::core::value_type& distance);
312 
313  virtual void clearRoadmap ();
314  virtual void resetRoadmap ();
315  virtual void saveRoadmap (const char* filename);
316  virtual void readRoadmap (const char* filename);
317 
318  virtual void scCreateScalarMultiply (const char* outName, Double scalar, const char* inName);
319 
320  hpp::core_idl::Distance_ptr getDistance ();
321 
322  void setDistance (hpp::core_idl::Distance_ptr distance);
323 
324  hpp::core_idl::Path_ptr getPath (ULong pathId);
325 
326  ULong addPath (hpp::core_idl::PathVector_ptr _path);
327 
328  hpp::core_idl::SteeringMethod_ptr getSteeringMethod ();
329 
330  hpp::core_idl::PathValidation_ptr getPathValidation ();
331 
332  hpp::core_idl::PathPlanner_ptr getPathPlanner ();
333 
334  hpp::core_idl::Problem_ptr getProblem ();
335 
336  hpp::constraints_idl::Implicit_ptr getConstraint (const char* name);
337 
338  void setRobot (hpp::pinocchio_idl::Device_ptr robot);
339 
340  private:
342  core::ProblemSolverPtr_t problemSolver ();
344  ServerPlugin* server_;
345  };
346  } // end of namespace impl.
347  } // end of namespace corbaServer.
348 } // end of namespace hpp.
349 
350 #endif
virtual void setRightHandSideFromConfigByName(const char *constraintName, const hpp::floatSeq &config)
virtual hpp::intSeq * solve()
virtual void edge(ULong edgeId, hpp::floatSeq_out q1, hpp::floatSeq_out q2)
Definition: server-plugin.hh:44
boost::posix_time::ptime point
virtual void addLockedJointConstraints(const char *configProjName, const hpp::Names_t &lockedJointNames)
virtual void addPathOptimizer(const char *pathOptimizerType)
virtual void extractPath(ULong pathId, Double start, Double end)
hpp::core_idl::Problem_ptr getProblem()
virtual hpp::floatSeq * node(ULong nodeId)
virtual ULong getMaxIterProjection()
virtual void setMaxNumThreads(UShort n)
virtual void scCreateScalarMultiply(const char *outName, Double scalar, const char *inName)
Vec3f n
virtual hpp::floatSeq * derivativeAtParam(ULong pathId, ULong order, Double atDistance)
virtual bool prepareSolveStepByStep()
hpp::core_idl::PathPlanner_ptr getPathPlanner()
virtual void addGoalConfig(const hpp::floatSeq &dofArray)
virtual void createPositionConstraint(const char *constraintName, const char *joint1Name, const char *joint2Name, const hpp::floatSeq &point1, const hpp::floatSeq &point2, const hpp::boolSeq &mask)
virtual void setRandomSeed(const Long seed)
Definition: problem.impl.hh:72
Implement CORBA interface ``Obstacle&#39;&#39;.
virtual ULong getMaxIterPathPlanning()
virtual void setParameter(const char *name, const Any &value)
virtual void setDefaultLineSearchType(const char *type)
virtual Long connectedComponentOfEdge(ULong edgeId)
virtual bool reversePath(ULong pathId, ULong &reversedPathId)
virtual hpp::floatSeq * getNearestConfig(const hpp::floatSeq &config, const Long connectedComponentId, hpp::core::value_type &distance)
virtual hpp::intSeq * optimizePath(ULong pathId)
Implement CORBA interface ``Problem&#39;&#39;.
Definition: problem.impl.hh:38
virtual void selectConfigurationShooter(const char *configurationShooterType)
void setServer(ServerPlugin *server)
Definition: problem.impl.hh:43
virtual void setNumericalConstraintsLastPriorityOptional(const bool optional)
virtual bool selectProblem(const char *problemName)
ULong addPath(hpp::core_idl::PathVector_ptr _path)
sequence< floatSeq > floatSeqSeq
Definition: common.idl:33
virtual void createOrientationConstraint(const char *constraintName, const char *joint1Name, const char *joint2Name, const Double *p, const hpp::boolSeq &mask)
virtual bool optimize(const hpp::floatSeq &input, hpp::floatSeq_out output, hpp::floatSeq_out residualError)
virtual void addEdgeToRoadmap(const hpp::floatSeq &config1, const hpp::floatSeq &config2, ULong pathId, bool bothEdges)
virtual hpp::floatSeq * getInitialConfig()
virtual Long connectedComponentOfNode(ULong nodeId)
virtual bool applyConstraints(const hpp::floatSeq &input, hpp::floatSeq_out output, Double &residualError)
virtual void createConfigurationConstraint(const char *constraintName, const hpp::floatSeq &goal, const hpp::floatSeq &weights)
virtual hpp::floatSeqSeq * nodes()
virtual bool generateValidConfig(ULong maxIter, hpp::floatSeq_out output, Double &residualError)
virtual void appendDirectPath(ULong pathId, const hpp::floatSeq &config, Boolean validate)
void createStaticStabilityConstraint(const char *constraintName, const hpp::Names_t &jointNames, const hpp::floatSeqSeq &points, const hpp::floatSeqSeq &normals, const char *comRootJointName)
virtual void setRightHandSide(const hpp::floatSeq &rhs)
virtual Long numberConnectedComponents()
sequence< string > Names_t
Sequence of names.
Definition: common.idl:22
virtual Names_t * getAvailable(const char *what)
sequence< long > intSeq
Definition: common.idl:29
virtual hpp::floatSeqSeq * nodesConnectedComponent(ULong connectedComponentId)
virtual UShort getMaxNumThreads()
virtual bool getConstantRightHandSide(const char *constraintName)
virtual void createDistanceBetweenJointAndObjects(const char *constraintName, const char *joint1Name, const hpp::Names_t &objects, Double distance)
virtual Any * getParameter(const char *name)
virtual void createLockedJoint(const char *lockedJointName, const char *jointName, const hpp::floatSeq &value)
virtual Names_t * getSelected(const char *what)
virtual bool directPath(const hpp::floatSeq &startConfig, const hpp::floatSeq &endConfig, CORBA::Boolean validate, ULong &pathId, CORBA::String_out report)
virtual void setErrorThreshold(Double threshold)
virtual void setConstantRightHandSide(const char *constraintName, CORBA::Boolean constant)
virtual void createIdentityConstraint(const char *constraintName, const Names_t &inJoints, const hpp::Names_t &outJoints)
virtual void createLockedExtraDof(const char *lockedDofName, ULong index, const hpp::floatSeq &value)
virtual void selectDistance(const char *distanceType)
virtual void addNumericalConstraints(const char *constraintName, const hpp::Names_t &constraintNames, const hpp::intSeq &priorities)
sequence< boolean > boolSeq
Definition: common.idl:28
virtual void setTimeOutPathPlanning(double timeOut)
virtual void interruptPathPlanning()
virtual bool projectPath(ULong pathId)
void setDistance(hpp::core_idl::Distance_ptr distance)
virtual void getConstraintDimensions(const char *constraintName, ULong &inputSize, ULong &inputDerivativeSize, ULong &outputSize, ULong &outputDerivativeSize)
virtual double getTimeOutPathPlanning()
virtual char * displayConstraints()
virtual void readRoadmap(const char *filename)
virtual void saveRoadmap(const char *filename)
ProblemServant< POA_hpp::core_idl::Problem, core::ProblemPtr_t > Problem
Definition: problem.hh:116
virtual void selectSteeringMethod(const char *steeringMethodType)
pinocchio::value_type value_type
virtual hpp::floatSeqSeq * getGoalConfigs()
virtual void setRightHandSideFromConfig(const hpp::floatSeq &config)
virtual void selectPathProjector(const char *pathProjectorType, Double tolerance)
virtual void concatenatePath(ULong startId, ULong endId)
void setRobot(hpp::pinocchio_idl::Device_ptr robot)
virtual void addPassiveDofs(const char *constraintName, const hpp::Names_t &dofName)
virtual void movePathToProblem(ULong pathId, const char *problemName, const Names_t &jointNames)
double Transform_[7]
Element of SE(3) represented by a vector and a unit quaternion.
Definition: common.idl:36
virtual hpp::floatSeqSeq * getWaypoints(ULong inPathId, floatSeq_out times)
virtual void createManipulability(const char *name, const char *function)
virtual void addConfigValidation(const char *configValidationType)
virtual void setInitialConfig(const hpp::floatSeq &dofArray)
hpp::core_idl::Path_ptr getPath(ULong pathId)
void createRelativeComConstraint(const char *constraintName, const char *comn, const char *jointName, const floatSeq &point, const hpp::boolSeq &mask)
virtual void setRightHandSideByName(const char *constraintName, const hpp::floatSeq &rhs)
virtual Double getErrorThreshold()
hpp::core_idl::SteeringMethod_ptr getSteeringMethod()
virtual void setMaxIterProjection(ULong iterations)
virtual void selectPathValidation(const char *pathValidationType, Double tolerance)
virtual Double pathLength(ULong pathId)
virtual void createDistanceBetweenJointConstraint(const char *constraintName, const char *joint1Name, const char *joint2Name, Double distance)
virtual void erasePath(ULong pathId)
virtual void computeValueAndJacobian(const hpp::floatSeq &config, hpp::floatSeq_out value, hpp::floatSeqSeq_out jacobian)
virtual void finishSolveStepByStep()
hpp::constraints_idl::Implicit_ptr getConstraint(const char *name)
virtual void createTransformationConstraint2(const char *constraintName, const char *joint1Name, const char *joint2Name, const Transform_ frame1, const Transform_ frame2, const hpp::boolSeq &mask)
virtual void clearConfigValidations()
virtual char * getParameterDoc(const char *name)
virtual void createTransformationSE3Constraint(const char *constraintName, const char *joint1Name, const char *joint2Name, const Transform_ frame1, const Transform_ frame2, const hpp::boolSeq &mask)
virtual void addConfigToRoadmap(const hpp::floatSeq &config)
virtual floatSeq * getRightHandSide()
sequence< double > floatSeq
Robot configuration is defined by a sequence of dof value.
Definition: common.idl:32
virtual hpp::floatSeq * configAtParam(ULong pathId, Double atDistance)
void createComBeetweenFeet(const char *constraintName, const char *comn, const char *jointLName, const char *jointRName, const floatSeq &pointL, const floatSeq &pointR, const char *jointRefName, const floatSeq &pRef, const hpp::boolSeq &mask)
virtual bool loadPlugin(const char *pluginName)
virtual void setMaxIterPathPlanning(ULong iterations)
sequence< intSeq > intSeqSeq
Definition: common.idl:30
virtual void createConvexShapeContactConstraint(const char *constraintName, const Names_t &floorJoints, const Names_t &objectJoints, const hpp::floatSeqSeq &points, const hpp::intSeqSeq &objTriangles, const hpp::intSeqSeq &floorTriangles)
hpp::core_idl::PathValidation_ptr getPathValidation()
Vec3f * points
virtual void createTransformationConstraint(const char *constraintName, const char *joint1Name, const char *joint2Name, const Transform_ p, const hpp::boolSeq &mask)
virtual void selectPathPlanner(const char *pathPlannerType)
FCL_REAL distance(const KDOP< N > &other, Vec3f *P=NULL, Vec3f *Q=NULL) const
hpp::core_idl::Distance_ptr getDistance()