You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My understanding of the situation: logging in ROS2 is different than ROS1 due to the lack of a singleton (the assumption that there is one ROS node per process). In ROS2 each call to the logger requires you pass in a logger handle, or the node handle. See this discussion to get the full background.
In order to achieve the MVP of moveit2, I recommend we create the ROS2 node as a global variable, or at least the logger handle as a global variable. This will limit moveit2 from having more than one instance in the same process, but we can fix that in the future.
So, in MoveGroup main function we'll need to create this singleton.
This issue is to track the modification of logging in moveit2. @wjwwood is the lead contact for us who is expert on this issue.
That sounds right to me. I imagine something like moveit_core::get_logger() -> rclcpp::Logger which can be called from anywhere to get a logger to be used locally and a way to set that from something ros specific in main function or core constructor, e.g. moveit_ros::set_logger(my_node->get_logger()) which internally might call moveit_core::set_logger().
Reacted by Víctor Mayoral Vilches and Anas Mchichou El Harrak
@davetcoleman as pointed out at #7 (comment), I think we should address this issue in a separate PR since it'll touch submodules of several of the packages. I presume that changes will need to be made in moveit_ros package, right?
It'll be really helpful to get the logging somewhat addressed before we port the rest of the code. @davetcoleman since you know best the code, can you make an initial prototype extending MoveGroup main function while following the guidelines of @wjwwood? That'll speed things up significantly on our side.
We are systematically porting packages while verifying that things compile (as opposed to porting changes across all moveit2 packages, we don't know the code well enough to be doing so confidently and such ).
Given the discussion above where you'd like to have a global variable (I guess in MoveGroup from what's been discussed in other threads), this approach won't the final however it'll be easily changed in the future and makes now use of RCLPP APIs which will hopefully unblock several PRs which are pending such as #7 or #9.
Let me know if that's acceptable and we'll get it done.
Thanks for putting together this prototype! I'd like some level of buy in from @wjwwood but it seems good to me.
To keep our style guideline roughly the same in moveit2 (see the ROS section of that page), I'd like to keep the namespace variable the same name of LOGNAME. Its also more space efficient.
In this new approach you're proposing, I assume you'll also delete your logging.h ? I was actually a fan of that approach as it would minimize the diff, for now, between ROS1 & 2. Though that isn't super important to me.
Rather than links to lines of code, it's easiest to discuss the proposed change in a PR that targets logging, could you all do that please?
I think we can still use constexpr and store the name as char*'s at the top of the cpp's and create loggers as needed.
I think a good rule would be to use class variables for loggers whenever possible. When this is not possible, we should be generating the logger on the fly from c-style strings with eg RCUTILS_LOG_INFO(LOGNAME, "....");.
Activity
wjwwood commentedon Feb 23, 2019
That sounds right to me. I imagine something like
moveit_core::get_logger() -> rclcpp::Loggerwhich can be called from anywhere to get a logger to be used locally and a way to set that from something ros specific in main function or core constructor, e.g.moveit_ros::set_logger(my_node->get_logger())which internally might callmoveit_core::set_logger().vmayoral commentedon Feb 24, 2019
Thanks for the input @wjwwood.
@davetcoleman as pointed out at #7 (comment), I think we should address this issue in a separate PR since it'll touch submodules of several of the packages. I presume that changes will need to be made in
moveit_rospackage, right?It'll be really helpful to get the logging somewhat addressed before we port the rest of the code. @davetcoleman since you know best the code, can you make an initial prototype extending MoveGroup
mainfunction while following the guidelines of @wjwwood? That'll speed things up significantly on our side.davetcoleman commentedon Feb 24, 2019
I don't think I'll be able to get to this in the next week due to travel, and I don't think I'm the most qualified to prototype this for ROS2.
vmayoral commentedon Feb 26, 2019
@davetcoleman, we finished a prototype in the kinematic_contraints submodule available at https://github.com/AcutronicRobotics/moveit2/blob/master/moveit_core/kinematic_constraints/src/kinematic_constraint.cpp#L52 and used across the code as https://github.com/AcutronicRobotics/moveit2/blob/master/moveit_core/kinematic_constraints/src/kinematic_constraint.cpp#L131.
We are systematically porting packages while verifying that things compile (as opposed to porting changes across all moveit2 packages, we don't know the code well enough to be doing so confidently and such ).
Given the discussion above where you'd like to have a global variable (I guess in MoveGroup from what's been discussed in other threads), this approach won't the final however it'll be easily changed in the future and makes now use of RCLPP APIs which will hopefully unblock several PRs which are pending such as #7 or #9.
Let me know if that's acceptable and we'll get it done.
davetcoleman commentedon Feb 27, 2019
Thanks for putting together this prototype! I'd like some level of buy in from @wjwwood but it seems good to me.
To keep our style guideline roughly the same in moveit2 (see the ROS section of that page), I'd like to keep the namespace variable the same name of
LOGNAME. Its also more space efficient.In this new approach you're proposing, I assume you'll also delete your logging.h ? I was actually a fan of that approach as it would minimize the diff, for now, between ROS1 & 2. Though that isn't super important to me.
Rather than links to lines of code, it's easiest to discuss the proposed change in a PR that targets logging, could you all do that please?
wjwwood commentedon Feb 28, 2019
Looks fine to me, only thing I'd say is that the global logger may also be
staticandconst.background_processing, fix logging
collision_detection, change logging
collision_detection, change logging
transforms, fix logging
transforms, fix logging
mlautman commentedon Mar 4, 2019
(copied and heavily modified from #12 )
According to the ROS/Google style guides, "Objects with static storage duration are forbidden unless they are trivially destructible." It would seem that a global logger like the one in the kinematic_constraints example would violate that. (see: http://wiki.ros.org/CppStyleGuide#Globals,
https://google.github.io/styleguide/cppguide.html#Static_and_Global_Variables)
I think we can still use
constexprand store the name aschar*'s at the top of the cpp's and create loggers as needed.I think a good rule would be to use class variables for loggers whenever possible. When this is not possible, we should be generating the logger on the fly from c-style strings with eg
RCUTILS_LOG_INFO(LOGNAME, "....");.robot_state, fix logging
Exceptions submodule, fix logging
36 remaining items
moveit_core/utils adapt to logging moveit#21
vmayoral commentedon Apr 2, 2019
ros2/rclcpp#680 fixes it. Thanks @wjwwood.
moveit_core/utils adapt to logging moveit#21
Port dynamics_solver to ROS 2 (#67)
Planning interface, port to ROS 2 (#61)
Planning request adapter, port to ROS 2 (#62)
Port moveit_core/kinematics_metrics (#66)
Port kinematics_base submodule moveit_core (#8)
Port moveit_core/utils to ROS 2 (#68)
moveit_core, remove logging submodule (#51)
Port distance_field to ROS 2 (#64)
Trajectory processing, port to ROS 2 (#63)
henningkayser commentedon Dec 7, 2019
Added migration instructions to https://github.com/ros-planning/moveit2/blob/master/doc/MIGRATION_GUIDE.md
fixing up sidebar and rewording (moveit#21)