Swarm-SLAM  1.0.0
C-SLAM Framework
gtsam_utils.h
Go to the documentation of this file.
1 #ifndef GTSAMMSGCONVERSION_H_
2 #define GTSAMMSGCONVERSION_H_
3 
4 #include <rclcpp/rclcpp.hpp>
5 
6 #include <gtsam/geometry/Pose3.h>
7 #include <gtsam/inference/Key.h>
8 #include <gtsam/inference/LabeledSymbol.h>
9 #include <gtsam/linear/NoiseModel.h>
10 #include <gtsam/nonlinear/NonlinearFactorGraph.h>
11 #include <gtsam/nonlinear/Values.h>
12 #include <gtsam/slam/BetweenFactor.h>
13 
14 #include <cslam_common_interfaces/msg/pose_graph.hpp>
15 #include <cslam_common_interfaces/msg/pose_graph_edge.hpp>
16 #include <cslam_common_interfaces/msg/pose_graph_value.hpp>
17 #include <geometry_msgs/msg/transform.hpp>
18 #include <nav_msgs/msg/odometry.hpp>
19 
20 #define GRAPH_LABEL 'g'
21 #define ROBOT_LABEL(id) ('A' + id)
22 #define ROBOT_ID(ch) ((unsigned int)(ch - 'A'))
23 
24 namespace cslam {
25 
32 gtsam::Pose3 odometry_msg_to_pose3(const nav_msgs::msg::Odometry &odom_msg);
33 
40 gtsam::Pose3 transform_msg_to_pose3(const geometry_msgs::msg::Transform &msg);
41 
48 geometry_msgs::msg::Pose gtsam_pose_to_msg(const gtsam::Pose3 &pose);
49 
56 geometry_msgs::msg::Transform
57 gtsam_pose_to_transform_msg(const gtsam::Pose3 &pose);
58 
65 std::vector<cslam_common_interfaces::msg::PoseGraphValue>
66 gtsam_values_to_msg(const gtsam::Values::shared_ptr values);
67 
74 std::vector<cslam_common_interfaces::msg::PoseGraphEdge>
75 gtsam_factors_to_msg(const gtsam::NonlinearFactorGraph::shared_ptr factors);
76 
83 std::vector<cslam_common_interfaces::msg::PoseGraphValue>
84 gtsam_values_to_msg(const gtsam::Values &values);
85 
92 std::vector<cslam_common_interfaces::msg::PoseGraphEdge>
93 gtsam_factors_to_msg(const gtsam::NonlinearFactorGraph &factors);
94 
101 gtsam::Pose3 pose_msg_to_gtsam(const geometry_msgs::msg::Pose &pose);
102 
109 gtsam::Values::shared_ptr values_msg_to_gtsam(
110  const std::vector<cslam_common_interfaces::msg::PoseGraphValue> &values);
111 
118 gtsam::NonlinearFactorGraph::shared_ptr edges_msg_to_gtsam(
119  const std::vector<cslam_common_interfaces::msg::PoseGraphEdge> &edges);
120 
121 } // namespace cslam
122 
123 #endif
Definition: __init__.py:1
gtsam::NonlinearFactorGraph::shared_ptr edges_msg_to_gtsam(const std::vector< cslam_common_interfaces::msg::PoseGraphEdge > &edges)
Converts from ROS 2 message to GTSAM.
gtsam::Pose3 odometry_msg_to_pose3(const nav_msgs::msg::Odometry &odom_msg)
Converts odometry message to gtsam::Pose3.
std::vector< cslam_common_interfaces::msg::PoseGraphValue > gtsam_values_to_msg(const gtsam::Values::shared_ptr values)
Converts from GTSAM to ROS 2 message.
Definition: gtsam_utils.cpp:54
gtsam::Pose3 pose_msg_to_gtsam(const geometry_msgs::msg::Pose &pose)
Converts from ROS 2 message to GTSAM.
gtsam::Values::shared_ptr values_msg_to_gtsam(const std::vector< cslam_common_interfaces::msg::PoseGraphValue > &values)
Converts from ROS 2 message to GTSAM.
gtsam::Pose3 transform_msg_to_pose3(const geometry_msgs::msg::Transform &msg)
Converts a transform msg into a gtsam::Pose3.
Definition: gtsam_utils.cpp:96
geometry_msgs::msg::Pose gtsam_pose_to_msg(const gtsam::Pose3 &pose)
Converts from GTSAM to ROS 2 message.
Definition: gtsam_utils.cpp:5
std::vector< cslam_common_interfaces::msg::PoseGraphEdge > gtsam_factors_to_msg(const gtsam::NonlinearFactorGraph::shared_ptr factors)
Converts from GTSAM to ROS 2 message.
Definition: gtsam_utils.cpp:92
geometry_msgs::msg::Transform gtsam_pose_to_transform_msg(const gtsam::Pose3 &pose)
Converts from GTSAM to ROS 2 message.
Definition: gtsam_utils.cpp:19