summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Miller2017-07-12 10:19:27 -0500
committerMartin Miller2017-07-12 10:19:27 -0500
commit2691d41ef5e547fb8f77583b018e4712a19a08d0 (patch)
tree0bfb0c5454d05789def9f07436ca6fca64b56489 /src
parent6e9404c5f9c6349ae4f01afaf5a0e9c626616d21 (diff)
downloadrefslam-2691d41ef5e547fb8f77583b018e4712a19a08d0.zip
refslam-2691d41ef5e547fb8f77583b018e4712a19a08d0.tar.gz
Fix gravity in Body::F
Diffstat (limited to 'src')
-rw-r--r--src/body.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/body.cpp b/src/body.cpp
index 5579e4d..1aafd54 100644
--- a/src/body.cpp
+++ b/src/body.cpp
@@ -262,7 +262,7 @@ Body::F ( const Vector3d &ang, const Quaterniond &q, double dt )
v1 = X(3);
v2 = X(4);
v3 = X(5);
- double gw = gravity_world[2];
+ double gw = -gravity_world[2];
F.block<1,4>(0,6) << 2*qbw1*v1 + 2*qbw2*v2 + 2*qbw3*v3,
2*qbw1*v2 - 2*qbw2*v1 + 2*qbw4*v3,
2*qbw1*v3 - 2*qbw3*v1 - 2*qbw4*v2,
@@ -279,10 +279,8 @@ Body::F ( const Vector3d &ang, const Quaterniond &q, double dt )
-2*gw*qbw4, -2*gw*qbw3, -2*gw*qbw2, -2*gw*qbw1,
2*gw*qbw1, 2*gw*qbw2, -2*gw*qbw3, -2*gw*qbw4;
F.block<4,4>(6,6) = 0.5*omega(ang);
- F.block<3,3>(3,10) = -Matrix<double,3,3>::Identity();
-#else
- F.block<3,3>(3,6) = -Matrix<double,3,3>::Identity();
#endif
+ F.block<3,3>(3,STATESIZE-3) = -Matrix<double,3,3>::Identity();
F *= dt;
F += Matrix<double,STATESIZE,STATESIZE>::Identity();
return F;