diff options
author | Martin Miller | 2017-03-28 10:06:47 -0500 |
---|---|---|
committer | Martin Miller | 2017-03-28 10:06:47 -0500 |
commit | fb4b8328bfa5a8930b87ec8b7465b8032f4873c5 (patch) | |
tree | f1998951d3b9b10d2feec8423ebec1b85a184a48 | |
parent | 9533fbcda07254b65a53a9109555662d9a09086c (diff) | |
download | refslam-fb4b8328bfa5a8930b87ec8b7465b8032f4873c5.zip refslam-fb4b8328bfa5a8930b87ec8b7465b8032f4873c5.tar.gz |
move aboveWater
() back to main
-rw-r--r-- | src/main.cpp | 9 | ||||
-rw-r--r-- | src/main.h | 1 | ||||
-rw-r--r-- | src/state.cpp | 7 | ||||
-rw-r--r-- | src/types.cpp | 29 | ||||
-rw-r--r-- | src/types.h | 1 |
5 files changed, 14 insertions, 33 deletions
diff --git a/src/main.cpp b/src/main.cpp index 4e61484..62d2560 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -27,6 +27,15 @@ using std::cout; using std::endl; using std::cerr; +double +aboveWater(const Quaterniond &q) +{ + Vector3d tip; + tip << 0.65*3.43, 0, -0.60; + tip = q._transformVector(tip); + return tip[2]; +} + #ifdef USE_ROS #else /* ----- not USE_ROS ----- */ @@ -21,6 +21,7 @@ using Eigen::Matrix3d; using Eigen::Quaterniond; using Eigen::Vector3d; +double aboveWater(const Quaterniond &q); int parseLine(char *line, message *msg); timestamp update_dt(const timestamp t, timestamp *t_old); diff --git a/src/state.cpp b/src/state.cpp index aee0caa..aaf9cb9 100644 --- a/src/state.cpp +++ b/src/state.cpp @@ -260,9 +260,11 @@ State::handle_measurements ( const std::vector<measurement_t> &z, const Quaterni { std::vector<measurement_t> featuresToAdd; std::vector<measurement_t> featuresToUpdate; + double zmeas = body->ned()[2]; for (auto i=z.begin(); i!=z.end(); ++i) { if (i->z_type==HEIGHT) { featuresToUpdate.push_back(*i); + zmeas = i->height; } else if (exists(i->id)) { featuresToUpdate.push_back(*i); } else { @@ -280,16 +282,15 @@ State::handle_measurements ( const std::vector<measurement_t> &z, const Quaterni #endif /* ----- not FULLS ----- */ } - addFeatures( featuresToAdd, q); + addFeatures( featuresToAdd, q, zmeas); return ; } /* ----- end of method State::feature_update ----- */ void -State::addFeatures ( std::vector<measurement_t> &F, const Quaterniond &q) +State::addFeatures ( std::vector<measurement_t> &F, const Quaterniond &q, double z) { // Add new features - double z = aboveWater(q); Vector3d pos = body->ned(); for (auto i=F.begin(); i!=F.end(); ++i) { if (features.size()>MAXFEATURES) break; diff --git a/src/types.cpp b/src/types.cpp deleted file mode 100644 index 151fd63..0000000 --- a/src/types.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - * ===================================================================================== - * - * Filename: types.cpp - * - * Description: - * - * Version: 1.0 - * Created: 03/27/2017 03:26:51 PM - * Revision: none - * Compiler: gcc - * - * Author: Martin Miller (MHM), miller7@illinois.edu - * Organization: Aerospace Robotics and Controls Lab (ARC) - * - * ===================================================================================== - */ - - -#include "types.h" - -double -aboveWater(const Quaterniond &q) -{ - Vector3d tip; - tip << 0.65*3.43, 0, -0.60; - tip = q._transformVector(tip); - return tip[2]; -} diff --git a/src/types.h b/src/types.h index f32dfea..c284d4a 100644 --- a/src/types.h +++ b/src/types.h @@ -79,5 +79,4 @@ typedef struct { velocity_t velocity; covariance_t covariance; } message; -double aboveWater(const Quaterniond &q); #endif /* ----- #ifndef types_INC ----- */ |