Repository navigation
Add rcutils debug macros to map_server. - #18
Conversation
|
Nice! |
|
I was going to do that, but I think @dhood already swapped the macros out. |
|
In that case can we use the same logc here to be consistent across packages in the same repo ? I assume that @dhood did that to reduce the diff with upstream |
I would have, but the I could undo those changes to mirror |
|
yeah I think it would be better if we want to keep the diff with upstream minimal. But I don't feel very strongly about it. |
wjwwood
left a comment
There was a problem hiding this comment.
Thanks!
I'm agnostic about having faux ROS_* macros. I would like it, but I don't think it makes much of a difference in this case. So I'll leave it up to @allenh1 to either make them or not.
I do ask that you fix up the usage of trailing \n's.
| std::ifstream fin(fname.c_str()); | ||
| if (fin.fail()) { | ||
| fprintf(stderr, "Map_server could not open %s.\n", fname.c_str()); | ||
| RCUTILS_LOG_ERROR("Map_server could not open %s.\n", fname.c_str()); |
There was a problem hiding this comment.
Please remove the trailing \n too. They were not necessary with ROS_ERROR and I don't think they're necessary/appropriate when used with the RCUTILS_LOG_* macros either.
There was a problem hiding this comment.
Please remove the trailing \n too.
Good catch!
At this point (as the change had been made earlier), I feel it is best to just go ahead and change to RCUTILS_LOG_*.
|
Ok, should be good now. I don't think it's worth running CI for this change, right? Since it's just print macros... |
|
Please do run CI. |
| #include <memory> | ||
|
|
||
| #include <rclcpp/rclcpp.hpp> | ||
| #include <rcutils/logging_macros.h> |
There was a problem hiding this comment.
I think you need to update the package.xml and CMakeLists.txt to depend on and use rcutils since it's being used directly.
mikaelarguedas
left a comment
There was a problem hiding this comment.
please remove the semi-colon after the macro call so that if the macro is evaluated to nothing the code can still compile
Ok. Will do.
@wjwwood The turtlebot demo ones, right? |
|
@mikaelarguedas how's that? |
| map_resp_.map.info.width, | ||
| map_resp_.map.info.height, | ||
| map_resp_.map.info.resolution); | ||
| RCUTILS_LOG_INFO("Read a %d X %d map @ %.3lf m/cell", |
There was a problem hiding this comment.
Nit: please wrap after the open parenthesis so that we don't need to reindent the bloc when the macro name changes
mikaelarguedas
left a comment
There was a problem hiding this comment.
looks good, thanks for iterating
| add_executable(map_server src/main.cpp) | ||
| ament_target_dependencies(map_server | ||
| "nav_msgs" | ||
| "rcutils" |
|
Ok, that should do it. I'll merge once we hear back from the CI. |
|
👍 feel free to merge it once ci comes back green |
| if(argc != 3 && argc != 2) | ||
| { | ||
| fprintf(stderr, "%s\n", USAGE); | ||
| RCUTILS_LOG_ERROR("%s\n", USAGE) |
There was a problem hiding this comment.
The trailing newline is not necessary anymore.
There was a problem hiding this comment.
Ah crap. Looks like I missed one. I'll file a new PR in a few.
* remove AMENT_IGNORE and vestigial files * style fixes, trailing whitespace and typos * port to ROS 2 * use existing rclcpp syntax for now fix package.xml (#2) use updated rclcpp syntax for get_parameter_or (#4) Export map_server libraries (#7) * Export libraries * Use name of library * ament_export_libraries takes list of strings * Revert "ament_export_libraries takes list of strings" This reverts commit 630312b. Switch use of rcl_system_time_now to rcutils_system_time_now. (#8) Signed-off-by: Chris Lalancette <[email protected]> Port AMCL to ROS 2 (and tf2) (#9) * Remove dynamic reconfigure * Remove rosbag functionality * Remove message filter use * tf -> tf2 * Strip leading / from frame IDs * Re-enable message filter * Don't use deperecated quaternion constructor * Revert "Re-enable message filter" This reverts commit c4160c2. * Fix test failures by increasing transform timeouts * WIP ros1->ros2 * Namespace of ::msg or ::srv * ConstPtr -> ::ConstPtr * ros::Time -> tf2::TimePoint * ros::Duration -> tf2::Duration * ros -> rclcpp * ros2 timer * Disable sigint handler * Not using boost::shared_ptr * Appropriate boost header for recursive_mutex * Shared ptrs everywhere * Use new durationFromSec tf2 function * Subscribers using qos settings * Leftover missing ::msg * Use new tf2_ros::fromMsg * Reinstate node ptr * Disable most logging * chrono fix * 'msg.' -> 'msg->' * Store node * Create services properly * Set parameters * Comment more logging * tf2 fixes * fix service callback signatures * tf2 changes * misc * only callbacks use shared_ptr * map request service * Fix boost link error * Comment these for now just to move forward * Use ament_auto_package * tf2::Duration -> tf2::durationFromSec * Re-enable "logging" * Prevent node already added to executor crash * (hack) use 'latest' TF info * Debug * Fixup (whitespace etc) * Use rate for map request * Don't use tf2 time for checkLaserReceived timer * Clarify which TODOs are for before merge * Add wait_for_service * Restore initial qos choices * Restore tolerance * Demo ROS 1 launch file to be used with bridge * [hack] Use map from topic instead of service * Remove debug prints * It probably won't be the map server publishing the map topic in that case (or we'd use the service) * Expose use_map_topic as command line option * Put initial pose back to 0 (can be set on 'initialpose' topic) * Use tf2 time because ROS times can't be subtracted a.t.m. * Revert test tolerance increase (needed for use without message filters) * Remove commented delete that will never be re-enabled * Tidy up workaround for 'latest' TF data If the timestamp of the requested transform is 0 it will get latest * Remove most workarounds for 'latest' TF data * Prevent unused variable warnings * Remove boost dependency * Use CMAKE_CXX_STANDARD * Alphabetical ordering * Whitespace fixup * Leftover debug prints * Restore original default d_thresh * Revert "Prevent unused variable warnings" This reverts commit e624b1f. * Prevent unused variable warnings * Let ament_cmake_ros have control over the BUILD_SHARED_LIBS cmake flag * Pedantic is a bit much * simplify ament_target_dependencies call * Correct usage of ament_target_dependencies * Remove custom leading forward slash removal Not necessary in ROS 2 * Remove ROS 1 testing launch file * Avoid race condition with map_server topic usage Issue with large services using fastrtps use CMAKE_X_STANDARD and check compiler rather than platform Remove dependency on rostest. (#10) amcl integration: best effort QoS for laser scan subscription (#11) * Make laser subscription best effort Otherwise it can't subscribe to best effort publishers (and is generally more appropriate) * Use rcutils logging macros * Start a parameter server for external nodes to interact with * Reduce diff with upstream Move map server executables to libexec directory (#12) use new namespace (#13) Exporting the map_server include directory (#14) disable everything for now with AMENT_IGNORE files ROS 2 port of map_server (#1) * remove AMENT_IGNORE and vestigial files * style fixes, trailing whitespace and typos * port to ROS 2 * use existing rclcpp syntax for now fix package.xml (#2) use updated rclcpp syntax for get_parameter_or (#4) Switch use of rcl_system_time_now to rcutils_system_time_now. (#8) Signed-off-by: Chris Lalancette <[email protected]> Port AMCL to ROS 2 (and tf2) (#9) * Remove dynamic reconfigure * Remove rosbag functionality * Remove message filter use * tf -> tf2 * Strip leading / from frame IDs * Re-enable message filter * Don't use deperecated quaternion constructor * Revert "Re-enable message filter" This reverts commit c4160c2. * Fix test failures by increasing transform timeouts * WIP ros1->ros2 * Namespace of ::msg or ::srv * ConstPtr -> ::ConstPtr * ros::Time -> tf2::TimePoint * ros::Duration -> tf2::Duration * ros -> rclcpp * ros2 timer * Disable sigint handler * Not using boost::shared_ptr * Appropriate boost header for recursive_mutex * Shared ptrs everywhere * Use new durationFromSec tf2 function * Subscribers using qos settings * Leftover missing ::msg * Use new tf2_ros::fromMsg * Reinstate node ptr * Disable most logging * chrono fix * 'msg.' -> 'msg->' * Store node * Create services properly * Set parameters * Comment more logging * tf2 fixes * fix service callback signatures * tf2 changes * misc * only callbacks use shared_ptr * map request service * Fix boost link error * Comment these for now just to move forward * Use ament_auto_package * tf2::Duration -> tf2::durationFromSec * Re-enable "logging" * Prevent node already added to executor crash * (hack) use 'latest' TF info * Debug * Fixup (whitespace etc) * Use rate for map request * Don't use tf2 time for checkLaserReceived timer * Clarify which TODOs are for before merge * Add wait_for_service * Restore initial qos choices * Restore tolerance * Demo ROS 1 launch file to be used with bridge * [hack] Use map from topic instead of service * Remove debug prints * It probably won't be the map server publishing the map topic in that case (or we'd use the service) * Expose use_map_topic as command line option * Put initial pose back to 0 (can be set on 'initialpose' topic) * Use tf2 time because ROS times can't be subtracted a.t.m. * Revert test tolerance increase (needed for use without message filters) * Remove commented delete that will never be re-enabled * Tidy up workaround for 'latest' TF data If the timestamp of the requested transform is 0 it will get latest * Remove most workarounds for 'latest' TF data * Prevent unused variable warnings * Remove boost dependency * Use CMAKE_CXX_STANDARD * Alphabetical ordering * Whitespace fixup * Leftover debug prints * Restore original default d_thresh * Revert "Prevent unused variable warnings" This reverts commit e624b1f. * Prevent unused variable warnings * Let ament_cmake_ros have control over the BUILD_SHARED_LIBS cmake flag * Pedantic is a bit much * simplify ament_target_dependencies call * Correct usage of ament_target_dependencies * Remove custom leading forward slash removal Not necessary in ROS 2 * Remove ROS 1 testing launch file * Avoid race condition with map_server topic usage Issue with large services using fastrtps use CMAKE_X_STANDARD and check compiler rather than platform Remove dependency on rostest. (#10) amcl integration: best effort QoS for laser scan subscription (#11) * Make laser subscription best effort Otherwise it can't subscribe to best effort publishers (and is generally more appropriate) * Use rcutils logging macros * Start a parameter server for external nodes to interact with * Reduce diff with upstream Move map server executables to libexec directory (#12) use new namespace (#13) Exporting the map_server include directory (#14) Fixed GCC 8.0 compiler warning. Fix compilation, as well as remove more warnings. Fix GCC 8 warnings for map_server. Add rcutils debug macros to map_server. (#18) * Add rcutils debug macros to map_server. * Addresses comments by @wjwwood * Updated package.xml and CMakeLists.txt to add rcutils dependency. * Remove ';' from the ends of macro calls. * Address comments by @mikaelarguedas Remove extra newline (#19) use ament_cmake_pytest instead of ament_cmake_nose (#22) Make amcl compile again with the recent changes to rclcpp::Time. (#23) * Make amcl compile again with the recent changes to rclcpp::Time. Signed-off-by: Chris Lalancette <[email protected]> * Initialize the timesource and clock in the AmclNode constructor. Then just call "clock->now()" where we need it. Signed-off-by: Chris Lalancette <[email protected]> * Remove rclcpp_now completely. Signed-off-by: Chris Lalancette <[email protected]> * Fix to not pass node to clock->now Signed-off-by: Chris Lalancette <[email protected]> * Change ts -> timesource. Signed-off-by: Chris Lalancette <[email protected]> looks like logging is initialized automatically now, fixes warning (#24) Update for rclcpp namespace removals (#25) * Remove client:: namespace * Remove service:: namespace * Remove parameter_service:: namespace * Remove rate:: namespace * Remove node:: namespace Update maintainers and version ahead of Ardent release (#26) * Update maintainers and version ahead of Ardent release * Prev maintainers -> authors * Level all versions so bloom doesn't complain
When rebasing yesterday, I noticed that this package had not been changed to use the logging macros yet.