Moved to header, added some methods

release/4.3a0
Frank Dellaert 2015-12-21 14:29:52 -08:00
parent e5b8f982a1
commit 988837be6a
2 changed files with 43 additions and 26 deletions

View File

@ -0,0 +1,41 @@
/* ----------------------------------------------------------------------------
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
* Atlanta, Georgia 30332-0415
* All Rights Reserved
* Authors: Frank Dellaert, et al. (see THANKS for the full author list)
* See LICENSE for the license information
* -------------------------------------------------------------------------- */
/**
* @file Scenario.h
* @brief Simple class to test navigation scenarios
* @author Frank Dellaert
*/
#pragma once
#include <gtsam/geometry/Pose3.h>
namespace gtsam {
/// Simple class with constant twist 3D trajectory
class Scenario {
public:
/// Construct scenario with constant twist [w,v]
Scenario(const Vector3& w, const Vector3& v, double imuSampleTime = 1e-2)
: twist_((Vector6() << w, v).finished()), imuSampleTime_(imuSampleTime) {}
Vector3 groundTruthAcc() const { return twist_.tail<3>(); }
Vector3 groundTruthGyro() const { return twist_.head<3>(); }
const double& imuSampleTime() const { return imuSampleTime_; }
Pose3 poseAtTime(double t) { return Pose3::Expmap(twist_ * t); }
private:
Vector6 twist_;
double imuSampleTime_;
};
} // namespace gtsam

View File

@ -9,38 +9,14 @@
* -------------------------------------------------------------------------- */ * -------------------------------------------------------------------------- */
/**
* @file Scenario.h
* @brief Simple class to test navigation scenarios
* @author Frank Dellaert
*/
#include <gtsam/geometry/Pose3.h>
namespace gtsam {
/// Simple class to test navigation scenarios
class Scenario {
public:
/// Construct scenario with constant twist [w,v]
Scenario(const Vector3& w, const Vector3& v)
: twist_((Vector6() << w, v).finished()) {}
Pose3 poseAtTime(double t) { return Pose3::Expmap(twist_ * t); }
private:
Vector6 twist_;
};
} // namespace gtsam
/** /**
* @file testScenario.cpp * @file testScenario.cpp
* @brief test ImuFacor with Scenario class * @brief Unit test Scenario class
* @author Frank Dellaert * @author Frank Dellaert
*/ */
#include <gtsam/navigation/Scenario.h>
#include <CppUnitLite/TestHarness.h> #include <CppUnitLite/TestHarness.h>
#include <cmath> #include <cmath>
using namespace std; using namespace std;