From 7613db6ef7fa945cdb809932f1dc06a94b227b60 Mon Sep 17 00:00:00 2001 From: wep21 Date: Sun, 23 Feb 2025 23:39:07 +0900 Subject: [PATCH 1/5] add ublox Signed-off-by: wep21 --- vinca_linux_64.yaml | 2 ++ vinca_linux_aarch64.yaml | 2 ++ vinca_osx.yaml | 2 ++ vinca_osx_arm64.yaml | 2 ++ vinca_win.yaml | 2 ++ 5 files changed, 10 insertions(+) diff --git a/vinca_linux_64.yaml b/vinca_linux_64.yaml index 6a21bd8a4..3043f1a6e 100644 --- a/vinca_linux_64.yaml +++ b/vinca_linux_64.yaml @@ -94,5 +94,7 @@ packages_select_by_deps: - lanelet2 + - ublox + patch_dir: patch rosdistro_snapshot: rosdistro_snapshot.yaml diff --git a/vinca_linux_aarch64.yaml b/vinca_linux_aarch64.yaml index 6a21bd8a4..3043f1a6e 100644 --- a/vinca_linux_aarch64.yaml +++ b/vinca_linux_aarch64.yaml @@ -94,5 +94,7 @@ packages_select_by_deps: - lanelet2 + - ublox + patch_dir: patch rosdistro_snapshot: rosdistro_snapshot.yaml diff --git a/vinca_osx.yaml b/vinca_osx.yaml index 7872bd13c..bf3f24b0e 100644 --- a/vinca_osx.yaml +++ b/vinca_osx.yaml @@ -103,5 +103,7 @@ packages_select_by_deps: - lanelet2 + - ublox + patch_dir: patch rosdistro_snapshot: rosdistro_snapshot.yaml diff --git a/vinca_osx_arm64.yaml b/vinca_osx_arm64.yaml index ee62a6aea..4e7571448 100644 --- a/vinca_osx_arm64.yaml +++ b/vinca_osx_arm64.yaml @@ -103,5 +103,7 @@ packages_select_by_deps: - lanelet2 + - ublox + patch_dir: patch rosdistro_snapshot: rosdistro_snapshot.yaml diff --git a/vinca_win.yaml b/vinca_win.yaml index df660bb20..d3cd4fcfc 100644 --- a/vinca_win.yaml +++ b/vinca_win.yaml @@ -104,6 +104,8 @@ packages_select_by_deps: - lanelet2 + - ublox + patch_dir: patch rosdistro_snapshot: rosdistro_snapshot.yaml From 15c8e92e287b26701bc1c9748336aee9392dcccb Mon Sep 17 00:00:00 2001 From: wep21 Date: Mon, 24 Feb 2025 01:12:59 +0900 Subject: [PATCH 2/5] add ublox msgs win patch Signed-off-by: wep21 --- patch/ros-jazzy-ublox-msgs.win.patch | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 patch/ros-jazzy-ublox-msgs.win.patch diff --git a/patch/ros-jazzy-ublox-msgs.win.patch b/patch/ros-jazzy-ublox-msgs.win.patch new file mode 100644 index 000000000..139529cf3 --- /dev/null +++ b/patch/ros-jazzy-ublox-msgs.win.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e4c03c0..c77f681 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -10,6 +10,8 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) + endif() + ++set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) ++ + find_package(ament_cmake_ros REQUIRED) + find_package(rosidl_default_generators REQUIRED) + find_package(sensor_msgs REQUIRED) From 47d9d2545bb05107c0067d51776ea7aa7a5430f9 Mon Sep 17 00:00:00 2001 From: wep21 Date: Mon, 24 Feb 2025 22:28:09 +0900 Subject: [PATCH 3/5] add ublox gps win patch Signed-off-by: wep21 --- patch/ros-jazzy-ublox-gps.win.patch | 171 +++++++++++++++++++++++++++ patch/ros-jazzy-ublox-msgs.win.patch | 22 ++++ 2 files changed, 193 insertions(+) create mode 100644 patch/ros-jazzy-ublox-gps.win.patch diff --git a/patch/ros-jazzy-ublox-gps.win.patch b/patch/ros-jazzy-ublox-gps.win.patch new file mode 100644 index 000000000..a0d04a127 --- /dev/null +++ b/patch/ros-jazzy-ublox-gps.win.patch @@ -0,0 +1,171 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5a9fdf1..3122dd8 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -64,6 +64,8 @@ target_link_libraries(ublox_gps PUBLIC + ublox_serialization::ublox_serialization + ) + ++target_compile_definitions(ublox_gps PRIVATE _USE_MATH_DEFINES) ++ + install(TARGETS ublox_gps EXPORT export_${PROJECT_NAME} + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib +diff --git a/include/ublox_gps/ublox_firmware7plus.hpp b/include/ublox_gps/ublox_firmware7plus.hpp +index 84ffe7a..1b8043d 100644 +--- a/include/ublox_gps/ublox_firmware7plus.hpp ++++ b/include/ublox_gps/ublox_firmware7plus.hpp +@@ -175,7 +175,17 @@ class UbloxFirmware7Plus : public UbloxFirmware { + } + // Raise diagnostic level to error if no fix + if (last_nav_pvt_.fix_type == ublox_msgs::msg::NavPVT::FIX_TYPE_NO_FIX) { ++#if defined(_WIN32) ++# if defined(ERROR) ++# pragma push_macro("ERROR") ++# undef ERROR ++# endif ++#endif + stat.level = diagnostic_msgs::msg::DiagnosticStatus::ERROR; ++#if defined(_WIN32) ++# pragma warning(suppress : 4602) ++# pragma pop_macro("ERROR") ++#endif + stat.message = "No fix"; + } + +diff --git a/src/gps.cpp b/src/gps.cpp +index e71377d..9e91478 100644 +--- a/src/gps.cpp ++++ b/src/gps.cpp +@@ -138,12 +138,6 @@ void Gps::initializeSerial(const std::string & port, unsigned int baudrate, + + RCLCPP_INFO(logger_, "U-Blox: Opened serial port %s", port.c_str()); + +- int fd = serial->native_handle(); +- termios tio{}; +- tcgetattr(fd, &tio); +- cfmakeraw(&tio); +- tcsetattr(fd, TCSANOW, &tio); +- + // Set the I/O worker + if (worker_) { + return; +diff --git a/src/hpg_ref_product.cpp b/src/hpg_ref_product.cpp +index b12caaf..62c61b4 100644 +--- a/src/hpg_ref_product.cpp ++++ b/src/hpg_ref_product.cpp +@@ -224,7 +224,17 @@ void HpgRefProduct::tmode3Diagnostics( + stat.message = "Disabled"; + } else if (mode_ == SURVEY_IN) { + if (!last_nav_svin_.active && !last_nav_svin_.valid) { ++#if defined(_WIN32) ++# if defined(ERROR) ++# pragma push_macro("ERROR") ++# undef ERROR ++# endif ++#endif + stat.level = diagnostic_msgs::msg::DiagnosticStatus::ERROR; ++#if defined(_WIN32) ++# pragma warning(suppress : 4602) ++# pragma pop_macro("ERROR") ++#endif + stat.message = "Survey-In inactive and invalid"; + } else if (last_nav_svin_.active && !last_nav_svin_.valid) { + stat.level = diagnostic_msgs::msg::DiagnosticStatus::WARN; +diff --git a/src/hpg_rov_product.cpp b/src/hpg_rov_product.cpp +index 7b524d5..b08a862 100644 +--- a/src/hpg_rov_product.cpp ++++ b/src/hpg_rov_product.cpp +@@ -65,7 +65,17 @@ void HpgRovProduct::carrierPhaseDiagnostics( + if (carr_soln & ublox_msgs::msg::NavRELPOSNED::FLAGS_CARR_SOLN_NONE || + !(last_rel_pos_.flags & ublox_msgs::msg::NavRELPOSNED::FLAGS_DIFF_SOLN && + last_rel_pos_.flags & ublox_msgs::msg::NavRELPOSNED::FLAGS_REL_POS_VALID)) { ++#if defined(_WIN32) ++# if defined(ERROR) ++# pragma push_macro("ERROR") ++# undef ERROR ++# endif ++#endif + stat.level = diagnostic_msgs::msg::DiagnosticStatus::ERROR; ++#if defined(_WIN32) ++# pragma warning(suppress : 4602) ++# pragma pop_macro("ERROR") ++#endif + stat.message = "None"; + } else { + if (carr_soln & ublox_msgs::msg::NavRELPOSNED::FLAGS_CARR_SOLN_FLOAT) { +diff --git a/src/node.cpp b/src/node.cpp +index 23f5172..0153410 100644 +--- a/src/node.cpp ++++ b/src/node.cpp +@@ -506,7 +506,17 @@ void UbloxNode::pollMessages() { + } + + void UbloxNode::printInf(const ublox_msgs::msg::Inf &m, uint8_t id) { ++#if defined(_WIN32) ++# if defined(ERROR) ++# pragma push_macro("ERROR") ++# undef ERROR ++# endif ++#endif + if (id == ublox_msgs::Message::INF::ERROR) { ++#if defined(_WIN32) ++# pragma warning(suppress : 4602) ++# pragma pop_macro("ERROR") ++#endif + RCLCPP_ERROR(this->get_logger(), "INF: %s", std::string(m.str.begin(), m.str.end()).c_str()); + } else if (id == ublox_msgs::Message::INF::WARNING) { + RCLCPP_WARN(this->get_logger(), "INF: %s", std::string(m.str.begin(), m.str.end()).c_str()); +@@ -546,10 +556,20 @@ void UbloxNode::subscribe() { + } + + if (getRosBoolean(this, "inf.error")) { ++#if defined(_WIN32) ++# if defined(ERROR) ++# pragma push_macro("ERROR") ++# undef ERROR ++# endif ++#endif + gps_->subscribeId( + std::bind(&UbloxNode::printInf, this, std::placeholders::_1, + ublox_msgs::Message::INF::ERROR), + ublox_msgs::Message::INF::ERROR); ++#if defined(_WIN32) ++# pragma warning(suppress : 4602) ++# pragma pop_macro("ERROR") ++#endif + } + + if (getRosBoolean(this, "inf.notice")) { +@@ -616,8 +636,7 @@ void UbloxNode::processMonVer() { + RCLCPP_DEBUG(this->get_logger(), "%s", + std::string(monVer.extension[i].field.begin(), monVer.extension[i].field.end()).c_str()); + // Find the end of the string (null character) +- unsigned char* end = std::find(monVer.extension[i].field.begin(), +- monVer.extension[i].field.end(), '\0'); ++ auto end = std::find(monVer.extension[i].field.begin(), monVer.extension[i].field.end(), '\0'); + extensions.emplace_back(std::string(monVer.extension[i].field.begin(), end)); + } + +diff --git a/src/ublox_firmware6.cpp b/src/ublox_firmware6.cpp +index 0bb7f3b..24046c5 100644 +--- a/src/ublox_firmware6.cpp ++++ b/src/ublox_firmware6.cpp +@@ -151,7 +151,17 @@ void UbloxFirmware6::fixDiagnostic( + } + // Raise diagnostic level to error if no fix + if (last_nav_sol_.gps_fix == ublox_msgs::msg::NavSOL::GPS_NO_FIX) { ++#if defined(_WIN32) ++# if defined(ERROR) ++# pragma push_macro("ERROR") ++# undef ERROR ++# endif ++#endif + stat.level = diagnostic_msgs::msg::DiagnosticStatus::ERROR; ++#if defined(_WIN32) ++# pragma warning(suppress : 4602) ++# pragma pop_macro("ERROR") ++#endif + stat.message = "No fix"; + } + diff --git a/patch/ros-jazzy-ublox-msgs.win.patch b/patch/ros-jazzy-ublox-msgs.win.patch index 139529cf3..e1d343918 100644 --- a/patch/ros-jazzy-ublox-msgs.win.patch +++ b/patch/ros-jazzy-ublox-msgs.win.patch @@ -11,3 +11,25 @@ index e4c03c0..c77f681 100644 find_package(ament_cmake_ros REQUIRED) find_package(rosidl_default_generators REQUIRED) find_package(sensor_msgs REQUIRED) +diff --git a/include/ublox_msgs/ublox_msgs.hpp b/include/ublox_msgs/ublox_msgs.hpp +index d362c8d..761a08c 100644 +--- a/include/ublox_msgs/ublox_msgs.hpp ++++ b/include/ublox_msgs/ublox_msgs.hpp +@@ -185,7 +185,17 @@ namespace Message { + } // namespace RXM + + namespace INF { ++#if defined(_WIN32) ++# if defined(ERROR) ++# pragma push_macro("ERROR") ++# undef ERROR ++# endif ++#endif + static const uint8_t ERROR = 0x00; ++#if defined(_WIN32) ++# pragma warning(suppress : 4602) ++# pragma pop_macro("ERROR") ++#endif + static const uint8_t WARNING = 0x01; + static const uint8_t NOTICE = 0x02; + static const uint8_t TEST = 0x03; From a0fc8c5315e95cbd72fa58f74ee05a086a601775 Mon Sep 17 00:00:00 2001 From: wep21 Date: Tue, 25 Feb 2025 02:48:15 +0900 Subject: [PATCH 4/5] add ublox serialization win patch Signed-off-by: wep21 --- patch/ros-jazzy-ublox-msgs.win.patch | 40 ++++++++++++++++++- patch/ros-jazzy-ublox-serialization.win.patch | 13 ++++++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 patch/ros-jazzy-ublox-serialization.win.patch diff --git a/patch/ros-jazzy-ublox-msgs.win.patch b/patch/ros-jazzy-ublox-msgs.win.patch index e1d343918..66af229e7 100644 --- a/patch/ros-jazzy-ublox-msgs.win.patch +++ b/patch/ros-jazzy-ublox-msgs.win.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index e4c03c0..c77f681 100644 +index e4c03c0..5f18382 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,8 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") @@ -11,6 +11,44 @@ index e4c03c0..c77f681 100644 find_package(ament_cmake_ros REQUIRED) find_package(rosidl_default_generators REQUIRED) find_package(sensor_msgs REQUIRED) +@@ -108,12 +110,16 @@ if(cpp_typesupport_target) + add_library(${PROJECT_NAME}_lib src/ublox_msgs.cpp) + target_include_directories(${PROJECT_NAME}_lib PRIVATE + "$" ++ "$" + "$") + target_link_libraries(${PROJECT_NAME}_lib + ${cpp_typesupport_target} + ublox_serialization::ublox_serialization + ) + ++ include(GenerateExportHeader) ++ generate_export_header(${PROJECT_NAME}_lib BASE_NAME ublox_serialization) ++ + install(TARGETS ${PROJECT_NAME}_lib EXPORT ${PROJECT_NAME}_lib + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib +@@ -124,6 +130,8 @@ if(cpp_typesupport_target) + DESTINATION "include/${PROJECT_NAME}" + ) + ++ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ublox_serialization_export.h DESTINATION include) ++ + ament_export_include_directories("include/${PROJECT_NAME}") + ament_export_libraries(${PROJECT_NAME}_lib) + ament_export_targets(${PROJECT_NAME}_lib) +diff --git a/include/ublox_msgs/serialization.hpp b/include/ublox_msgs/serialization.hpp +index 9ef607f..980f920 100644 +--- a/include/ublox_msgs/serialization.hpp ++++ b/include/ublox_msgs/serialization.hpp +@@ -32,6 +32,7 @@ + + #include + ++#include + #include + #include + diff --git a/include/ublox_msgs/ublox_msgs.hpp b/include/ublox_msgs/ublox_msgs.hpp index d362c8d..761a08c 100644 --- a/include/ublox_msgs/ublox_msgs.hpp diff --git a/patch/ros-jazzy-ublox-serialization.win.patch b/patch/ros-jazzy-ublox-serialization.win.patch new file mode 100644 index 000000000..9a95b1213 --- /dev/null +++ b/patch/ros-jazzy-ublox-serialization.win.patch @@ -0,0 +1,13 @@ +diff --git a/include/ublox_serialization/serialization.hpp b/include/ublox_serialization/serialization.hpp +index b04fc81..ba3ef08 100644 +--- a/include/ublox_serialization/serialization.hpp ++++ b/include/ublox_serialization/serialization.hpp +@@ -324,7 +324,7 @@ class Message { + }; + + private: +- static std::vector > keys_; ++ static UBLOX_SERIALIZATION_EXPORT std::vector > keys_; + }; + + /** From d58b28837b79d233c260575ea19c6e6faa035595 Mon Sep 17 00:00:00 2001 From: wep21 Date: Tue, 25 Feb 2025 04:08:41 +0900 Subject: [PATCH 5/5] update patch Signed-off-by: wep21 --- patch/ros-jazzy-ublox-gps.win.patch | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/patch/ros-jazzy-ublox-gps.win.patch b/patch/ros-jazzy-ublox-gps.win.patch index a0d04a127..3c1ba24ec 100644 --- a/patch/ros-jazzy-ublox-gps.win.patch +++ b/patch/ros-jazzy-ublox-gps.win.patch @@ -1,8 +1,17 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 5a9fdf1..3122dd8 100644 +index 5a9fdf1..3d2e2a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -64,6 +64,8 @@ target_link_libraries(ublox_gps PUBLIC +@@ -10,6 +10,8 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) + endif() + ++set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) ++ + set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") + + find_package(ament_cmake_ros REQUIRED) +@@ -64,6 +66,8 @@ target_link_libraries(ublox_gps PUBLIC ublox_serialization::ublox_serialization )