From 3d55f2520d0eb058b52a0cac9e28e8be28fafb77 Mon Sep 17 00:00:00 2001 From: redto0 Date: Sat, 14 Feb 2026 14:55:08 -0500 Subject: [PATCH 01/13] gps waypoint struct --- .../gps_waypoint.hpp | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 include/yet_another_gps_publisher/gps_waypoint.hpp diff --git a/include/yet_another_gps_publisher/gps_waypoint.hpp b/include/yet_another_gps_publisher/gps_waypoint.hpp new file mode 100644 index 0000000..1024a1c --- /dev/null +++ b/include/yet_another_gps_publisher/gps_waypoint.hpp @@ -0,0 +1,30 @@ +#pragma once + +#include +#include + +class gps_waypoint +{ +public: + gps_waypoint() = default; + gps_waypoint(double lon, double lat, const std::string& method, double radius = 0.0); + + double longitude() const { return longitude_; } + double latitude() const { return latitude_; } + const std::string& method() const { return method_; } + double radius() const { return radius_; } + bool enabled() const { return enabled_; } + void setEnabled(bool e) { enabled_ = e; } + + // Odom pose after transformation (set when waypoint is loaded) + void setOdomPose(const geometry_msgs::msg::Pose& pose) { odom_pose_ = pose; } + const geometry_msgs::msg::Pose& odomPose() const { return odom_pose_; } + +private: + double longitude_ = 0.0; + double latitude_ = 0.0; + std::string method_ = "linear"; + double radius_ = 0.0; + bool enabled_ = true; + geometry_msgs::msg::Pose odom_pose_; +}; \ No newline at end of file From 5ca920fddf730c6cee4370ea3029267902213e81 Mon Sep 17 00:00:00 2001 From: redto0 Date: Sat, 14 Feb 2026 14:55:31 -0500 Subject: [PATCH 02/13] spline holder --- .../spline_factory.hpp | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 include/yet_another_gps_publisher/spline_factory.hpp diff --git a/include/yet_another_gps_publisher/spline_factory.hpp b/include/yet_another_gps_publisher/spline_factory.hpp new file mode 100644 index 0000000..dc0057a --- /dev/null +++ b/include/yet_another_gps_publisher/spline_factory.hpp @@ -0,0 +1,30 @@ +#pragma once + +#include +#include +#include +#include +#include +#include "gps_waypoint.hpp" + +namespace gps_waypoint_spline { + +using SplineGenerator = std::function( + const gps_waypoint& start, + const gps_waypoint& end)>; + +class SplineFactory +{ +public: + static void registerGenerator(const std::string& name, SplineGenerator gen); + static SplineGenerator getGenerator(const std::string& name); + static std::vector generate( + const std::string& name, + const gps_waypoint& start, + const gps_waypoint& end); + +private: + static std::map& registry(); +}; + +} // namespace gps_waypoint_spline \ No newline at end of file From 939b43d16f8db58bc22c425410278c76d8830fd8 Mon Sep 17 00:00:00 2001 From: redto0 Date: Sat, 14 Feb 2026 14:55:52 -0500 Subject: [PATCH 03/13] spline factory cpp --- src/spline_methods.cpp | 93 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 src/spline_methods.cpp diff --git a/src/spline_methods.cpp b/src/spline_methods.cpp new file mode 100644 index 0000000..9f0ec32 --- /dev/null +++ b/src/spline_methods.cpp @@ -0,0 +1,93 @@ +#include "yet_another_gps_publisher/spline_factory.hpp" +#include +#include + +namespace gps_waypoint_spline { + +// Factory registry +std::map& SplineFactory::registry() +{ + static std::map reg; + return reg; +} + +void SplineFactory::registerGenerator(const std::string& name, SplineGenerator gen) +{ + registry()[name] = gen; +} + +SplineGenerator SplineFactory::getGenerator(const std::string& name) +{ + auto it = registry().find(name); + if (it == registry().end()) { + throw std::runtime_error("Unknown spline method: " + name); + } + return it->second; +} + +std::vector SplineFactory::generate( + const std::string& name, + const gps_waypoint& start, + const gps_waypoint& end) +{ + return getGenerator(name)(start, end); +} + +// ------------------------------------------------------------------ +// Concrete generators +// ------------------------------------------------------------------ + +static std::vector linearGenerator( + const gps_waypoint& start, + const gps_waypoint& end) +{ + const auto& a = start.odomPose().position; + const auto& b = end.odomPose().position; + + const int num_points = 10; + std::vector points; + points.reserve(num_points + 1); + + for (int i = 0; i <= num_points; ++i) { + double t = static_cast(i) / num_points; + geometry_msgs::msg::Pose p; + p.position.x = a.x + t * (b.x - a.x); + p.position.y = a.y + t * (b.y - a.y); + p.position.z = a.z + t * (b.z - a.z); + p.orientation.w = 1.0; + points.push_back(p); + } + return points; +} + +static std::vector circleGenerator( + const gps_waypoint& start, + const gps_waypoint& end) +{ + double R = end.radius(); + if (R <= 0.0) { + return linearGenerator(start, end); + } + + const auto& a = start.odomPose().position; + const auto& b = end.odomPose().position; + + double dx = b.x - a.x; + double dy = b.y - a.y; + double chord = std::hypot(dx, dy); + + double theta = 2.0 * std::asin(chord / (2.0 * R)); + + // TODO: Replace with actual circular arc interpolation. + // For now, return linear as a fallback. + return linearGenerator(start, end); +} + +// Register generators (runs before main) +static bool registered = []() { + SplineFactory::registerGenerator("linear", linearGenerator); + SplineFactory::registerGenerator("circle", circleGenerator); + return true; +}(); + +} // namespace gps_waypoint_spline \ No newline at end of file From 2aa0ac0aac53f38c0831b1c41c39b6b867707b98 Mon Sep 17 00:00:00 2001 From: redto0 Date: Sat, 14 Feb 2026 14:56:22 -0500 Subject: [PATCH 04/13] node logic --- .../yet_another_gps_publisher_node.hpp | 54 ++++- src/yet_another_gps_publisher_node.cpp | 208 ++++++++++++++++-- 2 files changed, 235 insertions(+), 27 deletions(-) diff --git a/include/yet_another_gps_publisher/yet_another_gps_publisher_node.hpp b/include/yet_another_gps_publisher/yet_another_gps_publisher_node.hpp index 1c7d6b0..41df73a 100644 --- a/include/yet_another_gps_publisher/yet_another_gps_publisher_node.hpp +++ b/include/yet_another_gps_publisher/yet_another_gps_publisher_node.hpp @@ -2,19 +2,53 @@ #include "rclcpp/rclcpp.hpp" #include "std_msgs/msg/string.hpp" +#include "nav_msgs/msg/path.hpp" +#include "nav_msgs/msg/odometry.hpp" +#include "geometry_msgs/msg/pose_stamped.hpp" +#include "tf2_ros/buffer.h" +#include "tf2_ros/transform_listener.h" #include "geodesy/utm.h" +#include "gps_waypoint.hpp" +#include + +class yet_another_gps_publisher : public rclcpp::Node +{ +public: + explicit yet_another_gps_publisher(const rclcpp::NodeOptions& options = rclcpp::NodeOptions()); -// yet_another_gps_publisher_node.cpp -class yet_another_gps_publisher : public rclcpp::Node { private: - rclcpp::Publisher::SharedPtr pub; + // Parameters + double min_spline_length_; + std::string odom_topic_; + std::string waypoint_file_topic_; + std::string utm_frame_id_; + std::string odom_frame_id_; - rclcpp::Subscription::SharedPtr sub; - geodesy::UTMPose currentPose; + // Subscribers + rclcpp::Subscription::SharedPtr odom_sub_; + rclcpp::Subscription::SharedPtr waypoint_file_sub_; -public: - yet_another_gps_publisher(const rclcpp::NodeOptions& options); + // Publisher + rclcpp::Publisher::SharedPtr path_pub_; + + // Timer for periodic spline generation + rclcpp::TimerBase::SharedPtr timer_; + + // TF + tf2_ros::Buffer tf_buffer_; + tf2_ros::TransformListener tf_listener_; + + // Current robot pose in odom frame (from odometry) + geometry_msgs::msg::Pose current_pose_; + + // List of pending waypoints (already transformed to odom) + std::deque waypoints_; + + // Callbacks + void odom_callback(const nav_msgs::msg::Odometry::SharedPtr msg); + void waypoint_file_callback(const std_msgs::msg::String::SharedPtr msg); + void timer_callback(); - /// subscriber callback - void sub_cb(std_msgs::msg::String::SharedPtr msg); -}; + // Helper: transform a waypoint from lat/lon to odom frame using TF + bool transformWaypoint(gps_waypoint& wp); +}; \ No newline at end of file diff --git a/src/yet_another_gps_publisher_node.cpp b/src/yet_another_gps_publisher_node.cpp index 16919da..92e00a5 100644 --- a/src/yet_another_gps_publisher_node.cpp +++ b/src/yet_another_gps_publisher_node.cpp @@ -1,27 +1,201 @@ #include "yet_another_gps_publisher/yet_another_gps_publisher_node.hpp" +#include "yet_another_gps_publisher/spline_factory.hpp" +#include +#include +#include +#include +#include -// For _1 using namespace std::placeholders; -yet_another_gps_publisher::yet_another_gps_publisher(const rclcpp::NodeOptions& options) : Node("yet_another_gps_publisher", options) { - // Parameters - float x = this->declare_parameter("foo", -10.0); +// Constructor +yet_another_gps_publisher::yet_another_gps_publisher(const rclcpp::NodeOptions& options) + : Node("yet_another_gps_publisher", options), + tf_buffer_(this->get_clock()), + tf_listener_(tf_buffer_) +{ + // Declare parameters + min_spline_length_ = this->declare_parameter("min_spline_length", 10.0); + odom_topic_ = this->declare_parameter("odom_topic", "/odometry/filtered"); + waypoint_file_topic_ = this->declare_parameter("waypoint_file_topic", "/waypoint_file"); + utm_frame_id_ = this->declare_parameter("utm_frame_id", "utm"); + odom_frame_id_ = this->declare_parameter("odom_frame_id", "odom"); - // Pub Sub - this->sub = - this->create_subscription("/str", 1, std::bind(&yet_another_gps_publisher::sub_cb, this, _1)); - this->pub = this->create_publisher("/run_folder", 1); + // Subscribers + odom_sub_ = this->create_subscription( + odom_topic_, 10, std::bind(&yet_another_gps_publisher::odom_callback, this, _1)); + waypoint_file_sub_ = this->create_subscription( + waypoint_file_topic_, 1, std::bind(&yet_another_gps_publisher::waypoint_file_callback, this, _1)); - // Log a sample log - RCLCPP_INFO(this->get_logger(), "You passed %f", x); + // Publisher + path_pub_ = this->create_publisher("spline_path", 10); - // Send a sample message - std_msgs::msg::String msg{}; - msg.data = std::string{"Hello World!"}; - pub->publish(msg); + // Timer (1 Hz) + timer_ = this->create_wall_timer( + std::chrono::seconds(1), std::bind(&yet_another_gps_publisher::timer_callback, this)); + + RCLCPP_INFO(this->get_logger(), "yet_another_gps_publisher started"); +} + +// Odom callback +void yet_another_gps_publisher::odom_callback(const nav_msgs::msg::Odometry::SharedPtr msg) +{ + current_pose_ = msg->pose.pose; +} + +// Waypoint file callback +void yet_another_gps_publisher::waypoint_file_callback(const std_msgs::msg::String::SharedPtr msg) +{ + std::string file_path = msg->data; + std::ifstream file(file_path); + if (!file.is_open()) { + RCLCPP_ERROR(this->get_logger(), "Could not open file: %s", file_path.c_str()); + return; + } + + std::string line; + int line_num = 0; + while (std::getline(file, line)) { + line_num++; + if (line.empty() || line[0] == '#') continue; + + std::istringstream iss(line); + double lon, lat, radius = 0.0; + std::string method; + if (!(iss >> lon >> lat >> method)) { + RCLCPP_WARN(this->get_logger(), "Skipping malformed line %d", line_num); + continue; + } + if (method == "circle") { + if (!(iss >> radius)) { + RCLCPP_WARN(this->get_logger(), "Circle method on line %d missing radius, using default 0", line_num); + } + } + + gps_waypoint wp(lon, lat, method, radius); + + // Transform waypoint to odom frame + if (!transformWaypoint(wp)) { + RCLCPP_WARN(this->get_logger(), "Skipping waypoint line %d due to transform failure", line_num); + continue; + } + + waypoints_.push_back(wp); + RCLCPP_INFO(this->get_logger(), "Loaded waypoint %zu: method=%s at (%.6f, %.6f)", + waypoints_.size(), method.c_str(), lon, lat); + } + file.close(); +} + +// Transform waypoint from lat/lon to odom +bool yet_another_gps_publisher::transformWaypoint(gps_waypoint& wp) +{ + // Create a GeoPoint from lat/lon + geographic_msgs::msg::GeoPoint geo; + geo.latitude = wp.latitude(); + geo.longitude = wp.longitude(); + geo.altitude = 0.0; // assume ground level; could be extended + + // Convert to UTM using geodesy + geodesy::UTMPoint utm; + geodesy::fromMsg(geo, utm); // This populates easting, northing, zone, etc. + + geometry_msgs::msg::PoseStamped utm_pose; + utm_pose.header.frame_id = utm_frame_id_; + utm_pose.header.stamp = this->now(); + utm_pose.pose.position.x = utm.easting; + utm_pose.pose.position.y = utm.northing; + utm_pose.pose.position.z = 0.0; + utm_pose.pose.orientation.w = 1.0; + + try { + geometry_msgs::msg::PoseStamped odom_pose = tf_buffer_.transform(utm_pose, odom_frame_id_); + wp.setOdomPose(odom_pose.pose); + return true; + } catch (tf2::TransformException& ex) { + RCLCPP_WARN(this->get_logger(), "Transform failed: %s", ex.what()); + return false; + } } -void yet_another_gps_publisher::sub_cb(const std_msgs::msg::String::SharedPtr msg) { - // Echo message - this->pub->publish(*msg); +// Timer callback: generate and publish spline +void yet_another_gps_publisher::timer_callback() +{ + if (waypoints_.empty()) { + return; + } + + nav_msgs::msg::Path path; + path.header.frame_id = odom_frame_id_; + path.header.stamp = this->now(); + + // Start with current pose + geometry_msgs::msg::PoseStamped start_pose; + start_pose.header = path.header; + start_pose.pose = current_pose_; + path.poses.push_back(start_pose); + + double cumulative_length = 0.0; + // Temporary waypoint for current pose (method irrelevant) + gps_waypoint current_wp; + current_wp.setOdomPose(current_pose_); + current_wp.setEnabled(true); + + size_t used_count = 0; + for (size_t i = 0; i < waypoints_.size(); ++i) { + const auto& wp = waypoints_[i]; + if (!wp.enabled()) continue; + + const gps_waypoint& start_ref = (i == 0) ? current_wp : waypoints_[i-1]; + + std::vector segment; + try { + segment = gps_waypoint_spline::SplineFactory::generate(wp.method(), start_ref, wp); + } catch (const std::exception& e) { + RCLCPP_ERROR(this->get_logger(), "Spline generation failed for method %s: %s", + wp.method().c_str(), e.what()); + break; + } + + // Add segment points (skip first to avoid duplicate with previous end) + for (size_t j = 1; j < segment.size(); ++j) { + geometry_msgs::msg::PoseStamped ps; + ps.header = path.header; + ps.pose = segment[j]; + path.poses.push_back(ps); + } + + // Update cumulative length + for (size_t j = 1; j < segment.size(); ++j) { + const auto& a = segment[j-1].position; + const auto& b = segment[j].position; + cumulative_length += std::hypot(b.x - a.x, b.y - a.y); + } + + used_count = i + 1; + + if (cumulative_length >= min_spline_length_) { + break; + } + } + + if (cumulative_length >= min_spline_length_) { + path_pub_->publish(path); + RCLCPP_INFO(this->get_logger(), "Published spline path, length = %.2f m using %zu waypoints", + cumulative_length, used_count); + // Optionally remove used waypoints: + // waypoints_.erase(waypoints_.begin(), waypoints_.begin() + used_count); + } else { + RCLCPP_DEBUG(this->get_logger(), "Path too short (%.2f < %.2f), not publishing", + cumulative_length, min_spline_length_); + } } + +// gps_waypoint constructor implementation +gps_waypoint::gps_waypoint(double lon, double lat, const std::string& method, double radius) + : longitude_(lon), latitude_(lat), method_(method), radius_(radius), enabled_(true) +{} + +// Register node as a component +#include "rclcpp_components/register_node_macro.hpp" +RCLCPP_COMPONENTS_REGISTER_NODE(yet_another_gps_publisher) \ No newline at end of file From b461bd9810122557b6e87f22c420fb11a4d189d7 Mon Sep 17 00:00:00 2001 From: redto0 Date: Sat, 14 Feb 2026 14:56:56 -0500 Subject: [PATCH 05/13] building hopefully --- CMakeLists.txt | 56 +++++++++++++++++++++++++++----------------------- package.xml | 13 ++++++++++-- 2 files changed, 41 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a42f6ce..b6d8b9e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,58 +9,62 @@ endif () # find dependencies find_package(ament_cmake REQUIRED) find_package(rclcpp REQUIRED) -# Messages TODO_EXTRA find_package(ackermann_msgs REQUIRED) find_package(sensor_msgs REQUIRED) find_package(std_msgs REQUIRED) -# GPS packages find_package(geodesy REQUIRED) +find_package(geographic_msgs REQUIRED) +find_package(geometry_msgs REQUIRED) +find_package(nav_msgs REQUIRED) +find_package(tf2 REQUIRED) +find_package(tf2_ros REQUIRED) +find_package(tf2_geometry_msgs REQUIRED) +find_package(rclcpp_components REQUIRED) -# Add source for node executable (link non-ros dependencies here) -add_executable(yet_another_gps_publisher src/yet_another_gps_publisher.cpp src/yet_another_gps_publisher_node.cpp) +# Optional: print found packages for debugging +message(STATUS "Found tf2: ${tf2_DIR}") +message(STATUS "Found tf2_ros: ${tf2_ros_DIR}") +message(STATUS "Found tf2_geometry_msgs: ${tf2_geometry_msgs_DIR}") + +# Add source for node executable +add_executable(yet_another_gps_publisher + src/yet_another_gps_publisher.cpp + src/yet_another_gps_publisher_node.cpp + src/spline_methods.cpp +) target_include_directories(yet_another_gps_publisher PUBLIC $ $) -target_compile_features(yet_another_gps_publisher PUBLIC c_std_99 cxx_std_17) # Require C99 and C++17 +target_compile_features(yet_another_gps_publisher PUBLIC c_std_99 cxx_std_17) -# Make ros deps a variable so they get linked to tests as well set(dependencies rclcpp - # Messages TODO_EXTRA ackermann_msgs sensor_msgs std_msgs - # GPS Packages geodesy - ) - -# Link ros dependencies -ament_target_dependencies( - yet_another_gps_publisher - ${dependencies} + geographic_msgs + geometry_msgs + nav_msgs + tf2 + tf2_ros + tf2_geometry_msgs + rclcpp_components ) +ament_target_dependencies(yet_another_gps_publisher ${dependencies}) + install(TARGETS yet_another_gps_publisher DESTINATION lib/${PROJECT_NAME}) -# Uncomment below to make launch files available if created -#install( -# DIRECTORY launch config -# DESTINATION share/${PROJECT_NAME}/ -#) - if (BUILD_TESTING) - # Manually invoke clang format so it actually uses our file find_package(ament_cmake_clang_format REQUIRED) ament_clang_format(CONFIG_FILE ${CMAKE_CURRENT_SOURCE_DIR}/.clang-format) - find_package(ament_cmake_gtest REQUIRED) - - # Add unit tests ament_add_gtest(${PROJECT_NAME}-test tests/unit.cpp - # Remember to add node source files src/yet_another_gps_publisher_node.cpp + src/spline_methods.cpp ) ament_target_dependencies(${PROJECT_NAME}-test ${dependencies}) target_include_directories(${PROJECT_NAME}-test PUBLIC @@ -68,4 +72,4 @@ if (BUILD_TESTING) $) endif () -ament_package() +ament_package() \ No newline at end of file diff --git a/package.xml b/package.xml index 09bb41c..0c26058 100644 --- a/package.xml +++ b/package.xml @@ -11,7 +11,7 @@ rclcpp - + ackermann_msgs sensor_msgs std_msgs @@ -19,6 +19,15 @@ geodesy + + geographic_msgs + geometry_msgs + nav_msgs + tf2 + tf2_ros + tf2_geometry_msgs + rclcpp_components + ament_lint_auto ament_cmake_flake8 ament_cmake_xmllint @@ -32,4 +41,4 @@ ament_cmake - + \ No newline at end of file From 977b9e277d98ed794d73e2e58d3a91589f05406a Mon Sep 17 00:00:00 2001 From: redto0 Date: Wed, 18 Feb 2026 23:53:59 -0500 Subject: [PATCH 06/13] making derek happy again + changing the waypoiny file to a parameter not a topic lol --- .../gps_waypoint.hpp | 5 +- .../spline_factory.hpp | 17 ++-- .../yet_another_gps_publisher_node.hpp | 18 +++-- src/spline_methods.cpp | 31 +++---- src/yet_another_gps_publisher_node.cpp | 81 +++++++++---------- 5 files changed, 67 insertions(+), 85 deletions(-) diff --git a/include/yet_another_gps_publisher/gps_waypoint.hpp b/include/yet_another_gps_publisher/gps_waypoint.hpp index 1024a1c..ed9f1aa 100644 --- a/include/yet_another_gps_publisher/gps_waypoint.hpp +++ b/include/yet_another_gps_publisher/gps_waypoint.hpp @@ -1,10 +1,9 @@ #pragma once -#include #include +#include -class gps_waypoint -{ +class gps_waypoint { public: gps_waypoint() = default; gps_waypoint(double lon, double lat, const std::string& method, double radius = 0.0); diff --git a/include/yet_another_gps_publisher/spline_factory.hpp b/include/yet_another_gps_publisher/spline_factory.hpp index dc0057a..e9abbb0 100644 --- a/include/yet_another_gps_publisher/spline_factory.hpp +++ b/include/yet_another_gps_publisher/spline_factory.hpp @@ -1,27 +1,24 @@ #pragma once #include +#include #include #include #include -#include + #include "gps_waypoint.hpp" namespace gps_waypoint_spline { -using SplineGenerator = std::function( - const gps_waypoint& start, - const gps_waypoint& end)>; +using SplineGenerator = + std::function(const gps_waypoint& start, const gps_waypoint& end)>; -class SplineFactory -{ +class SplineFactory { public: static void registerGenerator(const std::string& name, SplineGenerator gen); static SplineGenerator getGenerator(const std::string& name); - static std::vector generate( - const std::string& name, - const gps_waypoint& start, - const gps_waypoint& end); + static std::vector generate(const std::string& name, const gps_waypoint& start, + const gps_waypoint& end); private: static std::map& registry(); diff --git a/include/yet_another_gps_publisher/yet_another_gps_publisher_node.hpp b/include/yet_another_gps_publisher/yet_another_gps_publisher_node.hpp index 41df73a..aa83b8f 100644 --- a/include/yet_another_gps_publisher/yet_another_gps_publisher_node.hpp +++ b/include/yet_another_gps_publisher/yet_another_gps_publisher_node.hpp @@ -1,18 +1,19 @@ #pragma once +#include +#include + +#include "geodesy/utm.h" +#include "geometry_msgs/msg/pose_stamped.hpp" +#include "gps_waypoint.hpp" +#include "nav_msgs/msg/odometry.hpp" +#include "nav_msgs/msg/path.hpp" #include "rclcpp/rclcpp.hpp" #include "std_msgs/msg/string.hpp" -#include "nav_msgs/msg/path.hpp" -#include "nav_msgs/msg/odometry.hpp" -#include "geometry_msgs/msg/pose_stamped.hpp" #include "tf2_ros/buffer.h" #include "tf2_ros/transform_listener.h" -#include "geodesy/utm.h" -#include "gps_waypoint.hpp" -#include -class yet_another_gps_publisher : public rclcpp::Node -{ +class yet_another_gps_publisher : public rclcpp::Node { public: explicit yet_another_gps_publisher(const rclcpp::NodeOptions& options = rclcpp::NodeOptions()); @@ -23,6 +24,7 @@ class yet_another_gps_publisher : public rclcpp::Node std::string waypoint_file_topic_; std::string utm_frame_id_; std::string odom_frame_id_; + std::string waypoint_file_path; // Subscribers rclcpp::Subscription::SharedPtr odom_sub_; diff --git a/src/spline_methods.cpp b/src/spline_methods.cpp index 9f0ec32..5548a0d 100644 --- a/src/spline_methods.cpp +++ b/src/spline_methods.cpp @@ -1,23 +1,19 @@ -#include "yet_another_gps_publisher/spline_factory.hpp" #include #include +#include "yet_another_gps_publisher/spline_factory.hpp" + namespace gps_waypoint_spline { // Factory registry -std::map& SplineFactory::registry() -{ +std::map& SplineFactory::registry() { static std::map reg; return reg; } -void SplineFactory::registerGenerator(const std::string& name, SplineGenerator gen) -{ - registry()[name] = gen; -} +void SplineFactory::registerGenerator(const std::string& name, SplineGenerator gen) { registry()[name] = gen; } -SplineGenerator SplineFactory::getGenerator(const std::string& name) -{ +SplineGenerator SplineFactory::getGenerator(const std::string& name) { auto it = registry().find(name); if (it == registry().end()) { throw std::runtime_error("Unknown spline method: " + name); @@ -25,11 +21,8 @@ SplineGenerator SplineFactory::getGenerator(const std::string& name) return it->second; } -std::vector SplineFactory::generate( - const std::string& name, - const gps_waypoint& start, - const gps_waypoint& end) -{ +std::vector SplineFactory::generate(const std::string& name, const gps_waypoint& start, + const gps_waypoint& end) { return getGenerator(name)(start, end); } @@ -37,10 +30,7 @@ std::vector SplineFactory::generate( // Concrete generators // ------------------------------------------------------------------ -static std::vector linearGenerator( - const gps_waypoint& start, - const gps_waypoint& end) -{ +static std::vector linearGenerator(const gps_waypoint& start, const gps_waypoint& end) { const auto& a = start.odomPose().position; const auto& b = end.odomPose().position; @@ -60,10 +50,7 @@ static std::vector linearGenerator( return points; } -static std::vector circleGenerator( - const gps_waypoint& start, - const gps_waypoint& end) -{ +static std::vector circleGenerator(const gps_waypoint& start, const gps_waypoint& end) { double R = end.radius(); if (R <= 0.0) { return linearGenerator(start, end); diff --git a/src/yet_another_gps_publisher_node.cpp b/src/yet_another_gps_publisher_node.cpp index 92e00a5..02105b3 100644 --- a/src/yet_another_gps_publisher_node.cpp +++ b/src/yet_another_gps_publisher_node.cpp @@ -1,56 +1,54 @@ #include "yet_another_gps_publisher/yet_another_gps_publisher_node.hpp" -#include "yet_another_gps_publisher/spline_factory.hpp" -#include -#include -#include + #include +#include #include +#include +#include + +#include "yet_another_gps_publisher/spline_factory.hpp" using namespace std::placeholders; // Constructor yet_another_gps_publisher::yet_another_gps_publisher(const rclcpp::NodeOptions& options) - : Node("yet_another_gps_publisher", options), - tf_buffer_(this->get_clock()), - tf_listener_(tf_buffer_) -{ + : Node("yet_another_gps_publisher", options), tf_buffer_(this->get_clock()), tf_listener_(tf_buffer_) { // Declare parameters min_spline_length_ = this->declare_parameter("min_spline_length", 10.0); odom_topic_ = this->declare_parameter("odom_topic", "/odometry/filtered"); - waypoint_file_topic_ = this->declare_parameter("waypoint_file_topic", "/waypoint_file"); utm_frame_id_ = this->declare_parameter("utm_frame_id", "utm"); odom_frame_id_ = this->declare_parameter("odom_frame_id", "odom"); + // TODO actually set this parameter from launch file or command line, not hardcoded. + waypoint_file_path = this->declare_parameter("waypoint_file", "waypoints.txt"); // Subscribers odom_sub_ = this->create_subscription( odom_topic_, 10, std::bind(&yet_another_gps_publisher::odom_callback, this, _1)); - waypoint_file_sub_ = this->create_subscription( - waypoint_file_topic_, 1, std::bind(&yet_another_gps_publisher::waypoint_file_callback, this, _1)); // Publisher path_pub_ = this->create_publisher("spline_path", 10); // Timer (1 Hz) - timer_ = this->create_wall_timer( - std::chrono::seconds(1), std::bind(&yet_another_gps_publisher::timer_callback, this)); + timer_ = + this->create_wall_timer(std::chrono::seconds(1), std::bind(&yet_another_gps_publisher::timer_callback, this)); RCLCPP_INFO(this->get_logger(), "yet_another_gps_publisher started"); + + // Load waypoints directly on startup! + load_waypoints(waypoint_file_path); } // Odom callback -void yet_another_gps_publisher::odom_callback(const nav_msgs::msg::Odometry::SharedPtr msg) -{ +void yet_another_gps_publisher::odom_callback(const nav_msgs::msg::Odometry::SharedPtr msg) { current_pose_ = msg->pose.pose; } -// Waypoint file callback -void yet_another_gps_publisher::waypoint_file_callback(const std_msgs::msg::String::SharedPtr msg) -{ - std::string file_path = msg->data; +// Normal function to load waypoints from file on startup +bool yet_another_gps_publisher::load_waypoints(const std::string& file_path) { std::ifstream file(file_path); if (!file.is_open()) { RCLCPP_ERROR(this->get_logger(), "Could not open file: %s", file_path.c_str()); - return; + return false; } std::string line; @@ -61,18 +59,19 @@ void yet_another_gps_publisher::waypoint_file_callback(const std_msgs::msg::Stri std::istringstream iss(line); double lon, lat, radius = 0.0; - std::string method; - if (!(iss >> lon >> lat >> method)) { + std::string spline_type; + + if (!(iss >> lon >> lat >> spline_type)) { RCLCPP_WARN(this->get_logger(), "Skipping malformed line %d", line_num); continue; } - if (method == "circle") { + if (spline_type == "circle") { if (!(iss >> radius)) { RCLCPP_WARN(this->get_logger(), "Circle method on line %d missing radius, using default 0", line_num); } } - gps_waypoint wp(lon, lat, method, radius); + gps_waypoint wp(lon, lat, spline_type, radius); // Transform waypoint to odom frame if (!transformWaypoint(wp)) { @@ -81,24 +80,24 @@ void yet_another_gps_publisher::waypoint_file_callback(const std_msgs::msg::Stri } waypoints_.push_back(wp); - RCLCPP_INFO(this->get_logger(), "Loaded waypoint %zu: method=%s at (%.6f, %.6f)", - waypoints_.size(), method.c_str(), lon, lat); + RCLCPP_INFO(this->get_logger(), "Loaded waypoint %zu: spline_type=%s at (%.6f, %.6f)", waypoints_.size(), + spline_type.c_str(), lon, lat); } file.close(); + return true; } // Transform waypoint from lat/lon to odom -bool yet_another_gps_publisher::transformWaypoint(gps_waypoint& wp) -{ +bool yet_another_gps_publisher::transformWaypoint(gps_waypoint& wp) { // Create a GeoPoint from lat/lon geographic_msgs::msg::GeoPoint geo; geo.latitude = wp.latitude(); geo.longitude = wp.longitude(); - geo.altitude = 0.0; // assume ground level; could be extended + geo.altitude = 0.0; // assume ground level; could be extended // Convert to UTM using geodesy geodesy::UTMPoint utm; - geodesy::fromMsg(geo, utm); // This populates easting, northing, zone, etc. + geodesy::fromMsg(geo, utm); // This populates easting, northing, zone, etc. geometry_msgs::msg::PoseStamped utm_pose; utm_pose.header.frame_id = utm_frame_id_; @@ -119,8 +118,7 @@ bool yet_another_gps_publisher::transformWaypoint(gps_waypoint& wp) } // Timer callback: generate and publish spline -void yet_another_gps_publisher::timer_callback() -{ +void yet_another_gps_publisher::timer_callback() { if (waypoints_.empty()) { return; } @@ -146,14 +144,14 @@ void yet_another_gps_publisher::timer_callback() const auto& wp = waypoints_[i]; if (!wp.enabled()) continue; - const gps_waypoint& start_ref = (i == 0) ? current_wp : waypoints_[i-1]; + const gps_waypoint& start_ref = (i == 0) ? current_wp : waypoints_[i - 1]; std::vector segment; try { segment = gps_waypoint_spline::SplineFactory::generate(wp.method(), start_ref, wp); } catch (const std::exception& e) { - RCLCPP_ERROR(this->get_logger(), "Spline generation failed for method %s: %s", - wp.method().c_str(), e.what()); + RCLCPP_ERROR(this->get_logger(), "Spline generation failed for method %s: %s", wp.method().c_str(), + e.what()); break; } @@ -167,7 +165,7 @@ void yet_another_gps_publisher::timer_callback() // Update cumulative length for (size_t j = 1; j < segment.size(); ++j) { - const auto& a = segment[j-1].position; + const auto& a = segment[j - 1].position; const auto& b = segment[j].position; cumulative_length += std::hypot(b.x - a.x, b.y - a.y); } @@ -181,20 +179,19 @@ void yet_another_gps_publisher::timer_callback() if (cumulative_length >= min_spline_length_) { path_pub_->publish(path); - RCLCPP_INFO(this->get_logger(), "Published spline path, length = %.2f m using %zu waypoints", - cumulative_length, used_count); + RCLCPP_INFO(this->get_logger(), "Published spline path, length = %.2f m using %zu waypoints", cumulative_length, + used_count); // Optionally remove used waypoints: // waypoints_.erase(waypoints_.begin(), waypoints_.begin() + used_count); } else { - RCLCPP_DEBUG(this->get_logger(), "Path too short (%.2f < %.2f), not publishing", - cumulative_length, min_spline_length_); + RCLCPP_DEBUG(this->get_logger(), "Path too short (%.2f < %.2f), not publishing", cumulative_length, + min_spline_length_); } } // gps_waypoint constructor implementation gps_waypoint::gps_waypoint(double lon, double lat, const std::string& method, double radius) - : longitude_(lon), latitude_(lat), method_(method), radius_(radius), enabled_(true) -{} + : longitude_(lon), latitude_(lat), method_(method), radius_(radius), enabled_(true) {} // Register node as a component #include "rclcpp_components/register_node_macro.hpp" From f72062602a90a687c1efc13db614efbc73a5b71f Mon Sep 17 00:00:00 2001 From: redto0 Date: Wed, 18 Feb 2026 23:56:00 -0500 Subject: [PATCH 07/13] =?UTF-8?q?adding=20in=20the=20load=20waypoints=20to?= =?UTF-8?q?=20hpp=20again=20=F0=9F=98=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yet_another_gps_publisher_node.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/yet_another_gps_publisher/yet_another_gps_publisher_node.hpp b/include/yet_another_gps_publisher/yet_another_gps_publisher_node.hpp index aa83b8f..229ca4e 100644 --- a/include/yet_another_gps_publisher/yet_another_gps_publisher_node.hpp +++ b/include/yet_another_gps_publisher/yet_another_gps_publisher_node.hpp @@ -48,9 +48,11 @@ class yet_another_gps_publisher : public rclcpp::Node { // Callbacks void odom_callback(const nav_msgs::msg::Odometry::SharedPtr msg); - void waypoint_file_callback(const std_msgs::msg::String::SharedPtr msg); void timer_callback(); + // helper to load waypoints from file + bool load_waypoints(const std::string& file_path); + // Helper: transform a waypoint from lat/lon to odom frame using TF bool transformWaypoint(gps_waypoint& wp); }; \ No newline at end of file From dccdac66e2aef22568c718882dcf64a1d23abce3 Mon Sep 17 00:00:00 2001 From: redto0 Date: Thu, 19 Feb 2026 00:07:37 -0500 Subject: [PATCH 08/13] TODO comments lol --- src/yet_another_gps_publisher_node.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/yet_another_gps_publisher_node.cpp b/src/yet_another_gps_publisher_node.cpp index 02105b3..1e6e44e 100644 --- a/src/yet_another_gps_publisher_node.cpp +++ b/src/yet_another_gps_publisher_node.cpp @@ -29,6 +29,7 @@ yet_another_gps_publisher::yet_another_gps_publisher(const rclcpp::NodeOptions& path_pub_ = this->create_publisher("spline_path", 10); // Timer (1 Hz) + // TODO remove this the call back will be the navsat transform from the gps lol. timer_ = this->create_wall_timer(std::chrono::seconds(1), std::bind(&yet_another_gps_publisher::timer_callback, this)); @@ -182,6 +183,7 @@ void yet_another_gps_publisher::timer_callback() { RCLCPP_INFO(this->get_logger(), "Published spline path, length = %.2f m using %zu waypoints", cumulative_length, used_count); // Optionally remove used waypoints: + // DO NOT REMOVE WATPOINTS CHAT // waypoints_.erase(waypoints_.begin(), waypoints_.begin() + used_count); } else { RCLCPP_DEBUG(this->get_logger(), "Path too short (%.2f < %.2f), not publishing", cumulative_length, @@ -194,5 +196,6 @@ gps_waypoint::gps_waypoint(double lon, double lat, const std::string& method, do : longitude_(lon), latitude_(lat), method_(method), radius_(radius), enabled_(true) {} // Register node as a component +// todo chat why are we evening using this #include "rclcpp_components/register_node_macro.hpp" RCLCPP_COMPONENTS_REGISTER_NODE(yet_another_gps_publisher) \ No newline at end of file From 8d07dc7ef67ec080355f796b17eb04a61cd43d16 Mon Sep 17 00:00:00 2001 From: redto0 Date: Thu, 19 Feb 2026 00:59:54 -0500 Subject: [PATCH 09/13] =?UTF-8?q?updates=20to=20the=20slop=20=F0=9F=98=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/yet_another_gps_publisher_node.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/yet_another_gps_publisher_node.cpp b/src/yet_another_gps_publisher_node.cpp index 1e6e44e..bdc6e81 100644 --- a/src/yet_another_gps_publisher_node.cpp +++ b/src/yet_another_gps_publisher_node.cpp @@ -8,8 +8,6 @@ #include "yet_another_gps_publisher/spline_factory.hpp" -using namespace std::placeholders; - // Constructor yet_another_gps_publisher::yet_another_gps_publisher(const rclcpp::NodeOptions& options) : Node("yet_another_gps_publisher", options), tf_buffer_(this->get_clock()), tf_listener_(tf_buffer_) { @@ -23,19 +21,20 @@ yet_another_gps_publisher::yet_another_gps_publisher(const rclcpp::NodeOptions& // Subscribers odom_sub_ = this->create_subscription( - odom_topic_, 10, std::bind(&yet_another_gps_publisher::odom_callback, this, _1)); + odom_topic_, 10, std::bind(&yet_another_gps_publisher::odom_callback, this, std::placeholders::_1)); // Publisher - path_pub_ = this->create_publisher("spline_path", 10); + path_pub_ = this->create_publisher("/path", 5); // Timer (1 Hz) - // TODO remove this the call back will be the navsat transform from the gps lol. + // TODO remove this the call back will be the navsat transform from the gps lol. timer_ = this->create_wall_timer(std::chrono::seconds(1), std::bind(&yet_another_gps_publisher::timer_callback, this)); RCLCPP_INFO(this->get_logger(), "yet_another_gps_publisher started"); // Load waypoints directly on startup! + // TODO catch failure and maybe retry later if file not found, instead of just crashing or doing nothing. load_waypoints(waypoint_file_path); } @@ -44,7 +43,7 @@ void yet_another_gps_publisher::odom_callback(const nav_msgs::msg::Odometry::Sha current_pose_ = msg->pose.pose; } -// Normal function to load waypoints from file on startup +// standard function to load waypoints from file on startup bool yet_another_gps_publisher::load_waypoints(const std::string& file_path) { std::ifstream file(file_path); if (!file.is_open()) { @@ -94,7 +93,8 @@ bool yet_another_gps_publisher::transformWaypoint(gps_waypoint& wp) { geographic_msgs::msg::GeoPoint geo; geo.latitude = wp.latitude(); geo.longitude = wp.longitude(); - geo.altitude = 0.0; // assume ground level; could be extended + geo.altitude = 0.0; // assume ground level. Will not support altiude, ever. + // this is a GROUND nav robot lmao -redtoo // Convert to UTM using geodesy geodesy::UTMPoint utm; @@ -196,6 +196,6 @@ gps_waypoint::gps_waypoint(double lon, double lat, const std::string& method, do : longitude_(lon), latitude_(lat), method_(method), radius_(radius), enabled_(true) {} // Register node as a component -// todo chat why are we evening using this +// todo chat why are we evening using this #include "rclcpp_components/register_node_macro.hpp" RCLCPP_COMPONENTS_REGISTER_NODE(yet_another_gps_publisher) \ No newline at end of file From e9480317757316ef3153bceef6834e88e2202e94 Mon Sep 17 00:00:00 2001 From: redto0 Date: Thu, 26 Feb 2026 19:12:13 -0500 Subject: [PATCH 10/13] removing _; because I dont like them --- .../gps_waypoint.hpp | 14 +++++----- .../yet_another_gps_publisher_node.hpp | 26 +++++++++---------- src/yet_another_gps_publisher_node.cpp | 6 ++--- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/include/yet_another_gps_publisher/gps_waypoint.hpp b/include/yet_another_gps_publisher/gps_waypoint.hpp index ed9f1aa..2527257 100644 --- a/include/yet_another_gps_publisher/gps_waypoint.hpp +++ b/include/yet_another_gps_publisher/gps_waypoint.hpp @@ -8,16 +8,16 @@ class gps_waypoint { gps_waypoint() = default; gps_waypoint(double lon, double lat, const std::string& method, double radius = 0.0); - double longitude() const { return longitude_; } - double latitude() const { return latitude_; } - const std::string& method() const { return method_; } - double radius() const { return radius_; } - bool enabled() const { return enabled_; } + double longitude() const { return longitude; } + double latitude() const { return latitude; } + const std::string& method() const { return method; } + double radius() const { return radius; } + bool enabled() const { return enabled; } void setEnabled(bool e) { enabled_ = e; } // Odom pose after transformation (set when waypoint is loaded) void setOdomPose(const geometry_msgs::msg::Pose& pose) { odom_pose_ = pose; } - const geometry_msgs::msg::Pose& odomPose() const { return odom_pose_; } + const geometry_msgs::msg::Pose& odomPose() const { return odom_pose; } private: double longitude_ = 0.0; @@ -25,5 +25,5 @@ class gps_waypoint { std::string method_ = "linear"; double radius_ = 0.0; bool enabled_ = true; - geometry_msgs::msg::Pose odom_pose_; + geometry_msgs::msg::Pose odom_pose; }; \ No newline at end of file diff --git a/include/yet_another_gps_publisher/yet_another_gps_publisher_node.hpp b/include/yet_another_gps_publisher/yet_another_gps_publisher_node.hpp index 229ca4e..d70d25f 100644 --- a/include/yet_another_gps_publisher/yet_another_gps_publisher_node.hpp +++ b/include/yet_another_gps_publisher/yet_another_gps_publisher_node.hpp @@ -19,32 +19,32 @@ class yet_another_gps_publisher : public rclcpp::Node { private: // Parameters - double min_spline_length_; - std::string odom_topic_; - std::string waypoint_file_topic_; - std::string utm_frame_id_; - std::string odom_frame_id_; + double min_spline_length; + std::string odom_topic; + std::string waypoint_file_topic; + std::string utm_frame_id; + std::string odom_frame_id; std::string waypoint_file_path; // Subscribers - rclcpp::Subscription::SharedPtr odom_sub_; - rclcpp::Subscription::SharedPtr waypoint_file_sub_; + rclcpp::Subscription::SharedPtr odom_sub; + rclcpp::Subscription::SharedPtr waypoint_file_sub; // Publisher - rclcpp::Publisher::SharedPtr path_pub_; + rclcpp::Publisher::SharedPtr path_pub; // Timer for periodic spline generation - rclcpp::TimerBase::SharedPtr timer_; + rclcpp::TimerBase::SharedPtr timer; // TF - tf2_ros::Buffer tf_buffer_; - tf2_ros::TransformListener tf_listener_; + tf2_ros::Buffer tf_buffer; + tf2_ros::TransformListener tf_listener; // Current robot pose in odom frame (from odometry) - geometry_msgs::msg::Pose current_pose_; + geometry_msgs::msg::Pose current_pose; // List of pending waypoints (already transformed to odom) - std::deque waypoints_; + std::deque waypoints; // Callbacks void odom_callback(const nav_msgs::msg::Odometry::SharedPtr msg); diff --git a/src/yet_another_gps_publisher_node.cpp b/src/yet_another_gps_publisher_node.cpp index bdc6e81..b88d0f1 100644 --- a/src/yet_another_gps_publisher_node.cpp +++ b/src/yet_another_gps_publisher_node.cpp @@ -101,7 +101,7 @@ bool yet_another_gps_publisher::transformWaypoint(gps_waypoint& wp) { geodesy::fromMsg(geo, utm); // This populates easting, northing, zone, etc. geometry_msgs::msg::PoseStamped utm_pose; - utm_pose.header.frame_id = utm_frame_id_; + utm_pose.header.frame_id = utm_frame_id; utm_pose.header.stamp = this->now(); utm_pose.pose.position.x = utm.easting; utm_pose.pose.position.y = utm.northing; @@ -125,13 +125,13 @@ void yet_another_gps_publisher::timer_callback() { } nav_msgs::msg::Path path; - path.header.frame_id = odom_frame_id_; + path.header.frame_id = odom_frame_id; path.header.stamp = this->now(); // Start with current pose geometry_msgs::msg::PoseStamped start_pose; start_pose.header = path.header; - start_pose.pose = current_pose_; + start_pose.pose = current_pose; path.poses.push_back(start_pose); double cumulative_length = 0.0; From 0f8e4e2de8c20ff3675af6fef9aff7bbc4e9e72e Mon Sep 17 00:00:00 2001 From: redto0 Date: Thu, 26 Feb 2026 20:24:50 -0500 Subject: [PATCH 11/13] DOCS with leon --- README.md | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 8870800..0b424ca 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,5 @@ An opinionated ROS2 C++ node template, optimised for ISC. -# Instructions - -1. Clone repo inside your workspaces src directory (Ex. phnx_ws/src) -2. `rosdep install --from-paths . --ignore-src -r -y` to install deps -3. `colcon build` to make sure the repo builds before you mess with it -4. Replace the following in both file names and code exactly and consistently. - 1. yet_another_gps_publisher: Replace with the package name. Use snake case. Ex. `data_logger` - 2. yet_another_gps_publisher: Replace with the node name. Use Pascal case. Ex. `DataLogger` -5. `colcon build` again. If it builds, you are done -6. Rename outer folder -7. Review the optional dependencies, and remove what you do not need - # Dependencies Some common extra dependencies are included. Review them and remove what you don't need. These are marked with yet_another_gps_publisher. @@ -29,15 +17,18 @@ These are marked with yet_another_gps_publisher. ``` . ├── include -│   └── yet_another_gps_publisher -│   └── yet_another_gps_publisher_node.hpp -├── package.xml -├── README.md -├── src -│   ├── yet_another_gps_publisher.cpp -│   └── yet_another_gps_publisher.cpp -└── tests - └── unit.cpp +│ └── yet_another_gps_publisher +│ ├── gps_waypoint.hpp // this is the header for the GPS CLASSES +│ ├── spline_factory.hpp // this holds the spline generation methonds +│ └── yet_another_gps_publisher_node.hpp // this is the header for teh node specficlly. +├── package.xml // ros building files +├── README.md // this file 😆 +├── src // the main file for logicing codes +│ ├── spline_methods.cpp // this holds the spline generation methonds +│ ├── yet_another_gps_publisher.cpp // this holds the main logic for the node. THis is where the callbacks are +│ └── yet_another_gps_publisher_node.cpp // this is file that ROS launches. +└── tests // we donts use these tbh + └── unit.cpp ``` yet_another_gps_publisher_NODE_NAME_node: Source files for the ROS2 node object itself, and only itself From 0d6979c56982de578a7fa585a448a2a932063347 Mon Sep 17 00:00:00 2001 From: redto0 Date: Fri, 27 Feb 2026 00:16:31 -0500 Subject: [PATCH 12/13] removing unused class options --- include/yet_another_gps_publisher/gps_waypoint.hpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/yet_another_gps_publisher/gps_waypoint.hpp b/include/yet_another_gps_publisher/gps_waypoint.hpp index 2527257..1db783f 100644 --- a/include/yet_another_gps_publisher/gps_waypoint.hpp +++ b/include/yet_another_gps_publisher/gps_waypoint.hpp @@ -12,8 +12,6 @@ class gps_waypoint { double latitude() const { return latitude; } const std::string& method() const { return method; } double radius() const { return radius; } - bool enabled() const { return enabled; } - void setEnabled(bool e) { enabled_ = e; } // Odom pose after transformation (set when waypoint is loaded) void setOdomPose(const geometry_msgs::msg::Pose& pose) { odom_pose_ = pose; } From cf0ee0864a17566b1e87a8aa8b22e65eecf0ce91 Mon Sep 17 00:00:00 2001 From: redto0 Date: Fri, 27 Feb 2026 00:16:51 -0500 Subject: [PATCH 13/13] Spline Comments --- include/yet_another_gps_publisher/spline_factory.hpp | 1 + src/spline_methods.cpp | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/include/yet_another_gps_publisher/spline_factory.hpp b/include/yet_another_gps_publisher/spline_factory.hpp index e9abbb0..6903830 100644 --- a/include/yet_another_gps_publisher/spline_factory.hpp +++ b/include/yet_another_gps_publisher/spline_factory.hpp @@ -10,6 +10,7 @@ namespace gps_waypoint_spline { + // what does using mean compared to normal spline generator. using SplineGenerator = std::function(const gps_waypoint& start, const gps_waypoint& end)>; diff --git a/src/spline_methods.cpp b/src/spline_methods.cpp index 5548a0d..f5e4fab 100644 --- a/src/spline_methods.cpp +++ b/src/spline_methods.cpp @@ -3,6 +3,15 @@ #include "yet_another_gps_publisher/spline_factory.hpp" + +// ------------------------------------------------------------------------------------------ +// +// todo this file is for storing the splines functions we want to generate with +// we need to store the functions either here or in the GPS classes. +// up too ya'll +// +// ------------------------------------------------------------------------------------------ + namespace gps_waypoint_spline { // Factory registry @@ -34,7 +43,7 @@ static std::vector linearGenerator(const gps_waypoint& const auto& a = start.odomPose().position; const auto& b = end.odomPose().position; - const int num_points = 10; + const int num_points = 10; // TODO this shouldnt be hardcoded like EVER std::vector points; points.reserve(num_points + 1);