MIRA
RigidModel.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 by
3  * MetraLabs GmbH (MLAB), GERMANY
4  * and
5  * Neuroinformatics and Cognitive Robotics Labs (NICR) at TU Ilmenau, GERMANY
6  * All rights reserved.
7  *
8  * Contact: info@mira-project.org
9  *
10  * Commercial Usage:
11  * Licensees holding valid commercial licenses may use this file in
12  * accordance with the commercial license agreement provided with the
13  * software or, alternatively, in accordance with the terms contained in
14  * a written agreement between you and MLAB or NICR.
15  *
16  * GNU General Public License Usage:
17  * Alternatively, this file may be used under the terms of the GNU
18  * General Public License version 3.0 as published by the Free Software
19  * Foundation and appearing in the file LICENSE.GPL3 included in the
20  * packaging of this file. Please review the following information to
21  * ensure the GNU General Public License version 3.0 requirements will be
22  * met: http://www.gnu.org/copyleft/gpl.html.
23  * Alternatively you may (at your option) use any later version of the GNU
24  * General Public License if such license has been publicly approved by
25  * MLAB and NICR (or its successors, if any).
26  *
27  * IN NO EVENT SHALL "MLAB" OR "NICR" BE LIABLE TO ANY PARTY FOR DIRECT,
28  * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
29  * THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF "MLAB" OR
30  * "NICR" HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  * "MLAB" AND "NICR" SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
33  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
34  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
35  * ON AN "AS IS" BASIS, AND "MLAB" AND "NICR" HAVE NO OBLIGATION TO
36  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR MODIFICATIONS.
37  */
38 
47 #ifndef _MIRA_RIGIDMODEL_H_
48 #define _MIRA_RIGIDMODEL_H_
49 
50 #include <fw/Framework.h>
51 
53 #include <serialization/adapters/std/map>
54 #include <serialization/adapters/std/list>
55 #include <serialization/adapters/boost/shared_ptr.hpp>
56 
57 #include <model/Link.h>
58 #include <model/Joint.h>
59 #include <model/Footprint.h>
60 
61 namespace mira { namespace model {
62 
64 
73 {
75 public:
76 
78  typedef std::list<LinkPtr> LinkList;
80  typedef std::map<std::string, JointPtr> JointMap;
82  typedef std::map<std::string, MaterialPtr> MaterialMap;
83 
85  virtual ~RigidModel() {}
86 
87  template<typename Reflector>
88  void reflect(Reflector& r)
89  {
90  r.member("Name", name, "The name of this model", "");
91  r.member("Links", links, "The links of this model", LinkList());
92  r.member("Joints", joints, "The joints of this model", JointMap());
93  r.member("Materials", materials, "The materials of this model", MaterialMap());
94  }
95 
99  void reflect(XMLDeserializer& r);
100 
104  void clear();
105 
110  std::string getRootLink() const;
111 
116  typedef std::list<std::pair<GeometryPtr, RigidTransform3f>,
118 
136  CollisionGeometries getCollisionGeometries(std::string targetFrame="",
137  const Time& timestamp = Time::now(),
138  const std::string& filter = "") const;
139 
156  std::list<Box3f> getCollisionBoundingBoxes(std::string targetFrame="",
157  const Time& timestamp = Time::now(),
158  const std::string& filter = "") const;
159 
173  Footprint getFootprint(std::string targetFrame = "",
174  const Time& timestamp = Time::now(),
175  const std::string& filter = "") const;
176 
183  void resolveAndPublishLinks(const std::string& ns,
184  const Time& timestamp = Time::now());
185 
196  void publishJoint(const std::string& name, float value,
197  const Time& timestamp = Time::now()) const;
198 
199  std::string name;
203 };
204 
205 typedef boost::shared_ptr<RigidModel> RigidModelPtr;
206 
208 
209 }}
210 
211 #endif
std::map< std::string, MaterialPtr > MaterialMap
Maps material pointers to their name.
Definition: RigidModel.h:82
void reflect(Reflector &r)
Definition: RigidModel.h:88
Class representing a named rigid model.
Definition: RigidModel.h:72
std::map< std::string, JointPtr > JointMap
Maps joint pointers to their name.
Definition: RigidModel.h:80
LinkList links
List of links used by this model.
Definition: RigidModel.h:200
boost::shared_ptr< RigidModel > RigidModelPtr
Definition: RigidModel.h:205
A joint representation.
virtual ~RigidModel()
Destructor.
Definition: RigidModel.h:85
void reflect(Reflector &r, LogRecord &record)
MaterialMap materials
Map with name - material pointer pairs used by this model.
Definition: RigidModel.h:202
Representation of a footprint of a rigid model (part).
#define MIRA_OBJECT(classIdentifier)
#define MIRA_RIGID_MODEL_EXPORT
Definition: RigidModelExports.h:61
static Time now() static Time eternity()
std::string name
Name of the model.
Definition: RigidModel.h:199
std::list< LinkPtr > LinkList
A list of links.
Definition: RigidModel.h:78
Represents the footprint of a rigid model that is the 2D projection of the 3D model onto the xy-plane...
Definition: Footprint.h:65
JointMap joints
Map with name - joint pointer pairs used by this model.
Definition: RigidModel.h:201
std::list< std::pair< GeometryPtr, RigidTransform3f >, Eigen::aligned_allocator< std::pair< GeometryPtr, RigidTransform3f > > > CollisionGeometries
List of collision geometries, each item consisting of the geometry pointer and a transform that descr...
Definition: RigidModel.h:117