Fixed sign of 2D version
parent
5369a7bd17
commit
a48c72ff63
|
|
@ -26,7 +26,8 @@ namespace gtsam {
|
||||||
/**
|
/**
|
||||||
* Factor to estimate rotation given magnetometer reading
|
* Factor to estimate rotation given magnetometer reading
|
||||||
* This version uses model measured bM = scale * bRn * direction + bias
|
* This version uses model measured bM = scale * bRn * direction + bias
|
||||||
* and assumes scale, direction, and the bias are given
|
* and assumes scale, direction, and the bias are given.
|
||||||
|
* Rotation is around negative Z axis, i.e. positive is yaw to right!
|
||||||
*/
|
*/
|
||||||
class MagFactor: public NoiseModelFactor1<Rot2> {
|
class MagFactor: public NoiseModelFactor1<Rot2> {
|
||||||
|
|
||||||
|
|
@ -52,7 +53,7 @@ public:
|
||||||
|
|
||||||
static Point3 unrotate(const Rot2& R, const Point3& p,
|
static Point3 unrotate(const Rot2& R, const Point3& p,
|
||||||
boost::optional<Matrix&> HR = boost::none) {
|
boost::optional<Matrix&> HR = boost::none) {
|
||||||
Point3 q = Rot3::yaw(R.theta()).rotate(p,HR);
|
Point3 q = Rot3::yaw(R.theta()).unrotate(p,HR);
|
||||||
if (HR) *HR = HR->col(2);
|
if (HR) *HR = HR->col(2);
|
||||||
return q;
|
return q;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ Point3 nM(22653.29982, -1956.83010, 44202.47862);
|
||||||
double scale = 255.0 / 50000.0;
|
double scale = 255.0 / 50000.0;
|
||||||
// ...ground truth orientation,
|
// ...ground truth orientation,
|
||||||
Rot3 nRb = Rot3::yaw(-0.1);
|
Rot3 nRb = Rot3::yaw(-0.1);
|
||||||
Rot2 theta = -nRb.yaw();
|
Rot2 theta = nRb.yaw();
|
||||||
// ...and bias
|
// ...and bias
|
||||||
Point3 bias(10, -10, 50);
|
Point3 bias(10, -10, 50);
|
||||||
// ... then we measure
|
// ... then we measure
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue