Moved to header, added some methods
parent
e5b8f982a1
commit
988837be6a
|
|
@ -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
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue