Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00040 #ifndef POSE_GRAPH_KARTO_LASER_CONSTRAINTS_H
00041 #define POSE_GRAPH_KARTO_LASER_CONSTRAINTS_H
00042
00043 #include <graph_slam/constraint_generator.h>
00044 #include <graph_slam/sequential_scan_matcher.h>
00045 #include <graph_slam/loop_scan_matcher.h>
00046 #include <ros/ros.h>
00047 #include <boost/thread.hpp>
00048
00049 namespace graph_slam
00050 {
00051
00052 namespace pg=pose_graph;
00053
00054 typedef boost::shared_ptr<SequentialScanMatcher> SeqMatcherPtr;
00055 typedef boost::shared_ptr<LoopScanMatcher> LoopMatcherPtr;
00056
00057
00058
00059
00060
00061
00062
00063 class KartoLaserConstraints : public ConstraintGenerator
00064 {
00065 public:
00066
00067 KartoLaserConstraints (double max_seq_link_length, unsigned min_seq_chain_length,
00068 double min_seq_link_response, double max_loop_link_length,
00069 unsigned min_loop_chain_length, double min_loop_closure_response,
00070 bool use_covariances);
00071
00072 NodeConstraintVector getConstraints (const pg::PoseGraph& graph, const pg::NodeId new_node,
00073 const NodePoseMap& optimized_poses);
00074 void initializeFromGraph (const pg::PoseGraph& g, const std::vector<pg::NodeId>& node_sequence);
00075 void updateLocalization (const graph_slam::GraphLocalization& loc);
00076
00077 private:
00078
00079 NodeConstraintVector scanOdomConstraints (const pg::PoseGraph& graph, const pg::NodeId new_node,
00080 const geometry_msgs::Pose& pose_estimate,
00081 const NodePoseMap& optimized_poses);
00082 NodeConstraintVector loopConstraints (const pg::PoseGraph& graph, const pg::NodeId new_node,
00083 const geometry_msgs::Pose& pose_estimate,
00084 const NodePoseMap& optimized_poses);
00085 void possiblyInitializeMatchers (const sensor_msgs::LaserScan& scan);
00086
00087 const double max_sequential_link_length_;
00088 const unsigned min_sequential_chain_length_;
00089 const double min_sequential_link_response_;
00090 const double max_loop_link_length_;
00091 const unsigned min_loop_chain_length_;
00092 const double min_loop_closure_response_;
00093 const bool use_covariances_;
00094
00095 ros::NodeHandle nh_;
00096 tf::TransformListener tf_;
00097
00098 SeqMatcherPtr seq_matcher_;
00099 LoopMatcherPtr loop_matcher_;
00100
00101 boost::optional<pg::NodeId> last_ref_node_;
00102
00103
00104
00105
00106 geometry_msgs::Pose ref_node_odom_pose_;
00107 };
00108
00109 }
00110
00111 #endif // include guard