|
Formula Student Autonomous Systems
The code for the main driverless system
|
Graph SLAM instance class - class to hold the factor graph and the values. More...
#include <graph_slam_instance.hpp>

Classes | |
| struct | TimedPose |
Public Member Functions | |
| GraphSLAMInstance ()=default | |
| GraphSLAMInstance (const SLAMParameters ¶ms, std::shared_ptr< BaseOptimizer > optimizer) | |
| GraphSLAMInstance (const GraphSLAMInstance &other) | |
| GraphSLAMInstance & | operator= (const GraphSLAMInstance &other) |
| ~GraphSLAMInstance ()=default | |
| std::shared_ptr< GraphSLAMInstance > | clone () const |
| Clone the graph SLAM instance. | |
| bool | new_pose_factors () const |
| Checks if new observation factors should be added. | |
| bool | new_observation_factors () const |
| Checks if it is worth running optimization. | |
| unsigned int | get_landmark_counter () const |
| Get the number of landmarks. | |
| unsigned int | get_pose_counter () const |
| Get the number of poses. | |
| const gtsam::Pose2 | get_pose () const |
| Get the current pose estimate. | |
| const gtsam::Values & | get_graph_values_reference () const |
| Get the graph values reference. | |
| Eigen::VectorXd | get_state_vector () const |
| Get the state vector, EKF style. | |
| Eigen::MatrixXd | get_covariance_matrix () const |
| Get the covariance matrix of the graph. | |
| void | process_observations (const ObservationData &observation_data) |
| Add observation factors to the graph. | |
| 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. | |
| 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. | |
| 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_pose_difference (const Eigen::Vector3d &pose_difference, const Eigen::Vector3d &noise_vector, unsigned int before_pose_id) |
| Process a pose difference and add the respective factor to the graph (after pose is current pose) | |
| void | process_pose_difference (const Eigen::Vector3d &pose_difference, const Eigen::Vector3d &noise_vector) |
| Process a pose difference and add the respective factor to the graph (using current pose and last graphed pose) | |
| void | optimize () |
| Runs optimization on the graph. | |
| void | lock_landmarks () |
| Soft locks the positions of the landmarks, can be used after the first lap. | |
Protected Member Functions | |
| unsigned int | get_landmark_id_at_time (const rclcpp::Time ×tamp) const |
Protected Attributes | |
| gtsam::NonlinearFactorGraph | _factor_graph_ |
| gtsam::Values | _graph_values_ |
| unsigned int | _pose_counter_ = 0 |
| unsigned int | _landmark_counter_ = 0 |
| bool | _new_pose_node_ |
| bool | _new_observation_factors_ |
| bool | _locked_landmarks_ = false |
| SLAMParameters | _params_ |
| std::shared_ptr< BaseOptimizer > | _optimizer_ |
| CircularBuffer< TimedPose > | _pose_timestamps_ |
Graph SLAM instance class - class to hold the factor graph and the values.
This class is used to hold the factor graph and the values for the graph SLAM solver All operations to the factor graph and values are carried out by this object
Definition at line 18 of file graph_slam_instance.hpp.
|
default |
| GraphSLAMInstance::GraphSLAMInstance | ( | const SLAMParameters & | params, |
| std::shared_ptr< BaseOptimizer > | optimizer | ||
| ) |
Definition at line 78 of file graph_slam_instance.cpp.
| GraphSLAMInstance::GraphSLAMInstance | ( | const GraphSLAMInstance & | other | ) |
Definition at line 102 of file graph_slam_instance.cpp.
|
default |
|
inline |
Clone the graph SLAM instance.
This method is used to create a copy of the graph SLAM instance It is useful for polymorphic classes that use pointers
Definition at line 63 of file graph_slam_instance.hpp.
| Eigen::MatrixXd GraphSLAMInstance::get_covariance_matrix | ( | ) | const |
Get the covariance matrix of the graph.
Definition at line 57 of file graph_slam_instance.cpp.
| const gtsam::Values & GraphSLAMInstance::get_graph_values_reference | ( | ) | const |
Get the graph values reference.
Definition at line 26 of file graph_slam_instance.cpp.
| unsigned int GraphSLAMInstance::get_landmark_counter | ( | ) | const |
Get the number of landmarks.
Definition at line 53 of file graph_slam_instance.cpp.
|
protected |
| const gtsam::Pose2 GraphSLAMInstance::get_pose | ( | ) | const |
Get the current pose estimate.
Definition at line 30 of file graph_slam_instance.cpp.
| unsigned int GraphSLAMInstance::get_pose_counter | ( | ) | const |
Get the number of poses.
Definition at line 55 of file graph_slam_instance.cpp.
| Eigen::VectorXd GraphSLAMInstance::get_state_vector | ( | ) | const |
Get the state vector, EKF style.
Definition at line 34 of file graph_slam_instance.cpp.
| void GraphSLAMInstance::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.
| map | Coordinates of the map landmarks in the form of an Eigen vector [x1, y1, x2, y2, ...] |
| pose | Initial pose of the robot in the form of an Eigen vector [x, y, theta] |
| preloaded_map_noise | Noise to apply to the preloaded map landmarks |
Definition at line 257 of file graph_slam_instance.cpp.
| void GraphSLAMInstance::lock_landmarks | ( | ) |
Soft locks the positions of the landmarks, can be used after the first lap.
Definition at line 298 of file graph_slam_instance.cpp.
| bool GraphSLAMInstance::new_observation_factors | ( | ) | const |
Checks if it is worth running optimization.
Definition at line 24 of file graph_slam_instance.cpp.

