20 #ifndef _RIGID_BODY_LINK_H_
21 #define _RIGID_BODY_LINK_H_
23 #include "mbsim/links/link.h"
24 #include "mbsim/frames/floating_relative_frame.h"
26 #include "mbsim/utils/boost_parameters.h"
27 #include "mbsim/utils/openmbv_utils.h"
35 std::vector<RigidBody*> body;
36 std::vector<double> ratio;
37 std::vector<FloatingRelativeFrame> C;
38 bool updPos, updVel, updFD, updF, updM, updRMV;
39 std::vector<fmatvec::Mat3xV> DF, DM;
40 std::vector<fmatvec::Vec3> F, M;
41 std::vector<fmatvec::Mat3xV> RF, RM;
42 fmatvec::RangeV iF, iM;
52 void updateh(
int i=0);
53 void updateW(
int i=0);
56 virtual void updatePositions();
57 void updateGeneralizedPositions();
58 void updateGeneralizedVelocities();
61 void updateForceDirections();
64 const fmatvec::Mat3xV& evalGlobalForceDirection(
int i) {
if(updFD) updateForceDirections();
return DF[i]; }
65 const fmatvec::Mat3xV& evalGlobalMomentDirection(
int i) {
if(updFD) updateForceDirections();
return DM[i]; }
66 const fmatvec::Vec3& evalForce(
int i) {
if(updF) updateForce();
return F[i]; }
67 const fmatvec::Vec3& evalMoment(
int i) {
if(updM) updateMoment();
return M[i]; }
68 const fmatvec::Mat3xV& evalRF(
int i) {
if(updRMV) updateR();
return RF[i]; }
69 const fmatvec::Mat3xV& evalRM(
int i) {
if(updRMV) updateR();
return RM[i]; }
75 std::string
getType()
const {
return "RigidBodyLink"; }
80 void initializeUsingXML(xercesc::DOMElement * element);
84 virtual void setSupportFrame(
Frame *frame) { support = frame; }
87 BOOST_PARAMETER_MEMBER_FUNCTION( (
void), enableOpenMBVForce, tag, (optional (scaleLength,(
double),1)(scaleSize,(
double),1)(referencePoint,(OpenMBV::Arrow::ReferencePoint),OpenMBV::Arrow::toPoint)(diffuseColor,(
const fmatvec::Vec3&),
"[-1;1;1]")(transparency,(
double),0))) {
88 OpenMBVArrow ombv(diffuseColor,transparency,OpenMBV::Arrow::toHead,referencePoint,scaleLength,scaleSize);
89 setOpenMBVForce(ombv.createOpenMBV());
91 void setOpenMBVForce(
const std::shared_ptr<OpenMBV::Arrow> &arrow) { FArrow[0]=arrow; }
94 BOOST_PARAMETER_MEMBER_FUNCTION( (
void), enableOpenMBVMoment, tag, (optional (scaleLength,(
double),1)(scaleSize,(
double),1)(referencePoint,(OpenMBV::Arrow::ReferencePoint),OpenMBV::Arrow::toPoint)(diffuseColor,(
const fmatvec::Vec3&),
"[-1;1;1]")(transparency,(
double),0))) {
95 OpenMBVArrow ombv(diffuseColor,transparency,OpenMBV::Arrow::toHead,referencePoint,scaleLength,scaleSize);
96 setOpenMBVMoment(ombv.createOpenMBV());
98 void setOpenMBVMoment(
const std::shared_ptr<OpenMBV::Arrow> &arrow) { MArrow[0]=arrow; }
101 std::shared_ptr<OpenMBV::Group> openMBVForceGrp;
102 std::vector<std::shared_ptr<OpenMBV::Arrow> > FArrow, MArrow;
105 std::string saved_supportFrame;
general link to one or more objects
Definition: link.h:46
void updatehRef(const fmatvec::Vec &hParent, int j=0)
references to complete and link smooth force vector of dynamic system parent
Definition: rigid_body_link.cc:39
Definition: openmbv_utils.h:54
int laSize
size and local index of contact force parameters
Definition: link.h:519
int gdSize
size and local index of relative velocities
Definition: link.h:514
void updateWRef(const fmatvec::Mat &WParent, int j=0)
references to contact force direction matrix of dynamic system parent
Definition: rigid_body_link.cc:57
void updaterRef(const fmatvec::Vec &hParent, int j=0)
references to nonsmooth force vector of dynamic system parent
Definition: rigid_body_link.cc:48
void updateVRef(const fmatvec::Mat &WParent, int j=0)
references to condensed contact force direction matrix of dynamic system parent
Definition: rigid_body_link.cc:68
void calcgSize(int j)
calculates size of relative distances
Definition: rigid_body_link.h:49
std::string getType() const
Definition: rigid_body_link.h:75
Definition: rigid_body_link.h:33
InitStage
The stages of the initialization.
Definition: element.h:97
BOOST_PARAMETER_MEMBER_FUNCTION((void), enableOpenMBVMoment, tag,(optional(scaleLength,(double), 1)(scaleSize,(double), 1)(referencePoint,(OpenMBV::Arrow::ReferencePoint), OpenMBV::Arrow::toPoint)(diffuseColor,(const fmatvec::Vec3 &),"[-1;1;1]")(transparency,(double), 0)))
Visualize a moment arrow.
Definition: rigid_body_link.h:94
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
void plot()
plots time dependent data
Definition: rigid_body_link.cc:259
int gSize
size and local index of relative distances
Definition: link.h:509
void calcgdSize(int j)
calculates size of gap velocities
Definition: rigid_body_link.h:50
BOOST_PARAMETER_MEMBER_FUNCTION((void), enableOpenMBVForce, tag,(optional(scaleLength,(double), 1)(scaleSize,(double), 1)(referencePoint,(OpenMBV::Arrow::ReferencePoint), OpenMBV::Arrow::toPoint)(diffuseColor,(const fmatvec::Vec3 &),"[-1;1;1]")(transparency,(double), 0)))
Visualize a force arrow.
Definition: rigid_body_link.h:87
void calclaSize(int j)
calculates size of contact force parameters
Definition: rigid_body_link.h:48
void init(InitStage stage)
plots time series header
Definition: rigid_body_link.cc:167