MCPcopy Create free account
hub / github.com/ComputationalRobotics/XM-code / GetAlignRot

Function GetAlignRot

deps/glomap/glomap/math/gravity.cc:11–24  ·  view source on GitHub ↗

The second col of R_align is gravity direction

Source from the content-addressed store, hash-verified

9
10// The second col of R_align is gravity direction
11Eigen::Matrix3d GetAlignRot(const Eigen::Vector3d& gravity) {
12 Eigen::Matrix3d R;
13 Eigen::Vector3d v = gravity.normalized();
14 R.col(1) = v;
15
16 Eigen::Matrix3d Q = v.householderQr().householderQ();
17 Eigen::Matrix<double, 3, 2> N = Q.rightCols(2);
18 R.col(0) = N.col(0);
19 R.col(2) = N.col(1);
20 if (R.determinant() < 0) {
21 R.col(2) = -R.col(2);
22 }
23 return R;
24}
25
26double RotUpToAngle(const Eigen::Matrix3d& R_up) {
27 return RotationToAngleAxis(R_up)[1];

Callers 1

SetGravityMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected