update: use avialble rot2 class
parent
554dd790d9
commit
587ad0fad3
|
@ -8,11 +8,10 @@ public:
|
|||
Vector evaluateError(const Pose2& q,
|
||||
boost::optional<Matrix&> H = boost::none) const
|
||||
{
|
||||
const double cosTheta = cos(q.theta());
|
||||
const double sinTheta = sin(q.theta());
|
||||
const Rot2& R = q.rotation();
|
||||
if (H) (*H) = (gtsam::Matrix(2, 3) <<
|
||||
cosTheta, -sinTheta, 0.0,
|
||||
sinTheta, cosTheta, 0.0).finished();
|
||||
R.c(), -R.s(), 0.0,
|
||||
R.s(), R.c(), 0.0).finished();
|
||||
return (Vector(2) << q.x() - mx_, q.y() - my_).finished();
|
||||
}
|
||||
};
|
||||
|
|
BIN
doc/gtsam.pdf
BIN
doc/gtsam.pdf
Binary file not shown.
|
@ -92,9 +92,8 @@ class UnaryFactor: public NoiseModelFactor1<Pose2> {
|
|||
// Node's orientation reflects in the Jacobian, in tangent space this is equal to the right-hand rule rotation matrix
|
||||
// H = [ cos(q.theta) -sin(q.theta) 0 ]
|
||||
// [ sin(q.theta) cos(q.theta) 0 ]
|
||||
const double cosTheta = cos(q.theta());
|
||||
const double sinTheta = sin(q.theta());
|
||||
if (H) (*H) = (gtsam::Matrix(2, 3) << cosTheta, -sinTheta, 0.0, sinTheta, cosTheta, 0.0).finished();
|
||||
const Rot2& R = q.rotation();
|
||||
if (H) (*H) = (gtsam::Matrix(2, 3) << R.c(), -R.s(), 0.0, R.s(), R.c(), 0.0).finished();
|
||||
return (Vector(2) << q.x() - mx_, q.y() - my_).finished();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue