3#include <gtsam/geometry/Pose2.h>
4#include <gtsam/inference/Symbol.h>
5#include <gtsam/nonlinear/NonlinearFactorGraph.h>
6#include <gtsam/nonlinear/Values.h>
25 gtsam::NonlinearFactorGraph
63 std::shared_ptr<GraphSLAMInstance>
clone()
const {
64 return std::make_shared<GraphSLAMInstance>(*
this);
137 double preloaded_map_noise);
146 void process_new_pose(
const Eigen::Vector3d& pose_difference,
const Eigen::Vector3d& noise_vector,
147 const Eigen::Vector3d& new_pose,
const rclcpp::Time& pose_timestamp);
157 const Eigen::Vector3d& noise_vector,
unsigned int before_pose_id,
158 unsigned int after_pose_id);
168 const Eigen::Vector3d& noise_vector,
unsigned int before_pose_id);
177 const Eigen::Vector3d& noise_vector);
Graph SLAM instance class - class to hold the factor graph and the values.
unsigned int get_landmark_id_at_time(const rclcpp::Time ×tamp) const
const gtsam::Values & get_graph_values_reference() const
Get the graph values reference.
gtsam::Values _graph_values_
unsigned int get_landmark_counter() const
Get the number of landmarks.
GraphSLAMInstance & operator=(const GraphSLAMInstance &other)
bool _new_observation_factors_
Eigen::VectorXd get_state_vector() const
Get the state vector, EKF style.
unsigned int get_pose_counter() const
Get the number of poses.
void lock_landmarks()
Soft locks the positions of the landmarks, can be used after the first lap.
bool new_pose_factors() const
Checks if new observation factors should be added.
unsigned int _landmark_counter_
~GraphSLAMInstance()=default
void load_initial_state(const Eigen::VectorXd &map, const Eigen::Vector3d &pose, double preloaded_map_noise)
Loads a map and an initial pose into the graph.
gtsam::NonlinearFactorGraph _factor_graph_
void process_observations(const ObservationData &observation_data)
Add observation factors to the graph.
void process_pose_difference(const Eigen::Vector3d &pose_difference, const Eigen::Vector3d &noise_vector, unsigned int before_pose_id, unsigned int after_pose_id)
Process a pose difference and add the respective factor to the graph.
void process_new_pose(const Eigen::Vector3d &pose_difference, const Eigen::Vector3d &noise_vector, const Eigen::Vector3d &new_pose, const rclcpp::Time &pose_timestamp)
Process a new pose and respective pose difference.
std::shared_ptr< BaseOptimizer > _optimizer_
std::shared_ptr< GraphSLAMInstance > clone() const
Clone the graph SLAM instance.
void optimize()
Runs optimization on the graph.
const gtsam::Pose2 get_pose() const
Get the current pose estimate.
unsigned int _pose_counter_
CircularBuffer< TimedPose > _pose_timestamps_
GraphSLAMInstance()=default
bool new_observation_factors() const
Checks if it is worth running optimization.
Eigen::MatrixXd get_covariance_matrix() const
Get the covariance matrix of the graph.
Struct containing observation data.
Parameters for the SLAM node.