mbsim 4.0.0 MBSim Kernel

floating_relative_frame.h
1 /* Copyright (C) 2004-2014 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@googlemail.com
18 */
19
20 #ifndef _FLOATING_RELATIVE_FRAME_H__
21 #define _FLOATING_RELATIVE_FRAME_H__
22
23 #include "mbsim/frames/frame.h"
24
25 namespace MBSim {
26
31 class FloatingRelativeFrame : public Frame {
32
33 public:
34 FloatingRelativeFrame(const std::string &name = "dummy", const fmatvec::Vec3 &r=fmatvec::Vec3(), const fmatvec::SqrMat3 &A=fmatvec::SqrMat3(fmatvec::EYE), Frame *refFrame=nullptr) : Frame(name), R(refFrame), RrRP(r), ARP(A) {
35 }
36
37 void init(InitStage stage, const InitConfigSet &config) override;
38
39 void setRelativePosition(const fmatvec::Vec3 &r) { RrRP = r; }
40 void setRelativeOrientation(const fmatvec::SqrMat3 &A) { ARP = A; }
41 void setFrameOfReference(Frame *frame) { R = frame; }
42 void setFrameOfReference(const std::string &frame) { saved_frameOfReference = frame; }
43
44 const fmatvec::Vec3& getRelativePosition() const { return RrRP; }
45 const fmatvec::SqrMat3& getRelativeOrientation() const { return ARP; }
46 const Frame* getFrameOfReference() const { return R; }
47
48 const fmatvec::Vec3& evalGlobalRelativePosition() { if(updPos) updatePositions(); return WrRP; }
49
50 void updatePositions() override;
51 void updateVelocities() override;
52 void updateAccelerations() override;
53 void updateJacobians(int j=0) override;
54 void updateGyroscopicAccelerations() override;
55
56 void initializeUsingXML(xercesc::DOMElement *element) override;
57
58 protected:
59 Frame *R;
60 fmatvec::Vec3 RrRP, WrRP;
61 fmatvec::SqrMat3 ARP;
62 std::string saved_frameOfReference;
63 };
64
65 }
66
67 #endif
MBSim::FloatingRelativeFrame
cartesian frame on rigid bodies
Definition: floating_relative_frame.h:31
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::Frame
cartesian frame on bodies used for application of e.g. links and loads
Definition: frame.h:39
MBSim::FloatingRelativeFrame::init
void init(InitStage stage, const InitConfigSet &config) override
plots time series header
Definition: floating_relative_frame.cc:30
MBSim::Frame::Frame
Frame(const std::string &name="dummy")
constructor
Definition: frame.cc:48
MBSim
namespace MBSim
Definition: bilateral_constraint.cc:30