Add LidarController implementation and update .gitignore

This commit is contained in:
acki
2024-12-18 10:53:05 -05:00
parent 8f10d4dbbd
commit e61088fb07
2 changed files with 22 additions and 1 deletions

1
.gitignore vendored
View File

@@ -105,4 +105,3 @@ AMENT_IGNORE
.vscode
.cache
src/modelec/src

View 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;
}