mbsim 4.0.0 MBSim Kernel

single_contact_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 _SINGLE_CONTACT_OBSERVER_H__
21 #define _SINGLE_CONTACT_OBSERVER_H__
22
23 #include "mbsim/observers/mechanical_link_observer.h"
24 #include <mbsim/utils/openmbv_utils.h>
25 #include <openmbvcppinterface/frame.h>
26
27 namespace MBSim {
28
29 class SingleContact;
30
31 class SingleContactObserver : public MechanicalLinkObserver {
32
33 friend class ContactObserver;
34 friend class MaxwellContactObserver;
35
36 protected:
40 std::vector<std::shared_ptr<OpenMBV::Frame>> openMBVContactFrame;
41
42 std::shared_ptr<OpenMBVInteractionArrow> ombvContact;
43 std::shared_ptr<OpenMBVFrictionArrow> ombvFriction;
44
48 std::vector<std::shared_ptr<OpenMBV::Arrow>> contactArrow, frictionArrow;
49
50 #ifndef SWIG
51 double (SingleContactObserver::*evalOMBVNormalForceColorRepresentation[2])();
52 double (SingleContactObserver::*evalOMBVTangentialForceColorRepresentation[3])();
53 #endif
54 double evalNone() { return 1; }
55 double evalAbsoluteNormalForce();
56 double evalAbsoluteTangentialForce();
57 double evalStickSlip();
58
59 public:
60 SingleContactObserver(const std::string &name="");
61
62 void init(InitStage stage, const InitConfigSet &config) override;
63 void plot() override;
64
65 void setOpenMBVContactPoints(const std::shared_ptr<OpenMBV::Frame> &frame) {
66 openMBVContactFrame[0]=frame;
67 openMBVContactFrame[1]=OpenMBV::ObjectFactory::create(openMBVContactFrame[0]);
68 }
69
70 void setOMBVNormalForce(const std::shared_ptr<OpenMBVInteractionArrow> &arrow) { ombvContact=arrow; }
71
72 void setOMBVTangentialForce(const std::shared_ptr<OpenMBVFrictionArrow> &arrow) { ombvFriction=arrow; }
73 };
74
75 }
76
77 #endif
MBSim::MechanicalLinkObserver
Definition: mechanical_link_observer.h:33
MBSim::MaxwellContactObserver
Definition: maxwell_contact_observer.h:32
MBSim::SingleContactObserver::openMBVContactFrame
std::vector< std::shared_ptr< OpenMBV::Frame > > openMBVContactFrame
container of ContactFrames to draw
Definition: single_contact_observer.h:40
MBSim::SingleContactObserver::contactArrow
std::vector< std::shared_ptr< OpenMBV::Arrow > > contactArrow
pointer to memory of normal and friction forces to draw
Definition: single_contact_observer.h:48
MBSim::SingleContactObserver::plot
void plot() override
plots time dependent data
Definition: single_contact_observer.cc:106
MBSim::Element::InitStage
InitStage
The stages of the initialization.
Definition: element.h:62
MBSim::Element::name
std::string name
name of element
Definition: element.h:260
MBSim::ContactObserver
Definition: contact_observer.h:32
MBSim::SingleContactObserver
Definition: single_contact_observer.h:31
OpenMBV::ObjectFactory::create
static std::shared_ptr< CreateType > create()
MBSim::SingleContactObserver::init
void init(InitStage stage, const InitConfigSet &config) override
plots time series header
Definition: single_contact_observer.cc:47
MBSim
namespace MBSim
Definition: bilateral_constraint.cc:30