-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Enable Groot2 monitoring #5065
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Enable Groot2 monitoring #5065
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
996573c
Revert removing live groot monitoring from Nav2 (#2696)
ajtudela ecfa7f5
Update to Groot2
ajtudela 267dab5
Added JSON conversions
ajtudela 617ba17
Fix rebase
ajtudela 43362e4
Update to nav_msgs::Goals
ajtudela 7a065a4
Added nav_msgs to json utils
ajtudela c41617e
Add register to types
ajtudela 03c22c5
Fix null-dereference
ajtudela 9586fa9
Added Json test
ajtudela de991b3
Fix some tests
ajtudela 82eed37
Fix flake
ajtudela 08b631b
Update package dependency
ajtudela f70e37c
Minor fixes
ajtudela bb7da12
Fix test
ajtudela 31ab621
Rename groot_publisher_port parameter to groot_server_port
ajtudela 2257a61
Minor fix in tst
ajtudela dd186d4
Added JSON for waypoint_status
ajtudela File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
141 changes: 141 additions & 0 deletions
141
nav2_behavior_tree/include/nav2_behavior_tree/json_utils.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,141 @@ | ||
| // Copyright (c) 2025 Alberto J. Tudela Roldán | ||
| // Copyright (c) 2025 Grupo Avispa, DTE, Universidad de Málaga | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| #ifndef NAV2_BEHAVIOR_TREE__JSON_UTILS_HPP_ | ||
| #define NAV2_BEHAVIOR_TREE__JSON_UTILS_HPP_ | ||
|
|
||
| #include <string> | ||
| #include <set> | ||
| #include <vector> | ||
|
|
||
| #include "rclcpp/time.hpp" | ||
| #include "rclcpp/node.hpp" | ||
| #include "behaviortree_cpp/json_export.h" | ||
| #include "geometry_msgs/msg/point.hpp" | ||
| #include "geometry_msgs/msg/pose_stamped.hpp" | ||
| #include "geometry_msgs/msg/quaternion.hpp" | ||
| #include "nav_msgs/msg/goals.hpp" | ||
| #include "nav_msgs/msg/path.hpp" | ||
| #include "nav2_msgs/msg/waypoint_status.hpp" | ||
|
|
||
| // The follow templates are required when using Groot 2 to visualize the BT. They | ||
| // convert the data types into JSON format easy for visualization. | ||
|
|
||
| namespace builtin_interfaces::msg | ||
| { | ||
|
|
||
| BT_JSON_CONVERTER(builtin_interfaces::msg::Time, msg) | ||
| { | ||
| add_field("sec", &msg.sec); | ||
| add_field("nanosec", &msg.nanosec); | ||
| } | ||
|
|
||
| } // namespace builtin_interfaces::msg | ||
|
|
||
| namespace std_msgs::msg | ||
| { | ||
|
|
||
| BT_JSON_CONVERTER(std_msgs::msg::Header, msg) | ||
| { | ||
| add_field("stamp", &msg.stamp); | ||
| add_field("frame_id", &msg.frame_id); | ||
| } | ||
|
|
||
| } // namespace std_msgs::msg | ||
|
|
||
| namespace geometry_msgs::msg | ||
| { | ||
|
|
||
| BT_JSON_CONVERTER(geometry_msgs::msg::Point, msg) | ||
| { | ||
| add_field("x", &msg.x); | ||
| add_field("y", &msg.y); | ||
| add_field("z", &msg.z); | ||
| } | ||
|
|
||
| BT_JSON_CONVERTER(geometry_msgs::msg::Quaternion, msg) | ||
| { | ||
| add_field("x", &msg.x); | ||
| add_field("y", &msg.y); | ||
| add_field("z", &msg.z); | ||
| add_field("w", &msg.w); | ||
| } | ||
|
|
||
| BT_JSON_CONVERTER(geometry_msgs::msg::Pose, msg) | ||
| { | ||
| add_field("position", &msg.position); | ||
| add_field("orientation", &msg.orientation); | ||
| } | ||
|
|
||
| BT_JSON_CONVERTER(geometry_msgs::msg::PoseStamped, msg) | ||
| { | ||
| add_field("header", &msg.header); | ||
| add_field("pose", &msg.pose); | ||
| } | ||
|
|
||
| } // namespace geometry_msgs::msg | ||
|
|
||
| namespace nav_msgs::msg | ||
| { | ||
|
|
||
| BT_JSON_CONVERTER(nav_msgs::msg::Goals, msg) | ||
| { | ||
| add_field("header", &msg.header); | ||
| add_field("goals", &msg.goals); | ||
| } | ||
|
|
||
| BT_JSON_CONVERTER(nav_msgs::msg::Path, msg) | ||
| { | ||
| add_field("header", &msg.header); | ||
| add_field("poses", &msg.poses); | ||
| } | ||
|
|
||
| } // namespace nav_msgs::msg | ||
|
|
||
| namespace nav2_msgs::msg | ||
| { | ||
|
|
||
| BT_JSON_CONVERTER(nav2_msgs::msg::WaypointStatus, msg) | ||
| { | ||
| add_field("waypoint_status", &msg.waypoint_status); | ||
| add_field("waypoint_index", &msg.waypoint_index); | ||
| add_field("waypoint_pose", &msg.waypoint_pose); | ||
| add_field("error_code", &msg.error_code); | ||
| add_field("error_msg", &msg.error_msg); | ||
| } | ||
|
|
||
| } // namespace nav2_msgs::msg | ||
|
|
||
| namespace std | ||
| { | ||
|
|
||
| inline void from_json(const nlohmann::json & js, std::chrono::milliseconds & dest) | ||
| { | ||
| if (js.contains("ms")) { | ||
| dest = std::chrono::milliseconds(js.at("ms").get<int>()); | ||
| } else { | ||
| throw std::runtime_error("Invalid JSON for std::chrono::milliseconds"); | ||
| } | ||
| } | ||
|
|
||
| inline void to_json(nlohmann::json & js, const std::chrono::milliseconds & src) | ||
| { | ||
| js["__type"] = "std::chrono::milliseconds"; | ||
| js["ms"] = src.count(); | ||
| } | ||
|
|
||
| } // namespace std | ||
|
|
||
| #endif // NAV2_BEHAVIOR_TREE__JSON_UTILS_HPP_ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.