diff --git a/patch/ros-jazzy-ffmpeg-encoder-decoder.unix.patch b/patch/ros-jazzy-ffmpeg-encoder-decoder.unix.patch new file mode 100644 index 000000000..d89bb0586 --- /dev/null +++ b/patch/ros-jazzy-ffmpeg-encoder-decoder.unix.patch @@ -0,0 +1,96 @@ +diff --git a/include/ffmpeg_encoder_decoder/decoder.hpp b/include/ffmpeg_encoder_decoder/decoder.hpp +index 0e2521c..94625e5 100644 +--- a/include/ffmpeg_encoder_decoder/decoder.hpp ++++ b/include/ffmpeg_encoder_decoder/decoder.hpp +@@ -81,7 +81,7 @@ private: + AVFrame * colorFrame_{NULL}; + SwsContext * swsContext_{NULL}; + enum AVPixelFormat hwPixFormat_; +- AVPacket packet_; ++ // AVPacket packet_; + AVBufferRef * hwDeviceContext_{NULL}; + }; + } // namespace ffmpeg_encoder_decoder +diff --git a/src/decoder.cpp b/src/decoder.cpp +index 0a12d25..9737ffe 100644 +--- a/src/decoder.cpp ++++ b/src/decoder.cpp +@@ -38,7 +38,11 @@ Decoder::~Decoder() { reset(); } + void Decoder::reset() + { + if (codecContext_) { ++#if LIBAVFORMAT_VERSION_MAJOR < 59 + avcodec_close(codecContext_); ++#else ++ avcodec_free_context(&codecContext_); ++#endif + av_free(codecContext_); + codecContext_ = NULL; + } +@@ -255,7 +259,7 @@ bool Decoder::decodePacket( + image->header.stamp = it->second; + ptsToStamp_.erase(it); + #ifdef USE_AV_FLAGS +- callback_(image, decodedFrame_->flags || AV_FRAME_FLAG_KEY); // deliver callback ++ callback_(image, decodedFrame_->flags | AV_FRAME_FLAG_KEY); // deliver callback + #else + callback_(image, decodedFrame_->key_frame); // deliver callback + #endif +diff --git a/src/encoder.cpp b/src/encoder.cpp +index a4b6de6..8a3f40a 100644 +--- a/src/encoder.cpp ++++ b/src/encoder.cpp +@@ -54,7 +54,11 @@ static void free_frame(AVFrame ** frame) + void Encoder::closeCodec() + { + if (codecContext_) { ++#if LIBAVFORMAT_VERSION_MAJOR < 59 + avcodec_close(codecContext_); ++#else ++ avcodec_free_context(&codecContext_); ++#endif + codecContext_ = nullptr; + } + free_frame(&frame_); +@@ -207,11 +211,19 @@ void Encoder::doOpenCodec(int width, int height) + setAVOption("preset", preset_); + setAVOption("tune", tune_); + setAVOption("delay", delay_); ++#ifdef __APPLE__ ++ RCLCPP_DEBUG( ++ logger_, ++ "codec: %10s, profile: %10s, preset: %10s," ++ " bit_rate: %10lld qmax: %2d", ++ encoder_.c_str(), profile_.c_str(), preset_.c_str(), bitRate_, qmax_); ++#else + RCLCPP_DEBUG( + logger_, + "codec: %10s, profile: %10s, preset: %10s," + " bit_rate: %10ld qmax: %2d", + encoder_.c_str(), profile_.c_str(), preset_.c_str(), bitRate_, qmax_); ++#endif + + err = avcodec_open2(codecContext_, codec, NULL); + utils::check_for_err("cannot open codec", err); +diff --git a/src/utils.cpp b/src/utils.cpp +index da089e4..01e8eea 100644 +--- a/src/utils.cpp ++++ b/src/utils.cpp +@@ -104,8 +104,15 @@ enum AVPixelFormat get_preferred_pixel_format( + std::vector get_encoder_formats(const AVCodec * c) + { + std::vector formats; +- if (c && c->pix_fmts) { +- for (const auto * p = c->pix_fmts; *p != AV_PIX_FMT_NONE; ++p) { ++#if LIBAVUTIL_VERSION_MAJOR > 59 || (LIBAVUTIL_VERSION_MAJOR == 59 && LIBAVUTIL_VERSION_MINOR >= 39) ++ const enum AVPixelFormat *pix_fmts = NULL; ++ avcodec_get_supported_config(NULL, c, AV_CODEC_CONFIG_PIX_FORMAT, 0, (const void **) &pix_fmts, NULL); ++ if (c && pix_fmts) { ++#else ++ const enum AVPixelFormat *pix_fmts = c->pix_fmts; ++ if (c && pix_fmts) { ++#endif ++ for (const auto * p = pix_fmts; *p != AV_PIX_FMT_NONE; ++p) { + formats.push_back(*p); + } + } diff --git a/patch/ros-jazzy-foxglove-bridge.win.patch b/patch/ros-jazzy-foxglove-bridge.win.patch new file mode 100644 index 000000000..a08bd3d48 --- /dev/null +++ b/patch/ros-jazzy-foxglove-bridge.win.patch @@ -0,0 +1,169 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 715ce29..f8b43d5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -14,6 +14,11 @@ project(foxglove_bridge LANGUAGES CXX VERSION 0.8.3) + set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + ++if(MSVC) ++ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) ++ set(BUILD_SHARED_LIBS TRUE) ++endif() ++ + macro(enable_strict_compiler_warnings target) + if (MSVC) + target_compile_options(${target} PRIVATE /WX /W4) +@@ -77,8 +82,9 @@ add_library(foxglove_bridge_base SHARED + ${CMAKE_CURRENT_BINARY_DIR}/foxglove_bridge_base/src/version.cpp + ) + target_include_directories(foxglove_bridge_base +- PUBLIC ++ SYSTEM PUBLIC + $ ++ $ + $ + ) + target_link_libraries(foxglove_bridge_base +@@ -92,7 +98,12 @@ if(nlohmann_json_FOUND) + else() + message(STATUS "nlohmann_json not found, will search at compile time") + endif() +-enable_strict_compiler_warnings(foxglove_bridge_base) ++# enable_strict_compiler_warnings(foxglove_bridge_base) ++if(MSVC) ++ target_compile_definitions(foxglove_bridge_base PUBLIC _WEBSOCKETPP_CPP11_STL_) ++ include(GenerateExportHeader) ++ generate_export_header(foxglove_bridge_base) ++endif() + + message(STATUS "ROS_VERSION: " $ENV{ROS_VERSION}) + message(STATUS "ROS_DISTRO: " $ENV{ROS_DISTRO}) +@@ -280,6 +291,9 @@ elseif(ROS_BUILD_TYPE STREQUAL "ament_cmake") + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin + ) ++ if(MSVC) ++ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/foxglove_bridge_base_export.h DESTINATION include) ++ endif() + install(DIRECTORY ros2_foxglove_bridge/launch + DESTINATION share/${PROJECT_NAME}/ + ) +diff --git a/foxglove_bridge_base/include/foxglove_bridge/foxglove_bridge.hpp b/foxglove_bridge_base/include/foxglove_bridge/foxglove_bridge.hpp +index 4b85891..6a946ee 100644 +--- a/foxglove_bridge_base/include/foxglove_bridge/foxglove_bridge.hpp ++++ b/foxglove_bridge_base/include/foxglove_bridge/foxglove_bridge.hpp +@@ -1,11 +1,13 @@ + #pragma once + ++#include ++ + namespace foxglove { + + const char* WebSocketUserAgent(); + +-extern const char FOXGLOVE_BRIDGE_VERSION[]; ++extern FOXGLOVE_BRIDGE_BASE_EXPORT const char FOXGLOVE_BRIDGE_VERSION[]; + +-extern const char FOXGLOVE_BRIDGE_GIT_HASH[]; ++extern FOXGLOVE_BRIDGE_BASE_EXPORT const char FOXGLOVE_BRIDGE_GIT_HASH[]; + + } // namespace foxglove +diff --git a/ros2_foxglove_bridge/src/generic_client.cpp b/ros2_foxglove_bridge/src/generic_client.cpp +index 7c58801..3e0b015 100644 +--- a/ros2_foxglove_bridge/src/generic_client.cpp ++++ b/ros2_foxglove_bridge/src/generic_client.cpp +@@ -11,17 +11,20 @@ + + // clang-format off + /* True if the version of RCLCPP is at least major.minor.patch */ +-#define RCLCPP_VERSION_GTE(major, minor, patch) \ +- (major < RCLCPP_VERSION_MAJOR \ +- ? true \ +- : major > RCLCPP_VERSION_MAJOR \ +- ? false \ +- : minor < RCLCPP_VERSION_MINOR \ +- ? true \ +- : minor > RCLCPP_VERSION_MINOR \ +- ? false \ +- : patch < RCLCPP_VERSION_PATCH ? true \ +- : patch > RCLCPP_VERSION_PATCH ? false : true) ++#define RCLCPP_VERSION_MAJOR_GT(major) ((major) < RCLCPP_VERSION_MAJOR) ++#define RCLCPP_VERSION_MAJOR_LT(major) ((major) > RCLCPP_VERSION_MAJOR) ++#define RCLCPP_VERSION_MINOR_GT(minor) ((minor) < RCLCPP_VERSION_MINOR) ++#define RCLCPP_VERSION_MINOR_LT(minor) ((minor) > RCLCPP_VERSION_MINOR) ++#define RCLCPP_VERSION_PATCH_GT(patch) ((patch) < RCLCPP_VERSION_PATCH) ++#define RCLCPP_VERSION_PATCH_LT(patch) ((patch) > RCLCPP_VERSION_PATCH) ++ ++#define RCLCPP_VERSION_GTE(major, minor, patch) \ ++ (RCLCPP_VERSION_MAJOR_GT(major) || \ ++ (!RCLCPP_VERSION_MAJOR_LT(major) && \ ++ (RCLCPP_VERSION_MINOR_GT(minor) || \ ++ (!RCLCPP_VERSION_MINOR_LT(minor) && \ ++ (RCLCPP_VERSION_PATCH_GT(patch) || \ ++ (!RCLCPP_VERSION_PATCH_LT(patch))))))) + // clang-format on + + namespace { +diff --git a/ros2_foxglove_bridge/src/message_definition_cache.cpp b/ros2_foxglove_bridge/src/message_definition_cache.cpp +index 262c482..2d72a3a 100644 +--- a/ros2_foxglove_bridge/src/message_definition_cache.cpp ++++ b/ros2_foxglove_bridge/src/message_definition_cache.cpp +@@ -234,7 +234,7 @@ const MessageSpec& MessageDefinitionCache::load_message_spec( + } + + // Read the file +- const std::string full_path = share_dir + std::filesystem::path::preferred_separator + *it; ++ const std::string full_path = share_dir + std::string(1, std::filesystem::path::preferred_separator) + *it; + std::ifstream file{full_path}; + if (!file.good()) { + throw DefinitionNotFoundError(definition_identifier.package_resource_name); +@@ -283,11 +283,11 @@ const MessageSpec& MessageDefinitionCache::load_message_spec( + } + + // Find the the subtype that was originally requested and return it. +- const auto it = msg_specs_by_definition_identifier_.find(definition_identifier); +- if (it == msg_specs_by_definition_identifier_.end()) { ++ const auto it_action = msg_specs_by_definition_identifier_.find(definition_identifier); ++ if (it_action == msg_specs_by_definition_identifier_.end()) { + throw DefinitionNotFoundError(definition_identifier.package_resource_name); + } +- return it->second; ++ return it_action->second; + } else if (subfolder == "srv") { + if (definition_identifier.format == MessageDefinitionFormat::IDL) { + RCUTILS_LOG_ERROR_NAMED("foxglove_bridge", +@@ -319,11 +319,11 @@ const MessageSpec& MessageDefinitionCache::load_message_spec( + } + + // Find the the subtype that was originally requested and return it. +- const auto it = msg_specs_by_definition_identifier_.find(definition_identifier); +- if (it == msg_specs_by_definition_identifier_.end()) { ++ const auto it_srv = msg_specs_by_definition_identifier_.find(definition_identifier); ++ if (it_srv == msg_specs_by_definition_identifier_.end()) { + throw DefinitionNotFoundError(definition_identifier.package_resource_name); + } +- return it->second; ++ return it_srv->second; + } else { + // Normal message type. + const MessageSpec& spec = +diff --git a/ros2_foxglove_bridge/src/ros2_foxglove_bridge.cpp b/ros2_foxglove_bridge/src/ros2_foxglove_bridge.cpp +index 0143674..d6876e3 100644 +--- a/ros2_foxglove_bridge/src/ros2_foxglove_bridge.cpp ++++ b/ros2_foxglove_bridge/src/ros2_foxglove_bridge.cpp +@@ -20,7 +20,14 @@ using foxglove::isWhitelisted; + + FoxgloveBridge::FoxgloveBridge(const rclcpp::NodeOptions& options) + : Node("foxglove_bridge", options) { ++#if defined(_MSC_VER) ++ char* rosDistro; ++ std::size_t size; ++ _dupenv_s(&rosDistro, &size, "ROS_DISTRO"); ++ std::unique_ptr release(rosDistro, &free); ++#else + const char* rosDistro = std::getenv("ROS_DISTRO"); ++#endif + RCLCPP_INFO(this->get_logger(), "Starting foxglove_bridge (%s, %s@%s) with %s", rosDistro, + foxglove::FOXGLOVE_BRIDGE_VERSION, foxglove::FOXGLOVE_BRIDGE_GIT_HASH, + foxglove::WebSocketUserAgent()); diff --git a/patch/ros-jazzy-rosx-introspection.unix.patch b/patch/ros-jazzy-rosx-introspection.unix.patch new file mode 100644 index 000000000..a2d095fc4 --- /dev/null +++ b/patch/ros-jazzy-rosx-introspection.unix.patch @@ -0,0 +1,23 @@ +diff --git a/src/ros_parser.cpp b/src/ros_parser.cpp +index 40c161b..8a1523c 100644 +--- a/src/ros_parser.cpp ++++ b/src/ros_parser.cpp +@@ -581,8 +581,7 @@ bool Parser::serializeFromJson(const std::string_view json_string, + } + else + { +- rapidjson::Value next_value = value_field->GetObject(); +- serializeImpl(msg_node_child.get(), &next_value); ++ serializeImpl(msg_node_child.get(), value_field); + } + } + break; +@@ -600,7 +599,7 @@ bool Parser::serializeFromJson(const std::string_view json_string, + auto root_msg = + _schema->field_tree.croot()->value()->getMessagePtr(_schema->msg_library); + +- rapidjson::Value json_root = json_document.GetObject(); ++ rapidjson::Value& json_root = json_document; + serializeImpl(root_msg.get(), &json_root); + + return true; diff --git a/patch/ros-jazzy-rosx-introspection.win.patch b/patch/ros-jazzy-rosx-introspection.win.patch new file mode 100644 index 000000000..60f0afc4d --- /dev/null +++ b/patch/ros-jazzy-rosx-introspection.win.patch @@ -0,0 +1,42 @@ +diff --git a/src/ros_parser.cpp b/src/ros_parser.cpp +index 40c161b..8a1523c 100644 +--- a/src/ros_parser.cpp ++++ b/src/ros_parser.cpp +@@ -581,8 +581,7 @@ bool Parser::serializeFromJson(const std::string_view json_string, + } + else + { +- rapidjson::Value next_value = value_field->GetObject(); +- serializeImpl(msg_node_child.get(), &next_value); ++ serializeImpl(msg_node_child.get(), value_field); + } + } + break; +@@ -600,7 +599,7 @@ bool Parser::serializeFromJson(const std::string_view json_string, + auto root_msg = + _schema->field_tree.croot()->value()->getMessagePtr(_schema->msg_library); + +- rapidjson::Value json_root = json_document.GetObject(); ++ rapidjson::Value& json_root = json_document; + serializeImpl(root_msg.get(), &json_root); + + return true; + +diff --git a/src/ros_utils/message_definition_cache.cpp b/src/ros_utils/message_definition_cache.cpp +index 7c4da1f..41b8f5e 100644 +--- a/src/ros_utils/message_definition_cache.cpp ++++ b/src/ros_utils/message_definition_cache.cpp +@@ -22,3 +22,4 @@ ++#include + #include + #include + #include + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 005588b..16a8b50 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -7,2 +7,3 @@ project(rosx_introspection LANGUAGES CXX VERSION 1.0.2) ++set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + + diff --git a/vinca_linux_64.yaml b/vinca_linux_64.yaml index 43e50e895..ff3299d3f 100644 --- a/vinca_linux_64.yaml +++ b/vinca_linux_64.yaml @@ -88,5 +88,9 @@ packages_select_by_deps: - grid_map + - foxglove_bridge + - foxglove_compressed_video_transport + - foxglove_msgs + patch_dir: patch rosdistro_snapshot: rosdistro_snapshot.yaml diff --git a/vinca_linux_aarch64.yaml b/vinca_linux_aarch64.yaml index 43e50e895..ff3299d3f 100644 --- a/vinca_linux_aarch64.yaml +++ b/vinca_linux_aarch64.yaml @@ -88,5 +88,9 @@ packages_select_by_deps: - grid_map + - foxglove_bridge + - foxglove_compressed_video_transport + - foxglove_msgs + patch_dir: patch rosdistro_snapshot: rosdistro_snapshot.yaml diff --git a/vinca_osx.yaml b/vinca_osx.yaml index 8bd419f89..d0d74af2f 100644 --- a/vinca_osx.yaml +++ b/vinca_osx.yaml @@ -97,5 +97,9 @@ packages_select_by_deps: - grid_map + - foxglove_bridge + - foxglove_compressed_video_transport + - foxglove_msgs + patch_dir: patch rosdistro_snapshot: rosdistro_snapshot.yaml diff --git a/vinca_osx_arm64.yaml b/vinca_osx_arm64.yaml index e08c84047..fa576bdac 100644 --- a/vinca_osx_arm64.yaml +++ b/vinca_osx_arm64.yaml @@ -97,5 +97,9 @@ packages_select_by_deps: - grid_map + - foxglove_bridge + - foxglove_compressed_video_transport + - foxglove_msgs + patch_dir: patch rosdistro_snapshot: rosdistro_snapshot.yaml diff --git a/vinca_win.yaml b/vinca_win.yaml index 3e0527200..4c37e4515 100644 --- a/vinca_win.yaml +++ b/vinca_win.yaml @@ -98,6 +98,9 @@ packages_select_by_deps: - ament_cmake_mypy - rosbridge_suite + - foxglove_bridge + # - foxglove_compressed_video_transport + - foxglove_msgs patch_dir: patch rosdistro_snapshot: rosdistro_snapshot.yaml