|
Formula Student Autonomous Systems
The code for the main driverless system
|
Graph SLAM solver class. More...
#include <graph_slam_solver.hpp>


Public Member Functions | |
| GraphSLAMSolver (const SLAMParameters ¶ms, std::shared_ptr< DataAssociationModel > data_association, std::shared_ptr< V2PMotionModel > motion_model, std::shared_ptr< LandmarkFilter > landmark_filter, std::shared_ptr< std::vector< double > > execution_times, std::shared_ptr< LoopClosure > loop_closure) | |
| Construct a new GraphSLAMSolver object. | |
| ~GraphSLAMSolver ()=default | |
| void | init (std::weak_ptr< rclcpp::Node > node) override |
| Initialize the SLAM solver. | |
| void | add_velocities (const common_lib::structures::Velocities &velocities) override |
| Process new velocities data (prediction step) | |
| void | add_odometry (const common_lib::structures::Pose &pose_difference) override |
| Add odometry data to the solver (for prediction step) | |
| void | add_imu_data (const common_lib::sensor_data::ImuData &imu_data) override |
| Add IMU data to the solver. | |
| void | add_observations (const std::vector< common_lib::structures::Cone > &cones, rclcpp::Time cones_timestamp) override |
| Add observations to the solver (correction step) | |
| void | load_initial_state (const Eigen::VectorXd &map, const Eigen::Vector3d &pose) override |
| Initialize the graph SLAM solver with a previously saved map and pose. | |
| std::vector< common_lib::structures::Cone > | get_map_estimate () override |
| Get the map estimate object. | |
| common_lib::structures::Pose | get_pose_estimate () override |
| Get the pose estimate object. | |
| std::vector< common_lib::structures::Pose > | get_trajectory_estimate () override |
| Get the trajectory estimate of the car (all poses) | |
| Eigen::MatrixXd | get_covariance () override |
| Get the covariance matrix of the graph. | |
| int | get_lap_counter () override |
| Get the lap counter. | |
| Eigen::VectorXi | get_associations () const override |
| Eigen::VectorXd | get_observations_global () const override |
| Eigen::VectorXd | get_map_coordinates () const override |
Public Member Functions inherited from SLAMSolver | |
| SLAMSolver (const SLAMParameters ¶ms, std::shared_ptr< DataAssociationModel > data_association, std::shared_ptr< V2PMotionModel > motion_model, std::shared_ptr< LandmarkFilter > landmark_filter, std::shared_ptr< std::vector< double > > execution_times, std::shared_ptr< LoopClosure > loop_closure) | |
| Construct a new SLAMSolver object. | |
| virtual | ~SLAMSolver ()=default |
| void | set_mission (common_lib::competition_logic::Mission mission) |
| Set the mission. | |
Public Member Functions inherited from VelocitiesIntegratorTrait | |
| virtual | ~VelocitiesIntegratorTrait ()=default |
Public Member Functions inherited from OdometryIntegratorTrait | |
| virtual | ~OdometryIntegratorTrait ()=default |
Public Member Functions inherited from ImuIntegratorTrait | |
| virtual | ~ImuIntegratorTrait ()=default |
Public Member Functions inherited from NodeControllerTrait | |
| virtual | ~NodeControllerTrait ()=default |
Private Member Functions | |
| void | _asynchronous_optimization_routine () |
| Asynchronous optimization routine. | |
| bool | _add_motion_data_to_graph (const std::shared_ptr< PoseUpdater > pose_updater, const std::shared_ptr< GraphSLAMInstance > graph_slam_instance, bool force_update=false) |
| Adds motion data to the graph if the pose updater is ready. | |
Private Attributes | |
| std::shared_ptr< GraphSLAMInstance > | _graph_slam_instance_ |
| std::shared_ptr< PoseUpdater > | _pose_updater_ |
| std::shared_ptr< OdometryModel > | _odometry_model |
| std::queue< MotionData > | _motion_data_queue_ |
| std::queue< ObservationData > | _observation_data_queue_ |
| rclcpp::TimerBase::SharedPtr | _optimization_timer_ |
| std::shared_mutex | _mutex_ |
| bool | _optimization_under_way_ = false |
| Eigen::VectorXi | _associations_ |
| Eigen::VectorXd | _observations_global_ |
| Eigen::VectorXd | _map_coordinates_ |
| common_lib::sensor_data::ImuData | _last_imu_data_ |
| rclcpp::CallbackGroup::SharedPtr | _reentrant_group_ |
Friends | |
| class | GraphSlamSolverTest_MotionAndObservation_Test |
Additional Inherited Members | |
Protected Attributes inherited from SLAMSolver | |
| SLAMParameters | _params_ |
| std::shared_ptr< DataAssociationModel > | _data_association_ |
| std::shared_ptr< V2PMotionModel > | _motion_model_ |
| std::shared_ptr< LandmarkFilter > | _landmark_filter_ |
| common_lib::competition_logic::Mission | _mission_ = common_lib::competition_logic::Mission::NONE |
| std::shared_ptr< std::vector< double > > | _execution_times_ |
| std::shared_ptr< LoopClosure > | _loop_closure_ |
| rclcpp::Time | _last_pose_update_ = rclcpp::Time(0) |
| rclcpp::Time | _last_observation_update_ = rclcpp::Time(0) |
| bool | _received_first_velocities_ |
| int | lap_counter_ = 0 |
Graph SLAM solver class.
This class implements the Graph SLAM solver using GTSAM It uses a factor graph to represent the problem and the values to store the estimates This specific class controls the access to the models used in the SLAM implementation, including measures for parallel execution
Definition at line 31 of file graph_slam_solver.hpp.
| GraphSLAMSolver::GraphSLAMSolver | ( | const SLAMParameters & | params, |
| std::shared_ptr< DataAssociationModel > | data_association, | ||
| std::shared_ptr< V2PMotionModel > | motion_model, | ||
| std::shared_ptr< LandmarkFilter > | landmark_filter, | ||
| std::shared_ptr< std::vector< double > > | execution_times, | ||
| std::shared_ptr< LoopClosure > | loop_closure | ||
| ) |
Construct a new GraphSLAMSolver object.
| params | Parameters for the SLAM solver |
| data_association | Data association module |
| motion_model | Motion model |
| execution_times | Timekeeping array |
Definition at line 27 of file graph_slam_solver.cpp.
|
default |
|
private |
Adds motion data to the graph if the pose updater is ready.
This method checks if the pose updater has a new pose to add to the graph If so, it adds the new pose to the graph and resets the pose updater's accumulated pose difference
| pose_updater | Pose updater to get the new pose from |
| graph_slam_instance | Graph SLAM instance to add the new pose to |
| force_update | If true, forces the update even if the pose updater is not ready |
Definition at line 64 of file graph_slam_solver.cpp.


