hpp-corbaserver  6.0.0
Corba server for Humanoid Path Planner applications
object-map.hh
Go to the documentation of this file.
1 // Copyright (c) 2018, Joseph Mirabel
2 // Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
3 //
4 
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // 1. Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 //
12 // 2. Redistributions in binary form must reproduce the above copyright
13 // notice, this list of conditions and the following disclaimer in the
14 // documentation and/or other materials provided with the distribution.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
27 // DAMAGE.
28 
29 #ifndef HPP_CORBASERVER_OBJECT_MAP_HH
30 #define HPP_CORBASERVER_OBJECT_MAP_HH
31 
32 #include <coal/BVH/BVH_model.h>
33 #include <coal/shape/geometric_shapes.h>
34 
35 #include <hpp/common-idl.hh>
36 #include <hpp/corbaserver/fwd.hh>
37 #include <pinocchio/fwd.hpp>
38 
39 namespace hpp {
40 namespace corbaServer {
41 class ObjectMap {
42  public:
43  void createBox(const std::string boxName, value_type x, value_type y,
44  value_type z);
45  void createSphere(const std::string name, value_type radius);
46  void createCylinder(const std::string name, value_type radius,
47  value_type length);
48 
49  void createPolyhedron(const std::string polyhedronName);
50  std::size_t addPoint(const std::string polyhedronName, value_type x,
51  value_type y, value_type z);
52  std::size_t addTriangle(const std::string polyhedronName, std::size_t pt1,
53  std::size_t pt2, std::size_t pt3);
54 
55  CollisionGeometryPtr_t geometry(const std::string name) /*const*/;
56 
57  protected:
58  struct PolyhedronData {
59  std::vector<coal::Vec3f> pts;
60  std::vector<coal::Triangle> tris;
61  };
62  typedef std::map<std::string, PolyhedronData> PolyhedronMap_t;
63  typedef std::map<std::string, CollisionGeometryPtr_t> ShapeMap_t;
64 
65  enum GeomType { Shape = 1, Polyhedron = 2, BothGeomType = 3 };
66 
68 
69  template <GeomType geomType, ThrowType throwType>
70  bool nameExists(const std::string& name) const;
71 
76 };
77 } // end of namespace corbaServer.
78 } // end of namespace hpp.
79 
80 #endif // HPP_CORBASERVER_OBJECT_MAP_HH
Definition: object-map.hh:41
std::map< std::string, PolyhedronData > PolyhedronMap_t
Definition: object-map.hh:62
CollisionGeometryPtr_t geometry(const std::string name)
std::map< std::string, CollisionGeometryPtr_t > ShapeMap_t
Definition: object-map.hh:63
void createPolyhedron(const std::string polyhedronName)
bool nameExists(const std::string &name) const
void createCylinder(const std::string name, value_type radius, value_type length)
std::size_t addTriangle(const std::string polyhedronName, std::size_t pt1, std::size_t pt2, std::size_t pt3)
void createBox(const std::string boxName, value_type x, value_type y, value_type z)
GeomType
Definition: object-map.hh:65
@ Polyhedron
Definition: object-map.hh:65
@ BothGeomType
Definition: object-map.hh:65
@ Shape
Definition: object-map.hh:65
PolyhedronMap_t polyhedronMap_
Map of polyhedra in construction.
Definition: object-map.hh:75
ShapeMap_t shapeMap_
Map of basic shapes.
Definition: object-map.hh:73
ThrowType
Definition: object-map.hh:67
@ ThrowIfItDoesNotExist
Definition: object-map.hh:67
@ ThrowIfItExists
Definition: object-map.hh:67
@ NoThrow
Definition: object-map.hh:67
void createSphere(const std::string name, value_type radius)
std::size_t addPoint(const std::string polyhedronName, value_type x, value_type y, value_type z)
pinocchio::value_type value_type
Definition: fwd.hh:105
Implement CORBA interface `‘Obstacle’'.
Definition: client.hh:46
_CORBA_MODULE hpp _CORBA_MODULE_BEG _CORBA_MODULE core_idl _CORBA_MODULE_BEG typedef ::CORBA::ULongLong size_t
Definition: paths-idl.hh:75
std::vector< coal::Triangle > tris
Definition: object-map.hh:60
std::vector< coal::Vec3f > pts
Definition: object-map.hh:59