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}) {
124 jac.row(dim) = vel * dMdot_du
125 +
GetMdot(ori.
p(), ori.
v()).row(dim)* dVel_du
127 +
GetM(ori.
p()).row(dim) * dAcc_du;
143 M.coeffRef(0,
Y) = -sin(z); M.coeffRef(0,
X) = cos(y)*cos(z);
144 M.coeffRef(1,
Y) = cos(z); M.coeffRef(1,
X) = cos(y)*sin(z);
145 M.coeffRef(2,
Z) = 1.0; M.coeffRef(2,
X) = -sin(y);
155 double zd = xyz_d(
Z);
157 double yd = xyz_d(
Y);
161 Mdot.coeffRef(0,
Y) = -cos(z)*zd; Mdot.coeffRef(0,
X) = -cos(z)*sin(y)*yd - cos(y)*sin(z)*zd;
162 Mdot.coeffRef(1,
Y) = -sin(z)*zd; Mdot.coeffRef(1,
X) = cos(y)*cos(z)*zd - sin(y)*sin(z)*yd;
163 Mdot.coeffRef(2,
X) = -cos(y)*yd;
173 double z = ori.
p()(
Z);
174 double y = ori.
p()(
Y);
180 switch (ang_acc_dim) {
182 jac.row(
Y) = -cos(z)*jac_z;
183 jac.row(
X) = -cos(z)*sin(y)*jac_y - cos(y)*sin(z)*jac_z;
186 jac.row(
Y) = -sin(z)*jac_z;
187 jac.row(
X) = cos(y)*cos(z)*jac_z - sin(y)*sin(z)*jac_y;
190 jac.row(
X) = -cos(y)*jac_y;
216 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),
217 cos(y)*sin(z), cos(x)*cos(z) + sin(x)*sin(y)*sin(z), cos(x)*sin(y)*sin(z) - cos(z)*sin(x),
218 -sin(y), cos(y)*sin(x), cos(x)*cos(y);
220 return M.sparseView(1.0, -1.0);
229 for (
int row : {
X,
Y,
Z}) {
230 for (
int col : {
X,
Y,
Z}) {
233 JacobianRow jac_row = inverse? Rd.at(col).at(row) : Rd.at(row).at(col);
234 jac.row(row) += v(col)*jac_row;
247 double x = ori.
p()(
X);
248 double y = ori.
p()(
Y);
249 double z = ori.
p()(
Z);
255 jac.at(
X).at(
X) = -cos(z)*sin(y)*jac_y - cos(y)*sin(z)*jac_z;
256 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;
257 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;
259 jac.at(
Y).at(
X) = cos(y)*cos(z)*jac_z - sin(y)*sin(z)*jac_y;
260 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;
261 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;
263 jac.at(
Z).at(
X) = -cos(y)*jac_y;
264 jac.at(
Z).at(
Y) = cos(x)*cos(y)*jac_x - sin(x)*sin(y)*jac_y;
265 jac.at(
Z).at(
Z) = -cos(y)*sin(x)*jac_x - cos(x)*sin(y)*jac_y;
275 double z = ori.
p()(
Z);
276 double zd = ori.
v()(
Z);
277 double y = ori.
p()(
Y);
278 double yd = ori.
v()(
Y);
286 switch (ang_acc_dim) {
288 jac.row(
Y) = sin(z)*zd*jac_z - cos(z)*jac_zd;
289 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;
292 jac.row(
Y) = - sin(z)*jac_zd - cos(z)*zd*jac_z;
293 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;
296 jac.row(
X) = sin(y)*yd*jac_y - cos(y)*jac_yd;
309 return euler_->GetJacobianWrtNodes(t, deriv).row(dim);
const VectorXd a() const
read access to the second-derivative of the state, e.g. acceleration.
Jacobian DerivOfRotVecMult(double t, const Vector3d &v, bool inverse) const
Returns the derivative of result of the linear equation M*v.
Jacobian GetDerivOfAngAccWrtEulerNodes(double t) const
Jacobian of the angular acceleration with respect to the Euler nodes.
Stores at state comprised of values and higher-order derivatives.
Eigen::Quaterniond GetQuaternionBaseToWorld(double t) const
Converts the Euler angles at time t to a Quaternion.
const VectorXd v() const
read access to the first-derivative of the state, e.g. velocity.
Vector3d GetAngularVelocityInWorld(double t) const
Converts Euler angles and Euler rates to angular velocities.
std::shared_ptr< NodeSpline > Ptr
JacobianRow GetJac(double t, Dx deriv, Dim3D dim) const
Jacobian GetDerivOfAngVelWrtEulerNodes(double t) const
Jacobian of the angular velocity with respect to the Euler nodes.
Jacobian jac_wrt_nodes_structure_
Jacobian GetDerivMwrtNodes(double t, Dim3D dim) const
Derivative of the dim row of matrix M with respect to the node values.
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()
Eigen::SparseVector< double, Eigen::RowMajor > JacobianRow
Vector3d GetAngularAccelerationInWorld(double t) const
Converts Euler angles, rates and rate derivatives o angular accelerations.
static MatrixSXd GetM(const EulerAngles &xyz)
Matrix that maps euler rates to angular velocities in world.
Vector3d EulerRates
derivative of the above
Vector3d EulerAngles
roll, pitch, yaw.
const VectorXd p() const
read access to the zero-derivative of the state, e.g. position.
Jacobian GetDerivMdotwrtNodes(double t, Dim3D dim) const
Derivative of the dim row of the time derivative of M with respect to the node values.
MatrixSXd GetRotationMatrixBaseToWorld(double t) const
Converts the Euler angles at time t to a rotation matrix.
JacRowMatrix GetDerivativeOfRotationMatrixWrtNodes(double t) const
matrix of derivatives of each cell w.r.t node values.
Dx
< the values or derivative. For motions e.g. position, velocity, ...