Added conversion to YAML, JSON and an echo node as example. - #16
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new ros_babel_fish_tools package that adds header-only JSON/YAML serialization utilities for ros_babel_fish dynamic messages, plus an example CLI tool to echo a topic as JSON/YAML.
Changes:
- Add
ros_babel_fish_toolspackage with nlohmann-json and yaml-cpp based conversion helpers and aros_babel_fish_echoexecutable. - Add GTest coverage for JSON/YAML round-trips and bounds/null handling.
- Replace/adjust linting setup (pre-commit + workflow) and remove
ament_lint_auto-based lint deps fromros_babel_fishtests.
Reviewed changes
Copilot reviewed 26 out of 27 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| ros_babel_fish/src/test_messages.h | Remove legacy test helper header. |
| ros_babel_fish/package.xml | Drop ament lint test dependencies. |
| ros_babel_fish/CMakeLists.txt | Remove ament_lint_auto test integration. |
| ros_babel_fish_tools/CMakeLists.txt | Add new tools package build/install + tests. |
| ros_babel_fish_tools/package.xml | Define new tools package dependencies/metadata. |
| ros_babel_fish_tools/src/ros_babel_fish_echo.cpp | New CLI echo node printing first message as JSON/YAML. |
| ros_babel_fish_tools/include/ros_babel_fish_tools/serialization_options.hpp | Add bounds-check behavior enum for deserialization. |
| ros_babel_fish_tools/include/ros_babel_fish_tools/nlohmann_json_serialization.hpp | Public JSON serialization API (header-only). |
| ros_babel_fish_tools/include/ros_babel_fish_tools/_impl/nlohmann_json_serialization.hpp | JSON serialization/deserialization implementation. |
| ros_babel_fish_tools/include/ros_babel_fish_tools/yaml_cpp_serialization.hpp | Public YAML serialization API (header-only). |
| ros_babel_fish_tools/include/ros_babel_fish_tools/_impl/yaml_cpp_serialization.hpp | YAML serialization/deserialization implementation. |
| ros_babel_fish_tools/include/ros_babel_fish_tools/_impl/serialization_exception.hpp | Internal exception type accumulating field path. |
| ros_babel_fish_tools/include/ros_babel_fish_tools/_impl/serialization_helpers.hpp | Shared helpers (wstring/utf8 conversion, traits). |
| ros_babel_fish_tools/include/ros_babel_fish_tools/third_party/nlohmann_json.hpp | Vendored nlohmann::json single header. |
| ros_babel_fish_tools/include/ros_babel_fish_tools/_impl/third_party/utf8.h | Vendored utf8cpp umbrella header. |
| ros_babel_fish_tools/include/ros_babel_fish_tools/_impl/third_party/utf8/core.h | Vendored utf8cpp implementation header. |
| ros_babel_fish_tools/include/ros_babel_fish_tools/_impl/third_party/utf8/checked.h | Vendored utf8cpp implementation header. |
| ros_babel_fish_tools/include/ros_babel_fish_tools/_impl/third_party/utf8/unchecked.h | Vendored utf8cpp implementation header. |
| ros_babel_fish_tools/include/ros_babel_fish_tools/_impl/third_party/utf8/cpp11.h | Vendored utf8cpp implementation header. |
| ros_babel_fish_tools/include/ros_babel_fish_tools/_impl/third_party/utf8/cpp17.h | Vendored utf8cpp implementation header. |
| ros_babel_fish_tools/include/ros_babel_fish_tools/_impl/third_party/utf8/cpp20.h | Vendored utf8cpp implementation header. |
| ros_babel_fish_tools/test/nlohmann_json_serialization.cpp | Add JSON serialization/deserialization tests. |
| ros_babel_fish_tools/test/yaml_cpp_serialization.cpp | Add YAML serialization/deserialization tests. |
| README.md | Document new serialization helpers and echo tool. |
| LICENSE | Update copyright year range. |
| .pre-commit-config.yaml | Add pre-commit config for formatting/linting. |
| .github/workflows/lint-and-test.yaml | Update CI lint steps (clang-format 20 + cppcheck args + exclude third_party). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…PP pointer macros for cppcheck.
45bea34 to
0936fc8
Compare
There was a problem hiding this comment.
Pull request overview
Introduces a new ros_babel_fish_tools ROS 2 package that provides header-only JSON/YAML serialization for ros_babel_fish dynamic messages, plus a small ros_babel_fish_echo CLI example node and accompanying tests/docs.
Changes:
- Added
ros_babel_fish_toolspackage with JSON (nlohmann) and YAML (yaml-cpp) conversion APIs plus bounds-checking options. - Added
ros_babel_fish_echoCLI to print the first received message on a topic as JSON/YAML. - Added extensive gtests for JSON/YAML round-trips and edge cases; updated README/workflow/license and removed an unused legacy test header.
Reviewed changes
Copilot reviewed 23 out of 24 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| ros_babel_fish_tools/test/yaml_cpp_serialization.cpp | Adds gtests for YAML serialization/deserialization behavior (primitives, arrays, bounds, nulls, error wrapping). |
| ros_babel_fish_tools/test/nlohmann_json_serialization.cpp | Adds gtests for JSON serialization/deserialization behavior (round trips, arrays, bounds, nulls, error paths). |
| ros_babel_fish_tools/src/ros_babel_fish_echo.cpp | Adds CLI echo node to print one message as JSON/YAML and exit. |
| ros_babel_fish_tools/package.xml | Declares new ROS 2 package and dependencies for tools/tests. |
| ros_babel_fish_tools/include/ros_babel_fish_tools/yaml_cpp_serialization.hpp | Public YAML serialization API declarations and documentation. |
| ros_babel_fish_tools/include/ros_babel_fish_tools/serialization_options.hpp | Introduces BoundsCheckBehavior options shared by JSON/YAML deserialization. |
| ros_babel_fish_tools/include/ros_babel_fish_tools/nlohmann_json_serialization.hpp | Public JSON serialization API declarations and documentation. |
| ros_babel_fish_tools/include/ros_babel_fish_tools/_impl/yaml_cpp_serialization.hpp | Implements YAML serialization/deserialization and error wrapping. |
| ros_babel_fish_tools/include/ros_babel_fish_tools/_impl/nlohmann_json_serialization.hpp | Implements JSON serialization/deserialization and error wrapping. |
| ros_babel_fish_tools/include/ros_babel_fish_tools/_impl/serialization_helpers.hpp | Adds shared helpers (UTF conversions, array traits) for serializers. |
| ros_babel_fish_tools/include/ros_babel_fish_tools/_impl/serialization_exception.hpp | Adds internal exception type to accumulate field paths and wrap into BabelFishException. |
| ros_babel_fish_tools/include/ros_babel_fish_tools/_impl/third_party/utf8.h | Vendors utf8cpp umbrella header for internal UTF conversions. |
| ros_babel_fish_tools/include/ros_babel_fish_tools/_impl/third_party/utf8/core.h | Vendors utf8cpp core implementation. |
| ros_babel_fish_tools/include/ros_babel_fish_tools/_impl/third_party/utf8/checked.h | Vendors utf8cpp checked API implementation. |
| ros_babel_fish_tools/include/ros_babel_fish_tools/_impl/third_party/utf8/unchecked.h | Vendors utf8cpp unchecked API implementation. |
| ros_babel_fish_tools/include/ros_babel_fish_tools/_impl/third_party/utf8/cpp11.h | Vendors utf8cpp C++11 helpers. |
| ros_babel_fish_tools/include/ros_babel_fish_tools/_impl/third_party/utf8/cpp17.h | Vendors utf8cpp C++17 helpers. |
| ros_babel_fish_tools/include/ros_babel_fish_tools/_impl/third_party/utf8/cpp20.h | Vendors utf8cpp C++20 helpers. |
| ros_babel_fish_tools/CMakeLists.txt | Adds build/install/test rules for the new tools package and echo executable. |
| ros_babel_fish/src/test_messages.h | Removes legacy test helper header (no longer referenced). |
| README.md | Documents new serialization helpers and echo tool usage. |
| LICENSE | Updates copyright year range. |
| .github/workflows/lint-and-test.yaml | Adjusts formatting/lint commands (and excludes third_party from formatting). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
This PR introduces a new ros_babel_fish_tools package that adds header-only JSON/YAML serialization utilities for ros_babel_fish dynamic messages, plus a small CLI “echo” example node.
Changes:
- Add JSON (nlohmann) and YAML (yaml-cpp) conversion APIs with bounds-check options and richer error paths.
- Add a
ros_babel_fish_echoCLI executable that prints the first received message as JSON/YAML. - Add extensive unit tests for JSON/YAML serialization and update CI linting to skip formatting/linting vendored
third_partyheaders.
Reviewed changes
Copilot reviewed 23 out of 24 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
ros_babel_fish_tools/CMakeLists.txt |
Adds new tools package build, tests, and installs the echo tool. |
ros_babel_fish_tools/package.xml |
Declares package dependencies for tools + tests. |
ros_babel_fish_tools/include/.../nlohmann_json_serialization.hpp |
Public JSON serialization/deserialization API. |
ros_babel_fish_tools/include/.../_impl/nlohmann_json_serialization.hpp |
JSON implementation (header-only). |
ros_babel_fish_tools/include/.../yaml_cpp_serialization.hpp |
Public YAML serialization/deserialization API. |
ros_babel_fish_tools/include/.../_impl/yaml_cpp_serialization.hpp |
YAML implementation (header-only). |
ros_babel_fish_tools/include/.../serialization_options.hpp |
Adds BoundsCheckBehavior option shared by JSON/YAML. |
ros_babel_fish_tools/include/.../_impl/serialization_exception.hpp |
Internal exception with accumulated path context. |
ros_babel_fish_tools/include/.../_impl/serialization_helpers.hpp |
Shared helpers (notably UTF conversions). |
ros_babel_fish_tools/include/.../third_party/nlohmann_json.hpp |
Vendored nlohmann json header. |
ros_babel_fish_tools/include/.../_impl/third_party/utf8* |
Vendored utf8 conversion library headers. |
ros_babel_fish_tools/test/nlohmann_json_serialization.cpp |
JSON round-trip and edge-case tests. |
ros_babel_fish_tools/test/yaml_cpp_serialization.cpp |
YAML round-trip and edge-case tests. |
ros_babel_fish_tools/src/ros_babel_fish_echo.cpp |
New CLI echo node implementation. |
.github/workflows/lint-and-test.yaml |
Excludes third_party from clang-format/cppcheck. |
README.md |
Documents serialization APIs and echo tool usage. |
LICENSE |
Updates copyright year range. |
ros_babel_fish/src/test_messages.h |
Removes unused legacy test helper header. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin kilted
git worktree add -d .worktree/backport-16-to-kilted origin/kilted
cd .worktree/backport-16-to-kilted
git switch --create backport-16-to-kilted
git cherry-pick -x c408257b67383024be1691870639e8c129d076ac |
* Added conversion to YAML, JSON and an echo node as example. (cherry picked from commit c408257)



This adds a separate tools package that includes common, useful tools, such as conversion methods from and to JSON and YAML.