mirror of
https://github.com/modelec/modelec-marcel-ROS.git
synced 2026-01-18 16:47:43 +01:00
Add LidarController implementation and update .gitignore
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -105,4 +105,3 @@ AMENT_IGNORE
|
||||
|
||||
.vscode
|
||||
.cache
|
||||
src/modelec/src
|
||||
22
src/modelec/src/lidar_controller.cpp
Normal file
22
src/modelec/src/lidar_controller.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#include <modelec/lidar_controller.hpp>
|
||||
|
||||
namespace Modelec {
|
||||
LidarController::LidarController() : Node("lidar_controller") {
|
||||
subscription_ = this->create_subscription<sensor_msgs::msg::LaserScan>(
|
||||
"scan", 10, [this](const sensor_msgs::msg::LaserScan::SharedPtr msg) {
|
||||
processLidarData(msg);
|
||||
});
|
||||
}
|
||||
|
||||
void LidarController::processLidarData(const sensor_msgs::msg::LaserScan::SharedPtr msg) {
|
||||
// Process the received LiDAR data
|
||||
RCLCPP_INFO(this->get_logger(), "Received LiDAR data: %s", msg->header.frame_id.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
rclcpp::init(argc, argv);
|
||||
rclcpp::spin(std::make_shared<Modelec::LidarController>());
|
||||
rclcpp::shutdown();
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user