chore: Remove copy-pasted nodes

This commit is contained in:
2025-11-28 20:14:33 +01:00
parent bc26f2a024
commit 0ff842df30
2 changed files with 0 additions and 91 deletions

View File

@@ -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<Simulator>(this, wheels_);
wheel_publisher_ = this->create_publisher<std_msgs::msg::Float64MultiArray>("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<int>(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<std_msgs::msg::Float64MultiArray>();
// 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

View File

@@ -1,33 +0,0 @@
#pragma once
#include "rclcpp/rclcpp.hpp"
#include "std_msgs/msg/float64_multi_array.hpp"
#include "simulator/Simulator.hpp"
#include <vector>
#include <string>
#include <map>
#include <memory>
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<std_msgs::msg::Float64MultiArray>::SharedPtr wheel_publisher_;
rclcpp::TimerBase::SharedPtr timer_;
rclcpp::Time start_time_;
std::vector<std::string> wheels_;
std::unique_ptr<Simulator> simulator_;
void publish_wheel_data();
};
} // namespace assignments::three::wheel_data_simulator_node