mbsim  4.0.0
MBSim Kernel
tyre_contact_observer.h
1 /* Copyright (C) 2004-2022 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 _TYRE_CONTACT_OBSERVER_H_
21 #define _TYRE_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 TyreContact;
30 
32 
33  protected:
34  std::vector<std::shared_ptr<OpenMBV::Frame>> openMBVContactFrame;
35 
36  std::shared_ptr<OpenMBVInteractionArrow> ombvNormalForce, ombvLongitudinalForce, ombvLateralForce, ombvAligningMoment;
37  std::vector<std::shared_ptr<OpenMBV::Arrow>> normalForceArrow, longitudinalForceArrow, lateralForceArrow, aligningMomentArrow;
38 
39  public:
40  TyreContactObserver(const std::string &name="");
41 
42  void init(InitStage stage, const InitConfigSet &config) override;
43  void plot() override;
44  void initializeUsingXML(xercesc::DOMElement *element) override;
45 
46  void setOpenMBVContactPoints(const std::shared_ptr<OpenMBV::Frame> &frame) {
47  openMBVContactFrame[0]=frame;
48  openMBVContactFrame[1]=OpenMBV::ObjectFactory::create(openMBVContactFrame[0]);
49  }
50 
51  void setOMBVNormalForce(const std::shared_ptr<OpenMBVInteractionArrow> &arrow) { ombvNormalForce=arrow; }
52  void setOMBVLongitudinalForce(const std::shared_ptr<OpenMBVInteractionArrow> &arrow) { ombvLongitudinalForce=arrow; }
53  void setOMBVLateralForce(const std::shared_ptr<OpenMBVInteractionArrow> &arrow) { ombvLateralForce=arrow; }
54  void setOMBVAligningMoment(const std::shared_ptr<OpenMBVInteractionArrow> &arrow) { ombvAligningMoment=arrow; }
55  };
56 
57 }
58 
59 #endif
Definition: mechanical_link_observer.h:33
void plot() override
plots time dependent data
Definition: tyre_contact_observer.cc:115
Definition: tyre_contact_observer.h:31
InitStage
The stages of the initialization.
Definition: element.h:64
std::string name
name of element
Definition: element.h:251
void init(InitStage stage, const InitConfigSet &config) override
plots time series header
Definition: tyre_contact_observer.cc:40
static std::shared_ptr< CreateType > create()
namespace MBSim
Definition: bilateral_constraint.cc:29