gtsam
Loading...
Searching...
No Matches
WnoaStateData.h
Go to the documentation of this file.
1/* ----------------------------------------------------------------------------
2
3 * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4 * Atlanta, Georgia 30332-0415
5 * All Rights Reserved
6 * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7
8 * See LICENSE for the license information
9
10 * -------------------------------------------------------------------------- */
11
20
21#pragma once
22
23#include <gtsam/inference/Key.h>
24
25#include <functional>
26#include <limits>
27
28namespace gtsam {
29
39struct GTSAM_EXPORT StateData {
42 double time;
43
45 StateData() = default;
46
53 StateData(Key pose_in, Key velocity_in, double time_in)
54 : pose(pose_in), velocity(velocity_in), time(time_in) {};
55
63 bool operator<(const StateData& other) const {
64 if (this->time < other.time) return true;
65 if (this->time > other.time) return false;
66 if (this->pose < other.pose) return true;
67 if (this->pose > other.pose) return false;
68 return this->velocity < other.velocity;
69 }
70
76 bool operator>(const StateData& other) const {
77 if (this->time > other.time) return true;
78 if (this->time < other.time) return false;
79 if (this->pose > other.pose) return true;
80 if (this->pose < other.pose) return false;
81 return this->velocity > other.velocity;
82 }
83
85 bool operator<(double time) const { return this->time < time; }
86
88 bool operator>(double time) const { return this->time > time; }
89
97 bool operator==(const StateData& other) const {
98 return (this->pose == other.pose) && (this->velocity == other.velocity);
99 }
100};
101
102} // namespace gtsam
103
111namespace std {
112template <>
113struct hash<gtsam::StateData> {
114 std::size_t operator()(const gtsam::StateData& p) const noexcept {
115 return std::hash<uint64_t>()(p.pose) ^
116 (std::hash<uint64_t>()(p.velocity) << 1);
117 }
118};
119} // namespace std
STL namespace.
Global functions in a separate testing namespace.
Definition chartTesting.h:28
std::uint64_t Key
Integer nonlinear key type.
Definition types.h:43
Lightweight container for states used for continuous-time estimation and interpolation.
Definition WnoaStateData.h:39
bool operator==(const StateData &other) const
Equality compares the identifying keys (pose and velocity).
Definition WnoaStateData.h:97
StateData()=default
Default constructor.
bool operator>(const StateData &other) const
Strict-weak ordering: (time, pose, velocity) descending.
Definition WnoaStateData.h:76
bool operator<(double time) const
Returns true if this state's timestamp is before time.
Definition WnoaStateData.h:85
double time
Timestamp (seconds) associated with this state.
Definition WnoaStateData.h:42
bool operator>(double time) const
Returns true if this state's timestamp is after time.
Definition WnoaStateData.h:88
Key pose
Key of the pose variable.
Definition WnoaStateData.h:40
Key velocity
Key of the velocity variable.
Definition WnoaStateData.h:41
bool operator<(const StateData &other) const
Strict-weak ordering: (time, pose, velocity) ascending.
Definition WnoaStateData.h:63
StateData(Key pose_in, Key velocity_in, double time_in)
Construct a StateData from explicit keys and timestamp.
Definition WnoaStateData.h:53