-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial structure for traversability mapping node
- Loading branch information
Showing
3 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#ifndef TRAVERSABILITY_MAPPING_HPP_ | ||
#define TRAVERSABILITY_MAPPING_HPP_ | ||
|
||
#include <rclcpp/rclcpp.hpp> | ||
#include <sensor_msgs/msg/point_cloud2.hpp> | ||
#include <grid_map_ros/grid_map_ros.hpp> | ||
#include "tf2_ros/transform_listener.h" | ||
#include "tf2_ros/buffer.h" | ||
#include <grid_map_ros/grid_map_ros.hpp> | ||
|
||
namespace urc_perception | ||
{ | ||
|
||
class TraversabilityMapping : public rclcpp::Node | ||
{ | ||
public: | ||
explicit TraversabilityMapping(const rclcpp::NodeOptions &options); | ||
~TraversabilityMapping(); | ||
|
||
private: | ||
void handlePointcloud(const sensor_msgs::msg::PointCloud2::SharedPtr msg); | ||
void initializeMap(); | ||
|
||
rclcpp::Subscription<sensor_msgs::msg::PointCloud2>::SharedPtr lidar_subscriber_; | ||
rclcpp::Publisher<grid_map_msgs::msg::GridMap>::SharedPtr grid_map_publisher_; | ||
|
||
std::unique_ptr<tf2_ros::Buffer> tf_buffer_; | ||
std::shared_ptr<tf2_ros::TransformListener> tf_listener_; | ||
|
||
grid_map::GridMap map_; | ||
|
||
double resolution_; | ||
double min_z_; | ||
double max_z_; | ||
unsigned int width_; | ||
|
||
std::string map_frame_; | ||
}; | ||
|
||
} // namespace urc_perception | ||
|
||
#endif // TRAVERSABILITY_MAPPING_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include "traversability_mapping.hpp" | ||
|
||
#include <pcl_conversions/pcl_conversions.h> | ||
#include <pcl/point_cloud.h> | ||
#include <pcl/point_types.h> | ||
#include <pcl/filters/filter.h> | ||
#include <pcl/PCLPointCloud2.h> | ||
|
||
#include <tf2_sensor_msgs/tf2_sensor_msgs.hpp> | ||
#include <tf2_geometry_msgs/tf2_geometry_msgs.hpp> | ||
#include <geometry_msgs/msg/pose.hpp> | ||
|
||
namespace urc_perception | ||
{ | ||
|
||
TraversabilityMapping::TraversabilityMapping(const rclcpp::NodeOptions &options) | ||
: Node("traversability_mapping", options) | ||
{ | ||
RCLCPP_INFO(this->get_logger(), "Traversability mapping node has been started."); | ||
|
||
tf_buffer_ = std::make_unique<tf2_ros::Buffer>(this->get_clock()); | ||
tf_listener_ = std::make_shared<tf2_ros::TransformListener>(*tf_buffer_); | ||
} | ||
|
||
TraversabilityMapping::~TraversabilityMapping() = default; | ||
|
||
void TraversabilityMapping::handlePointcloud(const sensor_msgs::msg::PointCloud2::SharedPtr msg) | ||
{ | ||
// This function should be called whenever a new point cloud message is received. | ||
// The point cloud message is transformed to the map frame and then processed. | ||
// The resulting traversability map should be published. | ||
} | ||
|
||
void TraversabilityMapping::initializeMap() | ||
{ | ||
// Initialize the map_ object. | ||
} | ||
|
||
} // namespace urc_perception | ||
|
||
#include <rclcpp_components/register_node_macro.hpp> | ||
RCLCPP_COMPONENTS_REGISTER_NODE(urc_perception::TraversabilityMapping) |