55 return Eigen::Quaterniond(R_WB);
93 JacobianRow vel = ori.
v().transpose().sparseView(1.0, -1.0);
96 for (
auto dim : {
X,
Y,
Z}) {
98 jac.row(dim) = vel*dM_du +
GetM(ori.
p()).row(dim)*dVel_du;
113 JacobianRow vel = ori.
v().transpose().sparseView(1.0, -1.0);
114 JacobianRow acc = ori.
a().transpose().sparseView(1.0, -1.0);
120 for (
auto dim : {
X,
Y,
Z}) {
125 jac.row(dim) = vel * dMdot_du
126 +
GetMdot(ori.
p(), ori.
v()).row(dim)* dVel_du
128 +
GetM(ori.
p()).row(dim) * dAcc_du;
144 M.coeffRef(0,
Y) = -sin(z); M.coeffRef(0,
X) = cos(y)*cos(z);
145 M.coeffRef(1,
Y) = cos(z); M.coeffRef(1,
X) = cos(y)*sin(z);
146 M.coeffRef(2,
Z) = 1.0; M.coeffRef(2,
X) = -sin(y);
156 double zd = xyz_d(
Z);
158 double yd = xyz_d(
Y);
162 Mdot.coeffRef(0,
Y) = -cos(z)*zd; Mdot.coeffRef(0,
X) = -cos(z)*sin(y)*yd - cos(y)*sin(z)*zd;
163 Mdot.coeffRef(1,
Y) = -sin(z)*zd; Mdot.coeffRef(1,
X) = cos(y)*cos(z)*zd - sin(y)*sin(z)*yd;
164 Mdot.coeffRef(2,
X) = -cos(y)*yd;
174 double z = ori.
p()(
Z);
175 double y = ori.
p()(
Y);
181 switch (ang_acc_dim) {
183 jac.row(
Y) = -cos(z)*jac_z;
184 jac.row(
X) = -cos(z)*sin(y)*jac_y - cos(y)*sin(z)*jac_z;
187 jac.row(
Y) = -sin(z)*jac_z;
188 jac.row(
X) = cos(y)*cos(z)*jac_z - sin(y)*sin(z)*jac_y;
191 jac.row(
X) = -cos(y)*jac_y;
217 M << cos(y)*cos(z), cos(z)*sin(x)*sin(y) - cos(x)*sin(z), sin(x)*sin(z) + cos(x)*cos(z)*sin(y),
218 cos(y)*sin(z), cos(x)*cos(z) + sin(x)*sin(y)*sin(z), cos(x)*sin(y)*sin(z) - cos(z)*sin(x),
219 -sin(y), cos(y)*sin(x), cos(x)*cos(y);
221 return M.sparseView(1.0, -1.0);
230 for (
int row : {
X,
Y,
Z}) {
231 for (
int col : {
X,
Y,
Z}) {
235 JacobianRow jac_row = inverse? Rd.at(col).at(row) : Rd.at(row).at(col);
236 jac.row(row) += v(col)*jac_row;
249 double x = ori.
p()(
X);
250 double y = ori.
p()(
Y);
251 double z = ori.
p()(
Z);
257 jac.at(
X).at(
X) = -cos(z)*sin(y)*jac_y - cos(y)*sin(z)*jac_z;
258 jac.at(
X).at(
Y) = sin(x)*sin(z)*jac_x - cos(x)*cos(z)*jac_z - sin(x)*sin(y)*sin(z)*jac_z + cos(x)*cos(z)*sin(y)*jac_x + cos(y)*cos(z)*sin(x)*jac_y;
259 jac.at(
X).at(
Z) = cos(x)*sin(z)*jac_x + cos(z)*sin(x)*jac_z - cos(z)*sin(x)*sin(y)*jac_x - cos(x)*sin(y)*sin(z)*jac_z + cos(x)*cos(y)*cos(z)*jac_y;
261 jac.at(
Y).at(
X) = cos(y)*cos(z)*jac_z - sin(y)*sin(z)*jac_y;
262 jac.at(
Y).at(
Y) = cos(x)*sin(y)*sin(z)*jac_x - cos(x)*sin(z)*jac_z - cos(z)*sin(x)*jac_x + cos(y)*sin(x)*sin(z)*jac_y + cos(z)*sin(x)*sin(y)*jac_z;
263 jac.at(
Y).at(
Z) = sin(x)*sin(z)*jac_z - cos(x)*cos(z)*jac_x - sin(x)*sin(y)*sin(z)*jac_x + cos(x)*cos(y)*sin(z)*jac_y + cos(x)*cos(z)*sin(y)*jac_z;
265 jac.at(
Z).at(
X) = -cos(y)*jac_y;
266 jac.at(
Z).at(
Y) = cos(x)*cos(y)*jac_x - sin(x)*sin(y)*jac_y;
267 jac.at(
Z).at(
Z) = -cos(y)*sin(x)*jac_x - cos(x)*sin(y)*jac_y;
277 double z = ori.
p()(
Z);
278 double zd = ori.
v()(
Z);
279 double y = ori.
p()(
Y);
280 double yd = ori.
v()(
Y);
288 switch (ang_acc_dim) {
290 jac.row(
Y) = sin(z)*zd*jac_z - cos(z)*jac_zd;
291 jac.row(
X) = sin(y)*sin(z)*yd*jac_z - cos(y)*sin(z)*jac_zd - cos(y)*cos(z)*yd*jac_y - cos(y)*cos(z)*zd*jac_z - cos(z)*sin(y)*jac_yd + sin(y)*sin(z)*jac_y*zd;
294 jac.row(
Y) = - sin(z)*jac_zd - cos(z)*zd*jac_z;
295 jac.row(
X) = cos(y)*cos(z)*jac_zd - sin(y)*sin(z)*jac_yd - cos(y)*sin(z)*yd*jac_y - cos(z)*sin(y)*yd*jac_z - cos(z)*sin(y)*jac_y*zd - cos(y)*sin(z)*zd*jac_z;
298 jac.row(
X) = sin(y)*yd*jac_y - cos(y)*jac_yd;
311 return euler_->GetJacobianWrtNodes(t, deriv).row(dim);
Stores at state comprised of values and higher-order derivatives.
std::shared_ptr< NodeSpline > Ptr
JacRowMatrix GetDerivativeOfRotationMatrixWrtNodes(double t) const
matrix of derivatives of each cell w.r.t node values.
Jacobian jac_wrt_nodes_structure_
std::array< std::array< JacobianRow, k3D >, k3D > JacRowMatrix
Eigen::SparseMatrix< double, Eigen::RowMajor > MatrixSXd
static MatrixSXd GetMdot(const EulerAngles &xyz, const EulerRates &xyz_d)
time derivative of GetM()
Vector3d GetAngularAccelerationInWorld(double t) const
Converts Euler angles, rates and rate derivatives o angular accelerations.
Eigen::SparseVector< double, Eigen::RowMajor > JacobianRow
Jacobian GetDerivOfAngAccWrtEulerNodes(double t) const
Jacobian of the angular acceleration with respect to the Euler nodes.
static MatrixSXd GetM(const EulerAngles &xyz)
Matrix that maps euler rates to angular velocities in world.
Eigen::Quaterniond GetQuaternionBaseToWorld(double t) const
Converts the Euler angles at time t to a Quaternion.
Vector3d GetAngularVelocityInWorld(double t) const
Converts Euler angles and Euler rates to angular velocities.
Jacobian GetDerivMdotwrtNodes(double t, Dim3D dim) const
Derivative of the dim row of the time derivative of M with respect to the node values.
Vector3d EulerRates
derivative of the above
Vector3d EulerAngles
roll, pitch, yaw.
MatrixSXd GetRotationMatrixBaseToWorld(double t) const
Converts the Euler angles at time t to a rotation matrix.
Jacobian GetDerivOfAngVelWrtEulerNodes(double t) const
Jacobian of the angular velocity with respect to the Euler nodes.
Jacobian GetDerivMwrtNodes(double t, Dim3D dim) const
Derivative of the dim row of matrix M with respect to the node values.
Jacobian DerivOfRotVecMult(double t, const Vector3d &v, bool inverse) const
Returns the derivative of result of the linear equation M*v.
Dx
< the values or derivative. For motions e.g. position, velocity, ...
JacobianRow GetJac(double t, Dx deriv, Dim3D dim) const