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  int iM;
35  std::vector<std::shared_ptr<OpenMBV::Frame>> openMBVContactFrame;
36 
37  std::shared_ptr<OpenMBVInteractionArrow> ombvNormalForce, ombvLongitudinalForce, ombvLateralForce, ombvOverturningMoment, ombvRollingResistanceMoment, ombvAligningMoment;
38  std::vector<std::shared_ptr<OpenMBV::Arrow>> normalForceArrow, longitudinalForceArrow, lateralForceArrow, overturningMomentArrow, rollingResistanceMomentArrow, aligningMomentArrow;
39 
40  public:
41  TyreContactObserver(const std::string &name="");
42 
43  void init(InitStage stage, const InitConfigSet &config) override;
44  void plot() override;
45  void initializeUsingXML(xercesc::DOMElement *element) override;
46 
47  void setOpenMBVContactPoints(const std::shared_ptr<OpenMBV::Frame> &frame) {
48  openMBVContactFrame[0]=frame;
49  openMBVContactFrame[1]=OpenMBV::ObjectFactory::create(openMBVContactFrame[0]);
50  }
51 
52  void setOMBVNormalForce(const std::shared_ptr<OpenMBVInteractionArrow> &arrow) { ombvNormalForce=arrow; }
53  void setOMBVLongitudinalForce(const std::shared_ptr<OpenMBVInteractionArrow> &arrow) { ombvLongitudinalForce=arrow; }
54  void setOMBVLateralForce(const std::shared_ptr<OpenMBVInteractionArrow> &arrow) { ombvLateralForce=arrow; }
55  void setOMBVOverturningMoment(const std::shared_ptr<OpenMBVInteractionArrow> &arrow) { ombvOverturningMoment=arrow; }
56  void setOMBVRollingResistanceMoment(const std::shared_ptr<OpenMBVInteractionArrow> &arrow) { ombvRollingResistanceMoment=arrow; }
57  void setOMBVAligningMoment(const std::shared_ptr<OpenMBVInteractionArrow> &arrow) { ombvAligningMoment=arrow; }
58  };
59 
60 }
61 
62 #endif
Definition: mechanical_link_observer.h:33
void plot() override
plots time dependent data
Definition: tyre_contact_observer.cc:135
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:262
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