9 #include <sensor_msgs/PointCloud2.h> 11 #include <nav_msgs/Odometry.h> 17 #include <pcl/point_cloud.h> 18 #include <pcl/point_types.h> 43 double map_resolution = 0.4;
59 ROS_INFO(
"Exact Synchronization Policy chosen for Mapping");
64 ROS_INFO(
"Approximate Synchronization Policy chosen for Mapping");
72 const nav_msgs::OdometryConstPtr & odom,
73 const sensor_msgs::PointCloud2ConstPtr & cloud)
75 pcl::PointCloud<pcl::PointXYZL>::Ptr pointcloud_in(
new pcl::PointCloud<pcl::PointXYZL>());
77 ros::Time pointcloud_time = cloud->header.stamp;
79 Eigen::Isometry3d current_pose = Eigen::Isometry3d::Identity();
83 odom->pose.pose.orientation.w,
84 odom->pose.pose.orientation.x,
85 odom->pose.pose.orientation.y,
86 odom->pose.pose.orientation.z));
88 current_pose.pretranslate(
90 odom->pose.pose.position.x,
91 odom->pose.pose.position.y,
92 odom->pose.pose.position.z));
95 pcl::PointCloud<pcl::PointXYZL>::Ptr pc_map(
new pcl::PointCloud<pcl::PointXYZL>());
97 sensor_msgs::PointCloud2 PointsMsg;
99 PointsMsg.header.stamp = pointcloud_time;
100 PointsMsg.header.frame_id =
"map";
void init(const double &map_resolution)
message_filters::sync_policies::ApproximateTime< nav_msgs::Odometry, sensor_msgs::PointCloud2 > ApproximateSyncPolicy
message_filters::sync_policies::ExactTime< nav_msgs::Odometry, sensor_msgs::PointCloud2 > ExactSyncPolicy
void fromROSMsg(const sensor_msgs::PointCloud2 &cloud, pcl::PointCloud< T > &pcl_cloud)
ros::NodeHandle m_nodeHandle
ros::NodeHandle & getPrivateNodeHandle() const
std::shared_ptr< ApproximateSynchronizer > m_approximateSync
LidarMapping m_lidarMapping
message_filters::Synchronizer< ExactSyncPolicy > ExactSynchronizer
void publish(const boost::shared_ptr< M > &message) const
void updateCurrentPointsToMap(const pcl::PointCloud< pcl::PointXYZL >::Ptr &pc_in, const Eigen::Isometry3d &pose_current)
bool getParam(const std::string &key, std::string &s) const
std::shared_ptr< ExactSynchronizer > m_exactSync
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
pcl::PointCloud< pcl::PointXYZL >::Ptr getMap(void)
message_filters::Subscriber< sensor_msgs::PointCloud2 > m_subPoints
void subscribe(ros::NodeHandle &nh, const std::string &topic, uint32_t queue_size, const ros::TransportHints &transport_hints=ros::TransportHints(), ros::CallbackQueueInterface *callback_queue=0)
message_filters::Subscriber< nav_msgs::Odometry > m_subOdom
void toROSMsg(const sensor_msgs::PointCloud2 &cloud, sensor_msgs::Image &image)
void generateMap(const nav_msgs::OdometryConstPtr &odom, const sensor_msgs::PointCloud2ConstPtr &cloud)
PLUGINLIB_EXPORT_CLASS(floam::lidar::LidarMappingNode, nodelet::Nodelet)
Major rewrite Author: Evan Flynn.
message_filters::Synchronizer< ApproximateSyncPolicy > ApproximateSynchronizer