10 ChBody::variables = variables;
15 ChBody::variables.SetBodyMass(newmass);
20 ChBody::variables.SetBodyInertia(newXInertia);
24 variables.GetBodyInertia()(0, 0) = iner.x();
25 variables.GetBodyInertia()(1, 1) = iner.y();
26 variables.GetBodyInertia()(2, 2) = iner.z();
28 ChBody::SetInertiaXX(iner);
32 variables.GetBodyInertia()(0, 1) = iner.x();
33 variables.GetBodyInertia()(0, 2) = iner.y();
34 variables.GetBodyInertia()(1, 2) = iner.z();
35 variables.GetBodyInertia()(1, 0) = iner.x();
36 variables.GetBodyInertia()(2, 0) = iner.y();
37 variables.GetBodyInertia()(2, 1) = iner.z();
39 ChBody::SetInertiaXY(iner);
59 assert(Mfullmass_in.rows() ==
variables.Get_ndof());
60 assert(Mfullmass_in.cols() ==
variables.Get_ndof());
79 const ChStateDelta&
v,
80 const ChVectorDynamic<>&
R,
81 const unsigned int off_L,
82 const ChVectorDynamic<>&
L,
83 const ChVectorDynamic<>& Qc) {
84 this->
variables.Get_qb() = v.segment(off_v, 6);
85 this->
variables.Get_fb() = R.segment(off_v, 6);
90 const unsigned int off_L,
91 ChVectorDynamic<>&
L) {
92 v.segment(off_v, 6) = this->
variables.Get_qb();
98 this->
variables.SetDisabled(!this->IsActive());
99 mdescriptor.InsertVariables(&this->
variables);
108 this->
variables.Get_fb().segment(0, 3) += factor * Xforce.eigen();
111 if (this->GetNoGyroTorque())
112 this->
variables.Get_fb().segment(3, 3) += factor * Xtorque.eigen();
114 this->
variables.Get_fb().segment(3, 3) += factor * (Xtorque - gyro).eigen();
123 this->
variables.Get_qb().segment(0, 3) = GetCoord_dt().pos.eigen();
124 this->
variables.Get_qb().segment(3, 3) = GetWvel_loc().eigen();
128 ChCoordsys<> old_coord_dt = this->GetCoord_dt();
131 this->SetPos_dt(this->
variables.Get_qb().segment(0, 3));
132 this->SetWvel_loc(this->
variables.Get_qb().segment(3, 3));
142 this->SetPos_dtdt((this->GetCoord_dt().
pos - old_coord_dt.pos) / step);
143 this->SetRot_dtdt((this->GetCoord_dt().rot - old_coord_dt.rot) / step);
148 if (!this->IsActive())
154 ChVector<> newspeed(
variables.Get_qb().segment(0, 3));
155 ChVector<> newwel(
variables.Get_qb().segment(3, 3));
158 this->SetPos(this->GetPos() + newspeed * dt_step);
161 ChQuaternion<> mdeltarot;
162 ChQuaternion<> moldrot = this->GetRot();
163 ChVector<> newwel_abs = Amatrix * newwel;
164 double mangle = newwel_abs.Length() * dt_step;
165 newwel_abs.Normalize();
166 mdeltarot.Q_from_AngAxis(mangle, newwel_abs);
167 ChQuaternion<> mnewrot = mdeltarot % moldrot;
168 this->SetRot(mnewrot);
172 ChVectorDynamic<>&
R,
177 R.segment(off, 3) +=
c * Xforce.eigen();
180 if (this->GetNoGyroTorque())
181 R.segment(off + 3, 3) +=
c * Xtorque.eigen();
183 R.segment(off + 3, 3) +=
c * (Xtorque - gyro).eigen();
187 ChVectorDynamic<>&
R,
188 const ChVectorDynamic<>&
w,
191 ChMatrixDynamic<> ww = ChMatrixDynamic<>(6, 1);
192 for (
int i=0; i < 6; i++) {