All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
kinematics_observer.h
1 /* Copyright (C) 2004-2016 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 _KINEMATICS_OBSERVER_H__
21 #define _KINEMATICS_OBSERVER_H__
22 
23 #include "mbsim/observers/observer.h"
24 
25 #include <mbsim/utils/boost_parameters.h>
26 #include <mbsim/utils/openmbv_utils.h>
27 
28 namespace MBSim {
29 
30  class Frame;
31 
32  class KinematicsObserver : public Observer {
33  protected:
34  Frame* frame;
35  std::string saved_frame;
36  std::shared_ptr<OpenMBV::Group> openMBVPosGrp, openMBVVelGrp, openMBVAngVelGrp, openMBVAccGrp, openMBVAngAccGrp;
37  std::shared_ptr<OpenMBV::Arrow> openMBVPosition, openMBVVelocity, openMBVAngularVelocity, openMBVAcceleration, openMBVAngularAcceleration;
38 
39  public:
40  KinematicsObserver(const std::string &name="");
41  void setFrame(Frame *frame_) { frame = frame_; }
42  void init(InitStage stage);
43  virtual void plot();
44  virtual void initializeUsingXML(xercesc::DOMElement *element);
45 
46  BOOST_PARAMETER_MEMBER_FUNCTION( (void), enableOpenMBVPosition, 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))) {
47  OpenMBVArrow ombv(diffuseColor,transparency,OpenMBV::Arrow::toHead,referencePoint,scaleLength,scaleSize);
48  openMBVPosition=ombv.createOpenMBV();
49  }
50  BOOST_PARAMETER_MEMBER_FUNCTION( (void), enableOpenMBVVelocity, 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))) {
51  OpenMBVArrow ombv(diffuseColor,transparency,OpenMBV::Arrow::toHead,referencePoint,scaleLength,scaleSize);
52  openMBVVelocity=ombv.createOpenMBV();
53  }
54  BOOST_PARAMETER_MEMBER_FUNCTION( (void), enableOpenMBVAngularVelocity, 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::toDoubleHead,referencePoint,scaleLength,scaleSize);
56  openMBVAngularVelocity=ombv.createOpenMBV();
57  }
58  BOOST_PARAMETER_MEMBER_FUNCTION( (void), enableOpenMBVAcceleration, 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))) {
59  OpenMBVArrow ombv(diffuseColor,transparency,OpenMBV::Arrow::toHead,referencePoint,scaleLength,scaleSize);
60  openMBVAcceleration=ombv.createOpenMBV();
61  }
62  BOOST_PARAMETER_MEMBER_FUNCTION( (void), enableOpenMBVAngularAcceleration, 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))) {
63  OpenMBVArrow ombv(diffuseColor,transparency,OpenMBV::Arrow::toDoubleHead,referencePoint,scaleLength,scaleSize);
64  openMBVAngularAcceleration=ombv.createOpenMBV();
65  }
66  };
67 
68 }
69 
70 #endif
void init(InitStage stage)
plots time series header
Definition: kinematics_observer.cc:35
Definition: openmbv_utils.h:54
Definition: kinematics_observer.h:32
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
virtual void plot()
plots time dependent data
Definition: kinematics_observer.cc:99
Definition: observer.h:26

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Valid HTML