From 963237bdaeb52fc8ee185dde8f69cfc0ae4634e6 Mon Sep 17 00:00:00 2001 From: s0nofab1t Date: Fri, 17 Jul 2026 11:04:25 +0200 Subject: [PATCH 1/3] Added submodule adore_tridap Signed-off-by: s0nofab1t --- .gitmodules | 3 +++ ros2_workspace/src/adore_libraries/adore_tridap | 1 + 2 files changed, 4 insertions(+) create mode 160000 ros2_workspace/src/adore_libraries/adore_tridap diff --git a/.gitmodules b/.gitmodules index 03f4e12..dd9c3b0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -129,3 +129,6 @@ [submodule "ros2_workspace/src/adore_ros2_nodes/adore_odd_monitor"] path = ros2_workspace/src/adore_ros2_nodes/odd_monitor url = git@github.com:DLR-TS/adore_odd_monitor.git +[submodule "ros2_workspace/src/adore_libraries/adore_tridap"] + path = ros2_workspace/src/adore_libraries/adore_tridap + url = git@github.com:s0nofab1t/adore_tridap.git diff --git a/ros2_workspace/src/adore_libraries/adore_tridap b/ros2_workspace/src/adore_libraries/adore_tridap new file mode 160000 index 0000000..5bace51 --- /dev/null +++ b/ros2_workspace/src/adore_libraries/adore_tridap @@ -0,0 +1 @@ +Subproject commit 5bace51d21dda51f9556835d6224f112626873df From 25a50dab8fe1d33c37afa6cc6f2c60cf9b9ef597 Mon Sep 17 00:00:00 2001 From: s0nofab1t Date: Fri, 17 Jul 2026 16:12:40 +0200 Subject: [PATCH 2/3] Updated adore test programs Signed-off-by: s0nofab1t --- .../adore_map_downloader_test/CMakeLists.txt | 4 +- .../adore_map_downloader_test/README.md | 14 +++++ .../basic_map_loading_from_wfs_test.cpp | 10 ++-- .../requirements.cmake | 16 ------ .../adore_nowcast_test/CMakeLists.txt | 32 +++++++++++ .../adore_nowcast_test/README.md | 14 +++++ .../adore_nowcast_test/adore_nowcast_test.cpp | 56 +++++++++++++++++++ .../config/nowcast_test_config.json | 9 +++ .../adore_nowcast_test/requirements.cmake | 3 + .../adore_nowcast_test/requirements.system | 3 + 10 files changed, 139 insertions(+), 22 deletions(-) create mode 100644 ros2_workspace/src/adore_test_programs/adore_map_downloader_test/README.md create mode 100644 ros2_workspace/src/adore_test_programs/adore_nowcast_test/CMakeLists.txt create mode 100644 ros2_workspace/src/adore_test_programs/adore_nowcast_test/README.md create mode 100644 ros2_workspace/src/adore_test_programs/adore_nowcast_test/adore_nowcast_test.cpp create mode 100644 ros2_workspace/src/adore_test_programs/adore_nowcast_test/config/nowcast_test_config.json create mode 100644 ros2_workspace/src/adore_test_programs/adore_nowcast_test/requirements.cmake create mode 100644 ros2_workspace/src/adore_test_programs/adore_nowcast_test/requirements.system diff --git a/ros2_workspace/src/adore_test_programs/adore_map_downloader_test/CMakeLists.txt b/ros2_workspace/src/adore_test_programs/adore_map_downloader_test/CMakeLists.txt index 9e55f22..96590bd 100644 --- a/ros2_workspace/src/adore_test_programs/adore_map_downloader_test/CMakeLists.txt +++ b/ros2_workspace/src/adore_test_programs/adore_map_downloader_test/CMakeLists.txt @@ -9,10 +9,10 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # Dependencies find_package(adore_map REQUIRED) +find_package(adore_tridap REQUIRED) set(basic_map_loading_from_wfs_test_SRCS basic_map_loading_from_wfs_test.cpp - helpers.hpp ) add_executable(basic_map_loading_from_wfs_test ${basic_map_loading_from_wfs_test_SRCS}) @@ -20,11 +20,13 @@ add_executable(basic_map_loading_from_wfs_test ${basic_map_loading_from_wfs_test # Include paths target_include_directories(basic_map_loading_from_wfs_test PUBLIC ${adore_map_INCLUDE_DIRS} + PUBLIC ${adore_tridap_INCLUDE_DIRS} ) target_link_libraries(basic_map_loading_from_wfs_test PUBLIC adore_map::adore_map + adore_tridap::adore_tridap ) install(TARGETS basic_map_loading_from_wfs_test diff --git a/ros2_workspace/src/adore_test_programs/adore_map_downloader_test/README.md b/ros2_workspace/src/adore_test_programs/adore_map_downloader_test/README.md new file mode 100644 index 0000000..87e6509 --- /dev/null +++ b/ros2_workspace/src/adore_test_programs/adore_map_downloader_test/README.md @@ -0,0 +1,14 @@ +# Standalone Test Program for Downloading a Map from a WFS + +--- + +To execute the test: + +- Add the password in `config/r2s_wfs_config_bs.json`. +- If not done yet, build ADORe with `make build` in the project directory `adore`. +- Then, in the same directory, type `make cli`, and press return to start the ADORe CLI. +- Type `cd ros2_workspace/install/adore_map_downloader_test/bin`, and press return. +- Type `./basic_map_loading_from_wfs_test` (without any parameters), and press return. +- You should see the line "adore_nowcast_test: Nowcast query test completed successfully, good!" along the last few lines. + +--- diff --git a/ros2_workspace/src/adore_test_programs/adore_map_downloader_test/basic_map_loading_from_wfs_test.cpp b/ros2_workspace/src/adore_test_programs/adore_map_downloader_test/basic_map_loading_from_wfs_test.cpp index 527ffac..efe82fa 100644 --- a/ros2_workspace/src/adore_test_programs/adore_map_downloader_test/basic_map_loading_from_wfs_test.cpp +++ b/ros2_workspace/src/adore_test_programs/adore_map_downloader_test/basic_map_loading_from_wfs_test.cpp @@ -13,11 +13,11 @@ #include #include -#include #include -#include "adore_map/map_downloader.hpp" -#include "adore_map/config.hpp" -#include "helpers.hpp" +#include "adore_tridap/map_downloader.hpp" +#include "adore_tridap/helpers.hpp" + +using namespace adore::tridap; /** * @brief Test program to download map data from WFS and save as JSON files @@ -41,7 +41,7 @@ int main( int argc, char* argv[] ) std::filesystem::remove_all( "cache" ); // Initialize the configuration from a properties file - Config cfg( "../../../src/adore_test_programs/adore_map_downloader_test/config/r2s_wfs_config_bs.json" ); + ConfigMapDownloader cfg( "../../../src/adore_test_programs/adore_map_downloader_test/config/r2s_wfs_config_bs.json" ); // Use current directory for file cache and enable debug mode MapDownloader map_downloader( cfg.server_url, cfg.username, cfg.password, cfg.project_name, cfg.target_srs, cfg.bbox, "", true, true, true ); // curl_global_init, curl_global_cleanup, debug: diff --git a/ros2_workspace/src/adore_test_programs/adore_map_downloader_test/requirements.cmake b/ros2_workspace/src/adore_test_programs/adore_map_downloader_test/requirements.cmake index 604f177..b28b04f 100644 --- a/ros2_workspace/src/adore_test_programs/adore_map_downloader_test/requirements.cmake +++ b/ros2_workspace/src/adore_test_programs/adore_map_downloader_test/requirements.cmake @@ -1,19 +1,3 @@ -find_package(PkgConfig REQUIRED) -pkg_check_modules(PROJ REQUIRED proj) -find_package(Eigen3 REQUIRED) -set(Eigen3_TARGETS Eigen3::Eigen) -find_package(OpenCV REQUIRED) -find_package(OpenDrive REQUIRED) -set(OpenDrive_TARGETS OpenDrive::OpenDrive) - -find_package(CURL REQUIRED) -include_directories(${CURL_INCLUDE_DIR}) - -find_package(caches REQUIRED) - -if(TARGET adore_map) - target_link_libraries(adore_map PRIVATE ${PROJ_LIBRARIES} ${OpenCV_LIBS} ${CURL_LIBRARIES}) -endif() diff --git a/ros2_workspace/src/adore_test_programs/adore_nowcast_test/CMakeLists.txt b/ros2_workspace/src/adore_test_programs/adore_nowcast_test/CMakeLists.txt new file mode 100644 index 0000000..a349636 --- /dev/null +++ b/ros2_workspace/src/adore_test_programs/adore_nowcast_test/CMakeLists.txt @@ -0,0 +1,32 @@ +cmake_minimum_required(VERSION 3.8) +project(adore_nowcast_test VERSION 1.0.0 LANGUAGES CXX) + +# C++20 strict mode +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +# Dependencies +find_package(adore_tridap REQUIRED) + +set(adore_nowcast_test_SRCS + adore_nowcast_test.cpp +) + +add_executable(adore_nowcast_test ${adore_nowcast_test_SRCS}) + +# Include paths +target_include_directories(adore_nowcast_test + PUBLIC ${adore_nowcast_INCLUDE_DIRS} +) + +target_link_libraries(adore_nowcast_test + PUBLIC + adore_tridap::adore_tridap +) + +install(TARGETS adore_nowcast_test + EXPORT adore_nowcast_testTargets + RUNTIME DESTINATION bin +) diff --git a/ros2_workspace/src/adore_test_programs/adore_nowcast_test/README.md b/ros2_workspace/src/adore_test_programs/adore_nowcast_test/README.md new file mode 100644 index 0000000..eaab85b --- /dev/null +++ b/ros2_workspace/src/adore_test_programs/adore_nowcast_test/README.md @@ -0,0 +1,14 @@ +# Standalone Test Program for Querying the Nowcast Service (Work in Progress) + +--- + +To execute the (preliminary) test: + +- Add the password in `config/nowcast_test_config.json`. +- If not done yet, build ADORe with `make build` in the project directory `adore`. +- Then, in the same directory, type `make cli`, and press return to start the ADORe CLI. +- Type `cd ros2_workspace/install/adore_nowcast_test/bin`, and press return. +- Type `./adore_nowcast_test` (without any parameters), and press return. +- You should see the line "adore_nowcast_test: Nowcast query test completed successfully, good!" along the last few lines. + +--- diff --git a/ros2_workspace/src/adore_test_programs/adore_nowcast_test/adore_nowcast_test.cpp b/ros2_workspace/src/adore_test_programs/adore_nowcast_test/adore_nowcast_test.cpp new file mode 100644 index 0000000..261e79f --- /dev/null +++ b/ros2_workspace/src/adore_test_programs/adore_nowcast_test/adore_nowcast_test.cpp @@ -0,0 +1,56 @@ +#include +#include "adore_tridap/nowcast.hpp" +#include "adore_tridap/helpers.hpp" + +using namespace adore::tridap; + +// Main function +int main( int argc, char* argv[] ) +{ + if( argc != 1 ) + { + std::cerr << "Usage: " << module_name( argv[0] ) << " (i.e., without parameters)." << std::endl; + exit( -1 ); + } + + // Clean up potential cache remnants from previous test runs + std::filesystem::remove_all( "cache" ); + + // Initialize the configuration from a properties file + ConfigNowcast cfg( "../../../src/adore_test_programs/adore_nowcast_test/config/nowcast_test_config.json" ); + // Use current directory for file cache and enable debug mode + Nowcast nowcast( cfg.server_url, cfg.username, cfg.password, cfg.project_name, cfg.target_srs, + cfg.bbox, cfg.layer_name_nowcast, "", true, true, true ); // curl_global_init, curl_global_cleanup, debug: + // Since this test program is standalone, we can let the internal + // curl wrapper initialize, and later upon leaving scope, also + // cleanup curl globally + + // First test the now() method to get the current time in ISO 8601 format + std::string current_time = Nowcast::now( true ); + std::cout << module_name( argv[0] ) << ": Current time in ISO 8601 format: " << current_time << std::endl; + + std::string test_time = "2019-08-02T18:00:00.000Z"; + double thunderstorm_probability = nowcast.query( test_time ); + std::cout << module_name( argv[0] ) << ": Thunderstorm probability for " << test_time << ": " + << std::setprecision(17) << thunderstorm_probability << std::endl; + if( thunderstorm_probability < 0.0 ) + { + std::cerr << module_name( argv[0] ) << ": Nowcast query failed for time " << test_time << std::endl; + exit( -1 ); + } else if( thunderstorm_probability > 1.0 ) + { + std::cerr << module_name( argv[0] ) << ": Nowcast query returned invalid probability value " + << thunderstorm_probability << " for time " << test_time << std::endl; + exit( -1 ); + } else if( thunderstorm_probability != 0.0016004316275939345 ) + { + std::cerr << module_name( argv[0] ) << ": Nowcast query returned unexpected probability value " + << thunderstorm_probability << " for time " << test_time << std::endl; + exit( -1 ); + } + std::cout << module_name( argv[0] ) << ": Nowcast query returned expected probability value " + << thunderstorm_probability << " for time " << test_time << std::endl; + std::cout << module_name( argv[0] ) << ": Nowcast query test completed successfully, good!" + << std::endl << std::endl; + return 0; +} \ No newline at end of file diff --git a/ros2_workspace/src/adore_test_programs/adore_nowcast_test/config/nowcast_test_config.json b/ros2_workspace/src/adore_test_programs/adore_nowcast_test/config/nowcast_test_config.json new file mode 100644 index 0000000..ff5211a --- /dev/null +++ b/ros2_workspace/src/adore_test_programs/adore_nowcast_test/config/nowcast_test_config.json @@ -0,0 +1,9 @@ +{ + "url" : "https://ts.dlr.de/mumme-server/", + "project_name" : "in2action", + "target_srs" : "EPSG:4326", + "bbox" : [ 10.378418087832927, 44.4616700263095, 12.597656369082927, 46.6809083075595 ], + "username" : "adore-ts_reader", + "password" : "Enter Your Password Here", + "nowcast" : "in2action:thunderstorm_probability_sample" +} diff --git a/ros2_workspace/src/adore_test_programs/adore_nowcast_test/requirements.cmake b/ros2_workspace/src/adore_test_programs/adore_nowcast_test/requirements.cmake new file mode 100644 index 0000000..b28b04f --- /dev/null +++ b/ros2_workspace/src/adore_test_programs/adore_nowcast_test/requirements.cmake @@ -0,0 +1,3 @@ + + + diff --git a/ros2_workspace/src/adore_test_programs/adore_nowcast_test/requirements.system b/ros2_workspace/src/adore_test_programs/adore_nowcast_test/requirements.system new file mode 100644 index 0000000..2f43e6b --- /dev/null +++ b/ros2_workspace/src/adore_test_programs/adore_nowcast_test/requirements.system @@ -0,0 +1,3 @@ +# Perhaps later: +#pkg-config +#libproj-dev \ No newline at end of file From e2da08f264b42dec1a0764a042b3cc9f4bead84b Mon Sep 17 00:00:00 2001 From: s0nofab1t Date: Fri, 17 Jul 2026 16:20:37 +0200 Subject: [PATCH 3/3] Removed helpers.cpp Signed-off-by: s0nofab1t --- .../adore_map_downloader_test/helpers.hpp | 72 ------------------- 1 file changed, 72 deletions(-) delete mode 100644 ros2_workspace/src/adore_test_programs/adore_map_downloader_test/helpers.hpp diff --git a/ros2_workspace/src/adore_test_programs/adore_map_downloader_test/helpers.hpp b/ros2_workspace/src/adore_test_programs/adore_map_downloader_test/helpers.hpp deleted file mode 100644 index 5dd1ab6..0000000 --- a/ros2_workspace/src/adore_test_programs/adore_map_downloader_test/helpers.hpp +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2025 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * https://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - ********************************************************************************/ - -#pragma once -#include -#include - -/** @brief Helper function to extract module name from the path of the executable - * @param path The full path of the executable - * @return The module name extracted from the path - */ -std::string module_name( const char* path ) -{ - if( path == nullptr ) - { - return ""; - } - std::string full_path( path ); - std::string::size_type i = full_path.find_last_of( "/\\" ); - if( i != std::string::npos ) - { - std::string name( full_path.substr( i + 1 ) ); - return name; - - } - return full_path; -} - -/** @brief Modifies a filename by replacing the last dot with an underscore and appending a new end withsuffix - * @param filename The original filename - * @param new_end_with_suffix The new end with suffix to append - * @return The modified filename - */ -std::string modified_filename( const std::string filename, const std::string new_end_with_suffix ) -{ - std::string str = filename; - size_t last_dot_pos = str.find_last_of( '.' ); - if( last_dot_pos != std::string::npos ) - { - str[ last_dot_pos ] = '_'; - } - std::string modified_filename = str + new_end_with_suffix; - return modified_filename; -} - -/** @brief Compares two files for identical content - * @param file1 The path to the first file - * @param file2 The path to the second file - * @return true if the files are identical, false otherwise - */ -bool are_identical_files( const std::string& file1, const std::string& file2 ) -{ - // If under linux, call diff -a, if under windows, call fc - // to compare the two JSON files - #ifdef _WIN32 - std::string command = "fc \"" + file1 + "\" \"" + file2 + "\""; - #else - std::string command = "diff -a \"" + file1 + "\" \"" + file2 + "\""; - #endif - int ret = system( command.c_str() ); - return ret == 0; -}