From 0ff842df305517ed2b82d342c899c2bc296806f1 Mon Sep 17 00:00:00 2001 From: Wessel Tip Date: Fri, 28 Nov 2025 20:14:33 +0100 Subject: [PATCH] chore: Remove copy-pasted nodes --- .../nodes/wheel_data_simulator.cpp | 58 ------------------- .../nodes/wheel_data_simulator.hpp | 33 ----------- 2 files changed, 91 deletions(-) delete mode 100644 src/g2_2025_odometry_pkg/src/g2_2025_wheel_data_simulator_node/nodes/wheel_data_simulator.cpp delete mode 100644 src/g2_2025_odometry_pkg/src/g2_2025_wheel_data_simulator_node/nodes/wheel_data_simulator.hpp diff --git a/src/g2_2025_odometry_pkg/src/g2_2025_wheel_data_simulator_node/nodes/wheel_data_simulator.cpp b/src/g2_2025_odometry_pkg/src/g2_2025_wheel_data_simulator_node/nodes/wheel_data_simulator.cpp deleted file mode 100644 index 1176a0d..0000000 --- a/src/g2_2025_odometry_pkg/src/g2_2025_wheel_data_simulator_node/nodes/wheel_data_simulator.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include "wheel_data_simulator.hpp" - -namespace assignments::three::wheel_data_simulator_node { - -DataSimulator::DataSimulator() : Node("wheel_data_simulator") { - RCLCPP_INFO(this->get_logger(), "DataSimulator node created"); - - start_time_ = this->now(); - - this->declare_parameter("publish_rate", 10.0); - double rate = this->get_parameter("publish_rate").as_double(); - - wheels_ = { "wheel_fl", "wheel_fr", "wheel_rl", "wheel_rr" }; - - // Simulator loads parameters itself - simulator_ = std::make_unique(this, wheels_); - - wheel_publisher_ = this->create_publisher("simulated_wheel_data", 10); - RCLCPP_INFO(this->get_logger(), "Created wheel Publisher on topic 'simulated_wheel_data'"); - - // Use publish_rate parameter - int timer_ms = static_cast(1000.0 / rate); - RCLCPP_INFO(this->get_logger(), "Publishing at %.1f Hz (every %d ms)", rate, timer_ms); - - timer_ = this->create_wall_timer( - std::chrono::milliseconds(timer_ms), - std::bind(&DataSimulator::publish_wheel_data, this) - ); -} - -DataSimulator::~DataSimulator() { - RCLCPP_INFO(this->get_logger(), "DataSimulator node destroyed"); -} - -void DataSimulator::publish_wheel_data() { - auto wheel_msg = std::make_shared(); - - // Calculate elapsed time since node start - double elapsed_time = (this->now() - start_time_).seconds(); - - // For now, just log wheel values (adjust based on your actual message type) - wheel_msg->data = { - simulator_->get_object_value("wheel_fl", elapsed_time), - simulator_->get_object_value("wheel_fr", elapsed_time), - simulator_->get_object_value("wheel_rl", elapsed_time), - simulator_->get_object_value("wheel_rr", elapsed_time) - }; - - RCLCPP_INFO(this->get_logger(), - "t=%.2fs - Wheel Data [%.3f, %.3f, %.3f, %.3f]", - elapsed_time, - wheel_msg->data[0], wheel_msg->data[1], wheel_msg->data[2], wheel_msg->data[3] - ); - - wheel_publisher_->publish(*wheel_msg); -} - -} // namespace assignments::three::wheel_data_simulator_node diff --git a/src/g2_2025_odometry_pkg/src/g2_2025_wheel_data_simulator_node/nodes/wheel_data_simulator.hpp b/src/g2_2025_odometry_pkg/src/g2_2025_wheel_data_simulator_node/nodes/wheel_data_simulator.hpp deleted file mode 100644 index b3f0012..0000000 --- a/src/g2_2025_odometry_pkg/src/g2_2025_wheel_data_simulator_node/nodes/wheel_data_simulator.hpp +++ /dev/null @@ -1,33 +0,0 @@ -#pragma once - -#include "rclcpp/rclcpp.hpp" -#include "std_msgs/msg/float64_multi_array.hpp" -#include "simulator/Simulator.hpp" -#include -#include -#include -#include - -namespace assignments::three::wheel_data_simulator_node { - -using assignments::three::Simulator; -using assignments::three::IntervalConfig; -using assignments::three::SimType; - -class DataSimulator : public rclcpp::Node { -public: - DataSimulator(); - ~DataSimulator(); -private: - rclcpp::Publisher::SharedPtr wheel_publisher_; - rclcpp::TimerBase::SharedPtr timer_; - rclcpp::Time start_time_; - - std::vector wheels_; - std::unique_ptr simulator_; - - void publish_wheel_data(); - -}; - -} // namespace assignments::three::wheel_data_simulator_node