hpp-corbaserver  4.10.1
Corba server for Humanoid Path Planner applications
path_planners.hh
Go to the documentation of this file.
1 #ifndef hpp_core_idl__path__planners_hxx__
2 #define hpp_core_idl__path__planners_hxx__
3 
4 //
5 // Implemention of IDL interfaces in file /local/robotpkg/var/tmp/robotpkg/path/py-hpp-corbaserver/work/hpp-corbaserver-4.10.1/idl/hpp/core_idl/path_planners.idl
6 //
7 
9 
10 #include <sstream>
11 
12 #include <hpp/corbaserver/fwd.hh>
15 
16 
17 
18 //
19 // Implementational code for IDL interface hpp::core_idl::Roadmap
20 //
21 namespace hpp {
22 
23 namespace core_impl {
24 template <typename _Base, typename _Storage>
26  : hpp::corbaServer::ServantBase<hpp::core::Roadmap, _Storage> (server, s)
27 {
28  // add extra constructor code here
29 }
30 template <typename _Base, typename _Storage>
32 {
33  // add extra destructor code here
34 }
35 
36 // Methods corresponding to IDL attributes and operations
37 
38 template <typename _Base, typename _Storage>
40 {
41  try {
42  // automatically generated code.
43 
44  (getT()->clear ());
45 
46 
47  } catch (const std::exception& e) {
48  throw ::hpp::Error (e.what());
49  }
50 }
51 
52 template <typename _Base, typename _Storage>
54 {
55  try {
56  // automatically generated code.
58  (getT()->addNode (_config));
59 
60 
61  } catch (const std::exception& e) {
62  throw ::hpp::Error (e.what());
63  }
64 }
65 
66 template <typename _Base, typename _Storage>
68 {
69  try {
70  // generated from /local/robotpkg/var/tmp/robotpkg/path/py-hpp-corbaserver/work/hpp-corbaserver-4.10.1/idl/hpp/core_idl/path_planners.idl:22
71  core::PathPtr_t path (corbaServer::reference_to_servant_base<core::Path>(server_, path_)->get());
72  getT()->addEdge(getT()->addNode(corbaServer::floatSeqToVector(cfgfrom)),
73  getT()->addNode(corbaServer::floatSeqToVector(cfgto )), path);
74 
75  } catch (const std::exception& e) {
76  throw ::hpp::Error (e.what());
77  }
78 }
79 
80 template <typename _Base, typename _Storage>
82 {
83  try {
84  // generated from /local/robotpkg/var/tmp/robotpkg/path/py-hpp-corbaserver/work/hpp-corbaserver-4.10.1/idl/hpp/core_idl/path_planners.idl:22
85  core::PathPtr_t path (corbaServer::reference_to_servant_base<core::Path>(server_, path_)->get());
86  getT()->addEdges(getT()->addNode(corbaServer::floatSeqToVector(cfgfrom)),
87  getT()->addNode(corbaServer::floatSeqToVector(cfgto )), path);
88 
89  } catch (const std::exception& e) {
90  throw ::hpp::Error (e.what());
91  }
92 }
93 
94 template <typename _Base, typename _Storage>
95 hpp::floatSeq* RoadmapServant<_Base, _Storage>::nearestNode (const hpp::floatSeq& config, hpp::value_type& distance, ::CORBA::Boolean reverse)
96 {
97  try {
98  // generated from /local/robotpkg/var/tmp/robotpkg/path/py-hpp-corbaserver/work/hpp-corbaserver-4.10.1/idl/hpp/core_idl/path_planners.idl:22
100  corbaServer::floatSeqToVector(config), distance, reverse)->configuration()));
101 
102  } catch (const std::exception& e) {
103  throw ::hpp::Error (e.what());
104  }
105 }
106 
107 template <typename _Base, typename _Storage>
109 {
110  try {
111  // generated from /local/robotpkg/var/tmp/robotpkg/path/py-hpp-corbaserver/work/hpp-corbaserver-4.10.1/idl/hpp/core_idl/path_planners.idl:22
112  hpp::core::Nodes_t nodes = getT()->nearestNodes(
113  corbaServer::floatSeqToVector(config), k);
114  hpp::core::matrix_t configs (nodes.size(), config.length());
115  size_type i = 0;
116  for (hpp::core::Nodes_t::const_iterator _node = nodes.begin(); _node != nodes.end(); ++_node)
117  configs.row(i++) = *((*_node)->configuration());
118  return corbaServer::matrixToFloatSeqSeq(configs);
119 
120  } catch (const std::exception& e) {
121  throw ::hpp::Error (e.what());
122  }
123 }
124 
125 template <typename _Base, typename _Storage>
127 {
128  try {
129  // generated from /local/robotpkg/var/tmp/robotpkg/path/py-hpp-corbaserver/work/hpp-corbaserver-4.10.1/idl/hpp/core_idl/path_planners.idl:22
130  return getT()->nodes().size();
131 
132  } catch (const std::exception& e) {
133  throw ::hpp::Error (e.what());
134  }
135 }
136 
137 template <typename _Base, typename _Storage>
139 {
140  try {
141  // generated from /local/robotpkg/var/tmp/robotpkg/path/py-hpp-corbaserver/work/hpp-corbaserver-4.10.1/idl/hpp/core_idl/path_planners.idl:22
142  return corbaServer::vectorToFloatSeq(*((*boost::next(getT()->nodes().begin(), i))->configuration()));
143 
144  } catch (const std::exception& e) {
145  throw ::hpp::Error (e.what());
146  }
147 }
148 
149 template <typename _Base, typename _Storage>
151 {
152  try {
153  // generated from /local/robotpkg/var/tmp/robotpkg/path/py-hpp-corbaserver/work/hpp-corbaserver-4.10.1/idl/hpp/core_idl/path_planners.idl:22
154  return getT()->edges().size();
155 
156  } catch (const std::exception& e) {
157  throw ::hpp::Error (e.what());
158  }
159 }
160 
161 template <typename _Base, typename _Storage>
163 {
164  try {
165  // generated from /local/robotpkg/var/tmp/robotpkg/path/py-hpp-corbaserver/work/hpp-corbaserver-4.10.1/idl/hpp/core_idl/path_planners.idl:22
166  return corbaServer::makeServant<hpp::core_idl::Path_ptr> (server_,
167  new Path (server_, (*boost::next(getT()->edges().begin(),i))->path()));
168 
169  } catch (const std::exception& e) {
170  throw ::hpp::Error (e.what());
171  }
172 }
173 
174 // End of implementational code
175 } // namespace core_impl
176 
177 } // namespace hpp
178 
179 //
180 // Implementational code for IDL interface hpp::core_idl::PathPlanner
181 //
182 namespace hpp {
183 
184 namespace core_impl {
185 template <typename _Base, typename _Storage>
187  : hpp::corbaServer::ServantBase<hpp::core::PathPlanner, _Storage> (server, s)
188 {
189  // add extra constructor code here
190 }
191 template <typename _Base, typename _Storage>
193 {
194  // add extra destructor code here
195 }
196 
197 // Methods corresponding to IDL attributes and operations
198 
199 template <typename _Base, typename _Storage>
201 {
202  try {
203  // automatically generated code.
204 
205  hpp::core::PathVectorPtr_t __return__ (getT()->solve ());
206 
207  return ::hpp::corbaServer::makeServantDownCast<hpp::core_impl::Path,hpp::core_impl::PathVector>(server_, __return__)._retn();
208  } catch (const std::exception& e) {
209  throw ::hpp::Error (e.what());
210  }
211 }
212 
213 template <typename _Base, typename _Storage>
215 {
216  try {
217  // automatically generated code.
218 
219  (getT()->startSolve ());
220 
221 
222  } catch (const std::exception& e) {
223  throw ::hpp::Error (e.what());
224  }
225 }
226 
227 template <typename _Base, typename _Storage>
229 {
230  try {
231  // automatically generated code.
232 
233  (getT()->tryConnectInitAndGoals ());
234 
235 
236  } catch (const std::exception& e) {
237  throw ::hpp::Error (e.what());
238  }
239 }
240 
241 template <typename _Base, typename _Storage>
243 {
244  try {
245  // automatically generated code.
246 
247  (getT()->oneStep ());
248 
249 
250  } catch (const std::exception& e) {
251  throw ::hpp::Error (e.what());
252  }
253 }
254 
255 template <typename _Base, typename _Storage>
257 {
258  try {
259  // automatically generated code.
260 
261  hpp::core::PathVectorPtr_t __return__ (getT()->computePath ());
262 
263  return ::hpp::corbaServer::makeServantDownCast<hpp::core_impl::Path,hpp::core_impl::PathVector>(server_, __return__)._retn();
264  } catch (const std::exception& e) {
265  throw ::hpp::Error (e.what());
266  }
267 }
268 
269 template <typename _Base, typename _Storage>
271 {
272  try {
273  // automatically generated code.
274  hpp::core::PathVectorPtr_t _path = ::hpp::corbaServer::reference_to_servant_base<hpp::core::PathVector>(server_, path)->get();
275  hpp::core::PathVectorPtr_t __return__ (getT()->finishSolve (_path));
276 
277  return ::hpp::corbaServer::makeServantDownCast<hpp::core_impl::Path,hpp::core_impl::PathVector>(server_, __return__)._retn();
278  } catch (const std::exception& e) {
279  throw ::hpp::Error (e.what());
280  }
281 }
282 
283 template <typename _Base, typename _Storage>
285 {
286  try {
287  // automatically generated code.
288 
289  (getT()->interrupt ());
290 
291 
292  } catch (const std::exception& e) {
293  throw ::hpp::Error (e.what());
294  }
295 }
296 
297 template <typename _Base, typename _Storage>
299 {
300  try {
301  // automatically generated code.
302 
303  (getT()->maxIterations (n));
304 
305 
306  } catch (const std::exception& e) {
307  throw ::hpp::Error (e.what());
308  }
309 }
310 
311 template <typename _Base, typename _Storage>
313 {
314  try {
315  // automatically generated code.
316 
317  (getT()->timeOut (seconds));
318 
319 
320  } catch (const std::exception& e) {
321  throw ::hpp::Error (e.what());
322  }
323 }
324 
325 template <typename _Base, typename _Storage>
327 {
328  try {
329  // automatically generated code.
330 
331  hpp::core::RoadmapPtr_t __return__ (getT()->roadmap ());
332 
333  return ::hpp::corbaServer::makeServantDownCast<hpp::core_impl::Roadmap,hpp::core_impl::Roadmap>(server_, __return__)._retn();
334  } catch (const std::exception& e) {
335  throw ::hpp::Error (e.what());
336  }
337 }
338 
339 // End of implementational code
340 } // namespace core_impl
341 
342 } // namespace hpp
343 
344 
345 
346 
347 
348 #endif // hpp_core_idl__path__planners_hxx__
349 
void timeOut(hpp::value_type seconds)
Definition: path_planners.hh:312
void clear()
Definition: path_planners.hh:39
Definition: path_planners-fwd.hh:29
hpp::core_idl::Roadmap_ptr getRoadmap()
Definition: path_planners.hh:326
hpp::core_idl::Path_ptr getEdge(hpp::size_type i)
Definition: path_planners.hh:162
Implement CORBA interface ``Obstacle&#39;&#39;.
Definition: basic-server.hh:27
RoadmapServant(::hpp::corbaServer::Server *server, const _Storage &s)
Definition: path_planners.hh:25
double value_type
Definition: common.idl:18
sequence< floatSeq > floatSeqSeq
Definition: common.idl:33
hpp::floatSeqSeq * nearestNodes(const hpp::floatSeq &config, hpp::size_type &k)
Definition: path_planners.hh:108
_objref_Roadmap * Roadmap_ptr
Definition: path_planners-idl.hh:109
virtual ~PathPlannerServant()
Definition: path_planners.hh:192
vector_t floatSeqToVector(const floatSeq &dofArray, const size_type expectedSize=-1)
Server * server_
Definition: servant-base.hh:97
hpp::floatSeq * getNode(hpp::size_type i)
Definition: path_planners.hh:138
hpp::core_idl::PathVector_ptr computePath()
Definition: path_planners.hh:256
PathServant< POA_hpp::core_idl::Path, boost::weak_ptr< hpp::core::Path > > Path
Definition: paths-fwd.hh:84
void addNode(const hpp::floatSeq &config)
Definition: path_planners.hh:53
virtual ~RoadmapServant()
Definition: path_planners.hh:31
pinocchio::vector_t vector_t
Definition: fwd.hh:89
hpp::size_type getNbEdges()
Definition: path_planners.hh:150
void oneStep()
Definition: path_planners.hh:242
hpp::size_type getNbNodes()
Definition: path_planners.hh:126
ServantBase(Server *server, const Storage &_s)
Definition: servant-base.hh:165
void startSolve()
Definition: path_planners.hh:214
void interrupt()
Definition: path_planners.hh:284
hpp::floatSeq * nearestNode(const hpp::floatSeq &config, hpp::value_type &distance, ::CORBA::Boolean reverse)
Definition: path_planners.hh:95
_objref_PathVector * PathVector_ptr
Definition: paths-idl.hh:82
void maxIterations(hpp::size_type n)
Definition: path_planners.hh:298
core::PathVectorPtr_t PathVectorPtr_t
Definition: fwd.hh:77
Implementation of Hpp module Corba server.
Definition: server.hh:54
pinocchio::matrix_t matrix_t
Definition: fwd.hh:87
void addNodeAndEdge(const hpp::floatSeq &cfgfrom, const hpp::floatSeq &cfgto, hpp::core_idl::Path_ptr path_)
Definition: path_planners.hh:67
Definition: path_planners-fwd.hh:88
floatSeqSeq * matrixToFloatSeqSeq(core::matrixIn_t input)
Returns a sequence of the rows of the input matrix.
hpp::core_idl::PathVector_ptr finishSolve(hpp::core_idl::PathVector_ptr path)
Definition: path_planners.hh:270
floatSeq * vectorToFloatSeq(core::vectorIn_t input)
StorageElementShPtr_t getT() const
Definition: servant-base.hh:121
_objref_Path * Path_ptr
Definition: path_planners-idl.hh:83
sequence< double > floatSeq
Robot configuration is defined by a sequence of dof value.
Definition: common.idl:32
hpp::core_idl::PathVector_ptr solve()
Definition: path_planners.hh:200
core::Nodes_t Nodes_t
Definition: fwd.hh:69
core::PathPtr_t PathPtr_t
Definition: fwd.hh:74
void addNodeAndEdges(const hpp::floatSeq &cfgfrom, const hpp::floatSeq &cfgto, hpp::core_idl::Path_ptr path_)
Definition: path_planners.hh:81
void tryConnectInitAndGoals()
Definition: path_planners.hh:228
PathPlannerServant(::hpp::corbaServer::Server *server, const _Storage &s)
Definition: path_planners.hh:186
long long size_type
Definition: common.idl:19