All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
coordinates_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 _COORDINATES_OBSERVER_H__
21 #define _COORDINATES_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  class Frame;
30 
31  class CoordinatesObserver : public Observer {
32  protected:
33  Frame* frame;
34  std::shared_ptr<OpenMBV::Group> openMBVPosGrp, openMBVVelGrp, openMBVAccGrp;
35  std::shared_ptr<OpenMBV::Arrow> openMBVPosition, openMBVVelocity, openMBVAcceleration;
36  std::shared_ptr<OpenMBV::Frame> openMBVFrame;
37 
38  public:
39  CoordinatesObserver(const std::string &name="");
40  void setFrame(Frame *frame_) { frame = frame_; }
41 
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), 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))) {
55  OpenMBVArrow ombv(diffuseColor,transparency,OpenMBV::Arrow::toHead,referencePoint,scaleLength,scaleSize);
56  openMBVAcceleration=ombv.createOpenMBV();
57  }
58  BOOST_PARAMETER_MEMBER_FUNCTION( (void), enableOpenMBVFrame, tag, (optional (size,(double),1)(offset,(double),1)(transparency,(double),0))) {
59  OpenMBVFrame ombv(size,offset,"[-1;1;1]",transparency);
60  openMBVFrame=ombv.createOpenMBV();
61  }
62 
63  private:
64  std::string saved_frame;
65  };
66 
67 }
68 
69 #endif
void init(InitStage stage)
plots time series header
Definition: coordinates_observer.cc:36
Definition: openmbv_utils.h:54
Definition: coordinates_observer.h:31
Definition: openmbv_utils.h:66
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: coordinates_observer.cc:86
Definition: observer.h:26

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Valid HTML