Skip to content
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

Node logging in moveit_core #2503

Merged
merged 9 commits into from
Dec 5, 2023
Merged

Node logging in moveit_core #2503

merged 9 commits into from
Dec 5, 2023

Conversation

tylerjw
Copy link
Member

@tylerjw tylerjw commented Oct 31, 2023

Description

fixes #2502

@codecov
Copy link

codecov bot commented Oct 31, 2023

Codecov Report

Attention: 360 lines in your changes are missing coverage. Please review.

Comparison is base (bddab3f) 50.87% compared to head (2cec4ef) 50.46%.
Report is 2 commits behind head on main.

Files Patch % Lines
moveit_core/planning_scene/src/planning_scene.cpp 25.00% 39 Missing ⚠️
moveit_core/robot_state/src/robot_state.cpp 9.10% 30 Missing ⚠️
moveit_core/robot_model/src/robot_model.cpp 46.16% 28 Missing ⚠️
..._detection/src/allvalid/collision_env_allvalid.cpp 8.70% 21 Missing ⚠️
...istance_field/src/collision_env_distance_field.cpp 44.45% 20 Missing ⚠️
...cessing/src/time_optimal_trajectory_generation.cpp 16.67% 20 Missing ⚠️
moveit_core/robot_state/src/conversions.cpp 22.73% 17 Missing ⚠️
...kinematic_constraints/src/kinematic_constraint.cpp 60.98% 16 Missing ⚠️
...raint_samplers/src/default_constraint_samplers.cpp 42.86% 12 Missing ⚠️
moveit_core/robot_model/src/joint_model_group.cpp 25.00% 12 Missing ⚠️
... and 42 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2503      +/-   ##
==========================================
- Coverage   50.87%   50.46%   -0.41%     
==========================================
  Files         388      387       -1     
  Lines       32253    32148     -105     
==========================================
- Hits        16407    16220     -187     
- Misses      15846    15928      +82     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tylerjw
Copy link
Member Author

tylerjw commented Nov 2, 2023

This one is still not ready... seeing weird test failures locally, will resume working on this tomorrow.

Copy link

mergify bot commented Nov 7, 2023

This pull request is in conflict. Could you fix it @tylerjw?

Copy link

mergify bot commented Nov 21, 2023

This pull request is in conflict. Could you fix it @tylerjw?

Copy link

mergify bot commented Nov 21, 2023

This pull request is in conflict. Could you fix it @tylerjw?

@tylerjw tylerjw force-pushed the logger_moveit_core branch 2 times, most recently from 8f942af to 239c933 Compare November 27, 2023 16:24
Copy link

mergify bot commented Nov 28, 2023

This pull request is in conflict. Could you fix it @tylerjw?

Copy link
Contributor

@sea-bass sea-bass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Things look good, except I have a question about the mix and match of PascalCase and snake_case in all the new logger names that were added. Is there a pattern I missed here for deciding which goes where?

Besides that, a sprinkling of minor comments, some of them not even due to the PR but things I noticed.

@tylerjw
Copy link
Member Author

tylerjw commented Dec 3, 2023

The snake case are functions from ROS where they use the style god intended. The pascal case is from moveit's clang-tidy rules because we match ROS 1 style.

tylerjw and others added 7 commits December 4, 2023 11:21
Signed-off-by: Tyler Weaver <maybe@tylerjw.dev>
Signed-off-by: Tyler Weaver <tyler@picknik.ai>
Signed-off-by: Tyler Weaver <maybe@tylerjw.dev>
Signed-off-by: Tyler Weaver <tyler@picknik.ai>
Signed-off-by: Tyler Weaver <tyler@picknik.ai>
Once you have a child logger you can use it in logging macros:
```C++
RCLCPP_INFO(logger_, "Very important info message");
RCLCPP_INFO(moveit::getLogger("my_namespace"), "Very important info message");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly very stupid question:

Suggested change
RCLCPP_INFO(moveit::getLogger("my_namespace"), "Very important info message");
moveit::logInfo("my_namespace", "Very important info message");

or

Suggested change
RCLCPP_INFO(moveit::getLogger("my_namespace"), "Very important info message");
MOVEIT_INFO("my_namespace", "Very important info message");

do read loads better, right?

I would clearly support a readable wrapper over an awkward combination of MoveIt internal static magic (definitely not what god intended) TOGETHER with C macro magic (which was clearly invented by demons).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the issues I see with those two approaches.

functions

The macros capture the file, function, and line number from the place where the macro is called. If we wrapped the ros logging system in our own functions we would loose that.

our own macros

This is a more ergonomic solution but would require me to write macros that wrap the ros macros. That would be a lot of code to write, test, and maintain. I think this approach is better given that tradeoff.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. We could probably limit a convenience macro wrapper to the plain variants for almost all uses. That approach works well in OMPL and surely others. But then the question would be whether stream or printf-style and combinations might quickly blow up again if people disagree.

Still, an argument slot that only ever contains one generic term in correct usage should not exist either.

Between a rock and a hard place by design.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I think in this case the ROS 2 logging interface is just worse from a usability standpoint. I want to reduce the amount of abstractions I maintain so I don't want to maintain a set of wrapper logging macros. For that reason I think what is in this PR is the best compromise for now.

Copy link
Contributor

@sea-bass sea-bass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just found 1 thing

…n_service_capability.cpp

Co-authored-by: Sebastian Castro <4603398+sea-bass@users.noreply.github.com>
@tylerjw tylerjw enabled auto-merge (squash) December 5, 2023 16:34
@tylerjw tylerjw merged commit 74debfd into main Dec 5, 2023
11 of 12 checks passed
@tylerjw tylerjw deleted the logger_moveit_core branch December 5, 2023 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use node logging in moveit_core
3 participants