All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
rigid_body_group_observer.h
1 /* Copyright (C) 2004-2015 MBSim Development Team
2  *
3  * This library is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation; either
6  * version 2.1 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16  *
17  * Contact: martin.o.foerg@gmail.com
18  */
19 
20 #ifndef _RIGID_BODY_GROUP_OBSERVER_H__
21 #define _RIGID_BODY_GROUP_OBSERVER_H__
22 #include "mbsim/observers/observer.h"
23 
24 #include <mbsim/utils/boost_parameters.h>
25 #include <mbsim/utils/openmbv_utils.h>
26 
27 namespace OpenMBV {
28  class Frame;
29 }
30 
31 namespace MBSim {
32  class RigidBody;
33  class Frame;
34 
36  private:
37  std::vector<RigidBody*> body;
38  Frame* ref;
39  std::shared_ptr<OpenMBV::Arrow> openMBVPosition, openMBVVelocity, openMBVAcceleration, openMBVAngularVelocity, openMBVAngularAcceleration, openMBVWeight, openMBVMomentum, openMBVAngularMomentum, openMBVDerivativeOfMomentum, openMBVDerivativeOfAngularMomentum;
40 
41  public:
42  RigidBodyGroupObserver(const std::string &name);
43  void addBody(RigidBody *body_) { body.push_back(body_); }
44  void setFrameOfReference(Frame* frame) { ref = frame; }
45 
46  void init(InitStage stage);
47  virtual void plot();
48 
49  BOOST_PARAMETER_MEMBER_FUNCTION( (void), enableOpenMBVWeight, tag, (optional (scaleLength,(double),1)(scaleSize,(double),1)(referencePoint,(OpenMBV::Arrow::ReferencePoint),OpenMBV::Arrow::fromPoint)(diffuseColor,(const fmatvec::Vec3&),"[-1;1;1]")(transparency,(double),0))) {
50  OpenMBVArrow ombv(diffuseColor,transparency,OpenMBV::Arrow::toHead,referencePoint,scaleLength,scaleSize);
51  openMBVWeight=ombv.createOpenMBV();
52  }
53 
54  BOOST_PARAMETER_MEMBER_FUNCTION( (void), enableOpenMBVMomentum, tag, (optional (scaleLength,(double),1)(scaleSize,(double),1)(referencePoint,(OpenMBV::Arrow::ReferencePoint),OpenMBV::Arrow::fromPoint)(diffuseColor,(const fmatvec::Vec3&),"[-1;1;1]")(transparency,(double),0))) {
55  OpenMBVArrow ombv(diffuseColor,transparency,OpenMBV::Arrow::toHead,referencePoint,scaleLength,scaleSize);
56  openMBVMomentum=ombv.createOpenMBV();
57  }
58 
59  BOOST_PARAMETER_MEMBER_FUNCTION( (void), enableOpenMBVAngularMomentum, tag, (optional (scaleLength,(double),1)(scaleSize,(double),1)(referencePoint,(OpenMBV::Arrow::ReferencePoint),OpenMBV::Arrow::fromPoint)(diffuseColor,(const fmatvec::Vec3&),"[-1;1;1]")(transparency,(double),0))) {
60  OpenMBVArrow ombv(diffuseColor,transparency,OpenMBV::Arrow::toDoubleHead,referencePoint,scaleLength,scaleSize);
61  openMBVAngularMomentum=ombv.createOpenMBV();
62  }
63 
64  BOOST_PARAMETER_MEMBER_FUNCTION( (void), enableOpenMBVDerivativeOfMomentum, tag, (optional (scaleLength,(double),1)(scaleSize,(double),1)(referencePoint,(OpenMBV::Arrow::ReferencePoint),OpenMBV::Arrow::fromPoint)(diffuseColor,(const fmatvec::Vec3&),"[-1;1;1]")(transparency,(double),0))) {
65  OpenMBVArrow ombv(diffuseColor,transparency,OpenMBV::Arrow::toHead,referencePoint,scaleLength,scaleSize);
66  openMBVDerivativeOfMomentum=ombv.createOpenMBV();
67  }
68 
69  BOOST_PARAMETER_MEMBER_FUNCTION( (void), enableOpenMBVDerivativeOfAngularMomentum, tag, (optional (scaleLength,(double),1)(scaleSize,(double),1)(referencePoint,(OpenMBV::Arrow::ReferencePoint),OpenMBV::Arrow::fromPoint)(diffuseColor,(const fmatvec::Vec3&),"[-1;1;1]")(transparency,(double),0))) {
70  OpenMBVArrow ombv(diffuseColor,transparency,OpenMBV::Arrow::toDoubleHead,referencePoint,scaleLength,scaleSize);
71  openMBVDerivativeOfAngularMomentum=ombv.createOpenMBV();
72  }
73 
74  };
75 
76 }
77 
78 #endif
79 
virtual void plot()
plots time dependent data
Definition: rigid_body_group_observer.cc:91
void init(InitStage stage)
plots time series header
Definition: rigid_body_group_observer.cc:37
Definition: openmbv_utils.h:54
Definition: rigid_body_group_observer.h:35
InitStage
The stages of the initialization.
Definition: element.h:97
std::string name
name of element
Definition: element.h:298
cartesian frame on bodies used for application of e.g. links and loads
Definition: frame.h:37
Definition: observer.h:26
rigid bodies with arbitrary kinematics
Definition: rigid_body.h:52

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Valid HTML