From 4ece5416f095b8180cecc495cb2a607ce7e62976 Mon Sep 17 00:00:00 2001 From: Facundo Garcia Date: Mon, 15 Jan 2024 16:08:25 +0100 Subject: [PATCH] Added unit conversion as constant --- fixposition_driver_lib/src/gprmc.cpp | 7 +++++-- fixposition_driver_ros1/launch/tcp.yaml | 2 +- fixposition_driver_ros2/CATKIN_IGNORE | 0 3 files changed, 6 insertions(+), 3 deletions(-) delete mode 100644 fixposition_driver_ros2/CATKIN_IGNORE diff --git a/fixposition_driver_lib/src/gprmc.cpp b/fixposition_driver_lib/src/gprmc.cpp index 2a0d5a0..e09fc23 100644 --- a/fixposition_driver_lib/src/gprmc.cpp +++ b/fixposition_driver_lib/src/gprmc.cpp @@ -20,6 +20,9 @@ namespace fixposition { +// unit transformation constant +static constexpr double knots_to_ms = 1852.0 / 3600.0; //!< convert knots to m/s + /// msg field indices static constexpr const int time_idx = 1; static constexpr const int status_idx = 2; @@ -57,8 +60,8 @@ void GprmcConverter::ConvertTokens(const std::vector& tokens) { if (tokens.at(lon_ew_idx).compare("W") == 0) _lon *= -1; msg_.longitude = _lon; - // Speed and course over groung - msg_.speed = StringToDouble(tokens.at(speed_idx)) * 1852.0 / 3600.0; + // Speed [m/s] and course [deg] over ground + msg_.speed = StringToDouble(tokens.at(speed_idx)) * knots_to_ms; msg_.course = StringToDouble(tokens.at(course_idx)); // Get GPS status diff --git a/fixposition_driver_ros1/launch/tcp.yaml b/fixposition_driver_ros1/launch/tcp.yaml index 7bf49c4..44ecfc4 100644 --- a/fixposition_driver_ros1/launch/tcp.yaml +++ b/fixposition_driver_ros1/launch/tcp.yaml @@ -2,7 +2,7 @@ fp_output: formats: ["ODOMETRY", "LLH", "RAWIMU", "CORRIMU", "GPGGA", "GPZDA", "GPRMC", "TF"] type: tcp port: "21000" - ip: "10.0.2.1" # change to VRTK2's IP address in the network + ip: "127.0.0.1" # change to VRTK2's IP address in the network rate: 200 reconnect_delay: 5.0 # wait time in [s] until retry connection diff --git a/fixposition_driver_ros2/CATKIN_IGNORE b/fixposition_driver_ros2/CATKIN_IGNORE deleted file mode 100644 index e69de29..0000000