19 #ifndef _JOINT_CONSTRAINT_H
20 #define _JOINT_CONSTRAINT_H
22 #include "mbsim/constraints/constraint.h"
23 #include "mbsim/functions/function.h"
24 #include "mbsim/frames/floating_relative_frame.h"
26 #include "mbsim/utils/boost_parameters.h"
27 #include "mbsim/utils/openmbv_utils.h"
48 void connect(
Frame* frame1_,
Frame* frame2_) { frame1 = frame1_; frame2 = frame2_; }
49 void addDependentRigidBodyOnFirstSide(
RigidBody* bd) { bd1.push_back(bd); }
50 void addDependentRigidBodyOnSecondSide(
RigidBody* bd) { bd2.push_back(bd); }
51 void setIndependentRigidBody(
RigidBody* bi_) { bi.resize(1); bi[0] = bi_; }
52 void addIndependentRigidBody(
RigidBody* bi_) { bi.push_back(bi_); }
54 virtual void setUpInverseKinetics();
55 void setForceDirection(
const fmatvec::Mat3xV& d_);
56 void setMomentDirection(
const fmatvec::Mat3xV& d_);
63 void updatePositions(
Frame *frame_);
64 void updateGeneralizedCoordinates();
65 void updateGeneralizedJacobians(
int j=0);
66 virtual void initializeUsingXML(xercesc::DOMElement *element);
68 virtual std::string
getType()
const {
return "JointConstraint"; }
70 void setInitialGuess(
const fmatvec::VecV &q0_) { q0 = q0_; }
73 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))) {
74 OpenMBVArrow ombv(diffuseColor,transparency,OpenMBV::Arrow::toHead,referencePoint,scaleLength,scaleSize);
75 FArrow=ombv.createOpenMBV();
79 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))) {
80 OpenMBVArrow ombv(diffuseColor,transparency,OpenMBV::Arrow::toDoubleHead,referencePoint,scaleLength,scaleSize);
81 MArrow=ombv.createOpenMBV();
87 std::vector<RigidBody*> body1, body2;
88 fmatvec::Mat3xV forceDir, momentDir;
89 Frame *frame1, *frame2, *refFrame;
90 std::vector<Frame*> i1,i2;
92 Residuum(std::vector<RigidBody*> body1_, std::vector<RigidBody*> body2_,
const fmatvec::Mat3xV &forceDir_,
const fmatvec::Mat3xV &momentDir_,
Frame *frame1_,
Frame *frame2_,
Frame *refFrame, std::vector<Frame*> i1_, std::vector<Frame*> i2_);
95 std::vector<RigidBody*> bd1, bd2, bi;
96 std::vector<Frame*> if1, if2;
98 Frame *frame1, *frame2;
108 fmatvec::Mat3xV dT, dR, forceDir, momentDir;
110 std::vector<fmatvec::RangeV> Iq1, Iq2, Iu1, Iu2, Ih1, Ih2;
115 std::string saved_ref1, saved_ref2;
116 std::vector<std::string> saved_RigidBodyFirstSide, saved_RigidBodySecondSide, saved_IndependentBody;
117 std::shared_ptr<OpenMBV::Arrow> FArrow, MArrow;
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 acting on frame2.
Definition: joint_constraint.h:73
virtual std::string getType() const
Definition: joint_constraint.h:68
Definition: openmbv_utils.h:54
cartesian frame on rigid bodies
Definition: floating_relative_frame.h:31
Definition: joint_constraint.h:85
void init(InitStage stage)
plots time series header
Definition: joint_constraint.cc:74
fmatvec::Vec x
order one parameters
Definition: constraint.h:66
Joint contraint.
Definition: joint_constraint.h:39
Frame * refFrame
frame of reference the force is defined in
Definition: joint_constraint.h:103
InitStage
The stages of the initialization.
Definition: element.h:97
Definition: planar_contour.h:31
std::string name
name of element
Definition: element.h:298
Class for constraints between generalized coordinates of objects.
Definition: constraint.h:30
cartesian frame on bodies used for application of e.g. links and loads
Definition: frame.h:37
void setFrameOfReferenceID(int ID)
The frame of reference ID for the force/moment direction vectors. If ID=0 (default) the first frame...
Definition: joint_constraint.h:61
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: joint_constraint.h:79
rigid bodies with arbitrary kinematics
Definition: rigid_body.h:52