23#include <gtsam/dllexport.h>
43 virtual Vector3
omega_b(
double t)
const = 0;
49 Rot3 rotation(
double t)
const;
51 Gal3 gal3(
double t)
const;
53 Vector3 velocity_b(
double t)
const;
55 Vector3 acceleration_b(
double t)
const;
70 : twist_((Vector6() << w, v).finished()), a_b_(w.
cross(v)), nTb0_(nTb0) {}
72 Pose3 pose(
double t)
const override;
73 Vector3 omega_b(
double t)
const override;
74 Vector3 velocity_n(
double t)
const override;
75 Vector3 acceleration_n(
double t)
const override;
90 const Vector3&
omega_b = Vector3::Zero())
91 : nRb_(nRb), p0_(p0), v0_(v0), a_n_(a_n), omega_b_(
omega_b) {}
93 Pose3 pose(
double t)
const override;
94 Vector3 omega_b(
double t)
const override;
95 Vector3 velocity_n(
double t)
const override;
96 Vector3 acceleration_n(
double t)
const override;
100 const Vector3 p0_, v0_, a_n_, omega_b_;
123 const std::map<double, Vector3>& angularVelocities_b,
124 const std::map<double, Vector3>& velocities_n,
125 const std::map<double, Vector3>& accelerations_n)
127 angularVelocities_b_(angularVelocities_b),
128 velocities_n_(velocities_n),
129 accelerations_n_(accelerations_n) {
130 if (poses_.empty() || angularVelocities_b_.empty() ||
131 velocities_n_.empty() || accelerations_n_.empty()) {
132 throw std::invalid_argument(
133 "Input maps for DiscreteScenario cannot be empty.");
139 double min_t = poses_.begin()->first;
140 double max_t = poses_.rbegin()->first;
142 min_t = std::min(min_t, angularVelocities_b_.begin()->first);
143 max_t = std::max(max_t, angularVelocities_b_.rbegin()->first);
145 min_t = std::min(min_t, velocities_n_.begin()->first);
146 max_t = std::max(max_t, velocities_n_.rbegin()->first);
148 min_t = std::min(min_t, accelerations_n_.begin()->first);
149 max_t = std::max(max_t, accelerations_n_.rbegin()->first);
174 Pose3 pose(
double t)
const override;
175 Vector3 omega_b(
double t)
const override;
176 Vector3 velocity_n(
double t)
const override;
177 Vector3 acceleration_n(
double t)
const override;
181 double duration()
const;
185 std::map<double, Pose3> poses_;
187 std::map<double, Vector3> angularVelocities_b_;
189 std::map<double, Vector3> velocities_n_;
191 std::map<double, Vector3> accelerations_n_;
207 template <
typename T>
208 T
interpolate(
const std::map<double, T>& values,
double t)
const {
210 auto it2 = values.lower_bound(t);
213 if (it2 == values.begin()) {
218 if (it2 == values.end()) {
219 return values.rbegin()->second;
223 auto it1 = std::prev(it2);
225 const double t1 = it1->first;
226 const T& value1 = it1->second;
227 const double t2 = it2->first;
228 const T& value2 = it2->second;
230 const double dt = t2 - t1;
232 if (std::abs(dt) < 1e-9) {
237 const double alpha = (t - t1) / dt;
Base class and basic functions for Lie types.
3D Galilean Group SGal(3) state (attitude, position, velocity, time)
Navigation state composing of attitude, position, and velocity.
Global functions in a separate testing namespace.
Definition chartTesting.h:28
T interpolate(const T &X, const T &Y, double t, typename MakeOptionalJacobian< T, T >::type Hx={}, typename MakeOptionalJacobian< T, T >::type Hy={}, typename MakeOptionalJacobian< T, double >::type Ht={})
Linear interpolation between X and Y by coefficient t.
Definition Lie.h:415
Vector3 Point3
As of GTSAM 4, in order to make GTSAM more lean, it is now possible to just typedef Point3 to Vector3...
Definition Point3.h:38
Point3 cross(const Point3 &p, const Point3 &q, OptionalJacobian< 3, 3 > H1, OptionalJacobian< 3, 3 > H2)
cross product
Definition Point3.cpp:66
Represents an element of the 3D Galilean group SGal(3).
Definition Gal3.h:39
A 3D pose (R,t) : (Rot3,Point3).
Definition Pose3.h:42
Rot3 is a 3D rotation represented as a rotation matrix if the preprocessor symbol GTSAM_USE_QUATERNIO...
Definition Rot3.h:65
Navigation state: Pose (rotation, translation) + velocity Following Barrau20icra, this class belongs ...
Definition NavState.h:45
Simple trajectory simulator.
Definition Scenario.h:35
virtual Pose3 pose(double t) const =0
pose at time t
virtual Vector3 acceleration_n(double t) const =0
acceleration in nav frame
virtual Vector3 velocity_n(double t) const =0
velocity at time t, in nav frame
virtual ~Scenario()
virtual destructor
Definition Scenario.h:38
virtual Vector3 omega_b(double t) const =0
angular velocity in body frame
ConstantTwistScenario(const Vector3 &w, const Vector3 &v, const Pose3 &nTb0=Pose3())
Construct scenario with constant twist [w,v].
Definition Scenario.h:68
Vector3 omega_b(double t) const override
angular velocity in body frame
Definition Scenario.cpp:72
AcceleratingScenario(const Rot3 &nRb, const Point3 &p0, const Vector3 &v0, const Vector3 &a_n, const Vector3 &omega_b=Vector3::Zero())
Construct scenario with constant acceleration in navigation frame and optional angular velocity in bo...
Definition Scenario.h:88
A scenario defined by discrete ground-truth measurements over time.
Definition Scenario.h:113
DiscreteScenario(const std::map< double, Pose3 > &poses, const std::map< double, Vector3 > &angularVelocities_b, const std::map< double, Vector3 > &velocities_n, const std::map< double, Vector3 > &accelerations_n)
Constructor.
Definition Scenario.h:122