| bool GraphSLAMInstance::new_pose_factors | ( | ) | const |
Checks if new observation factors should be added.
Definition at line 22 of file graph_slam_instance.cpp.

| GraphSLAMInstance & GraphSLAMInstance::operator= | ( | const GraphSLAMInstance & | other | ) |
Definition at line 116 of file graph_slam_instance.cpp.
| void GraphSLAMInstance::optimize | ( | ) |
Runs optimization on the graph.
This method calls the optimizer to run optimization on the current factor graph
Definition at line 287 of file graph_slam_instance.cpp.
| void GraphSLAMInstance::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.
This method adds a new pose node to the graph values and calls the process_pose_difference method to add the respective pose difference factor to the graph
| pose_difference | Pose difference from the last pose |
| noise_vector | Noise associated with the pose difference |
| new_pose | The new pose to add to the graph |
Definition at line 134 of file graph_slam_instance.cpp.

| void GraphSLAMInstance::process_observations | ( | const ObservationData & | observation_data | ) |
Add observation factors to the graph.
| observation_data | Observation data to add to the graph |
Definition at line 196 of file graph_slam_instance.cpp.

| void GraphSLAMInstance::process_pose_difference | ( | const Eigen::Vector3d & | pose_difference, |
| const Eigen::Vector3d & | noise_vector | ||
| ) |
Process a pose difference and add the respective factor to the graph (using current pose and last graphed pose)
| pose_difference | Pose difference from the last pose |
| noise_vector | Noise associated with the pose difference |
Definition at line 190 of file graph_slam_instance.cpp.

| void GraphSLAMInstance::process_pose_difference | ( | const Eigen::Vector3d & | pose_difference, |
| const Eigen::Vector3d & | noise_vector, | ||
| unsigned int | before_pose_id | ||
| ) |
Process a pose difference and add the respective factor to the graph (after pose is current pose)
| pose_difference | Pose difference from the last pose |
| noise_vector | Noise associated with the pose difference |
| before_pose_id | ID of the pose before the difference (optional) |
Definition at line 183 of file graph_slam_instance.cpp.

| void GraphSLAMInstance::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.
| pose_difference | Pose difference from the last pose |
| noise_vector | Noise associated with the pose difference |
| before_pose_id | ID of the pose before the difference (optional) |
| after_pose_id | ID of the pose after the difference (optional) |
Definition at line 166 of file graph_slam_instance.cpp.


|
protected |
Definition at line 26 of file graph_slam_instance.hpp.
|
protected |
Definition at line 28 of file graph_slam_instance.hpp.
|
protected |
Definition at line 30 of file graph_slam_instance.hpp.
|
protected |
Definition at line 35 of file graph_slam_instance.hpp.
|
protected |
Definition at line 33 of file graph_slam_instance.hpp.
|
protected |
Definition at line 31 of file graph_slam_instance.hpp.
|
protected |
Definition at line 38 of file graph_slam_instance.hpp.
|
protected |
Definition at line 37 of file graph_slam_instance.hpp.
|
protected |
Definition at line 29 of file graph_slam_instance.hpp.
|
protected |
Definition at line 41 of file graph_slam_instance.hpp.