|
private |
Asynchronous optimization routine.
This method is used to run the optimization in a separate thread It is called by the timer and runs the optimization on the graph It also updates the pose and the graph values accordingly afterwards
Definition at line 301 of file graph_slam_solver.cpp.


|
overridevirtual |
Add IMU data to the solver.
| imu_data | IMU data |
Implements ImuIntegratorTrait.
Definition at line 164 of file graph_slam_solver.cpp.
|
overridevirtual |
Add observations to the solver (correction step)
| cones | Positions of the observations |
| cones_timestamp | Timestamp of the observations |
Implements SLAMSolver.
Definition at line 168 of file graph_slam_solver.cpp.

|
overridevirtual |
Add odometry data to the solver (for prediction step)
It calls the pose updater using the motion model to predict the new pose and may add the motion data to the graph
| pose_difference | Pose difference in the form of [dx, dy, dtheta] |
Implements OdometryIntegratorTrait.
Definition at line 83 of file graph_slam_solver.cpp.

|
overridevirtual |
Process new velocities data (prediction step)
It calls the pose updater using the motion model to predict the new pose and may add the motion data to the graph
| velocities | Velocities data |
Implements SLAMSolver.
Definition at line 120 of file graph_slam_solver.cpp.

|
overridevirtual |
Implements SLAMSolver.
Definition at line 441 of file graph_slam_solver.cpp.
|
overridevirtual |
Get the covariance matrix of the graph.
Implements SLAMSolver.
Definition at line 436 of file graph_slam_solver.cpp.
|
inlineoverridevirtual |
Get the lap counter.
Implements SLAMSolver.
Definition at line 183 of file graph_slam_solver.hpp.
|
overridevirtual |
Implements SLAMSolver.
Definition at line 451 of file graph_slam_solver.cpp.
|
overridevirtual |
Get the map estimate object.
Implements SLAMSolver.
Definition at line 381 of file graph_slam_solver.cpp.
|
overridevirtual |
Implements SLAMSolver.
Definition at line 446 of file graph_slam_solver.cpp.
|
overridevirtual |
Get the pose estimate object.
Implements SLAMSolver.
Definition at line 410 of file graph_slam_solver.cpp.
|
overridevirtual |
Get the trajectory estimate of the car (all poses)
Implements TrajectoryCalculator.
Definition at line 421 of file graph_slam_solver.cpp.
|
overridevirtual |
Initialize the SLAM solver.
This method is used to initialize the SLAM solver's aspects that require the node e.g. timer callbacks
| node | ROS2 node |
Implements NodeControllerTrait.
Definition at line 41 of file graph_slam_solver.cpp.
|
overridevirtual |
Initialize the graph SLAM solver with a previously saved map and pose.
| map | Coordinates of the landmarks in the form of [x1, y1, x2, y2, ...] relative to the global frame |
| pose | Pose of the robot in the form of [x, y, theta] relative to the global frame |
Implements SLAMSolver.
Definition at line 296 of file graph_slam_solver.cpp.
|
friend |
Definition at line 80 of file graph_slam_solver.hpp.
|
private |
Definition at line 49 of file graph_slam_solver.hpp.
|
private |
Definition at line 37 of file graph_slam_solver.hpp.
|
private |
Definition at line 53 of file graph_slam_solver.hpp.
|
private |
Definition at line 51 of file graph_slam_solver.hpp.
|
private |
Definition at line 42 of file graph_slam_solver.hpp.
|
mutableprivate |
Definition at line 47 of file graph_slam_solver.hpp.
|
private |
Definition at line 44 of file graph_slam_solver.hpp.
|
private |
Definition at line 50 of file graph_slam_solver.hpp.
|
private |
Definition at line 40 of file graph_slam_solver.hpp.
|
private |
Definition at line 45 of file graph_slam_solver.hpp.
|
private |
Definition at line 48 of file graph_slam_solver.hpp.
|
private |
Definition at line 38 of file graph_slam_solver.hpp.
|
private |
Definition at line 56 of file graph_slam_solver.hpp.