Repository navigation
Feat/using new tf manager - #6651
Conversation
1c3a093 to
4324cd7
Compare
6cb8951 to
7cdbde7
Compare
SteveMacenski
left a comment
There was a problem hiding this comment.
I think there's more details we can hide/simpify for application code
|
This pull request is in conflict. Could you fix it @nirwester? |
0687793 to
3881d9c
Compare
ec1f47d to
3549bd1
Compare
|
This pull request is in conflict. Could you fix it @nirwester? |
| void setTime(const rclcpp::Time & time) | ||
| { | ||
| ASSERT_EQ(rcl_set_ros_time_override(tf_clock_->get_clock_handle(), time.nanoseconds()), | ||
| RCL_RET_OK); | ||
| } |
There was a problem hiding this comment.
I'm not grokking this change. Why is this required uniquely now? Seems like maybe something AI went a little off a side tangent on
There was a problem hiding this comment.
These tests simulate elapsed time by passing future timestamps, but the manager now internally checks staleness with its own clock_->now(). This makes the test’s supplied timestamp and the manager’s current time advance together.
- get_clock_handle accesses the underlying ROS clock.
- rcl_set_ros_time_override sets its simulated time in nanoseconds
- ASSERT_EQ(..., RCL_RET_OK) checks that setting the clock succeeded.
There was a problem hiding this comment.
Maybe take a look at the architecture if this can be simplified
| rclcpp::Clock::SharedPtr get_clock() | ||
| { | ||
| return tf_clock_ ? tf_clock_ : nav2::LifecycleNode::get_clock(); | ||
| } |
There was a problem hiding this comment.
This lets the same test node support an optional clock controlled by the test (now done only by ClockTester).
Could also be rewritten to use the node’s normal ROS clock for both the node and manager, then use steady_clock for the test’s wait deadlines, which probably would look nicer
SteveMacenski
left a comment
There was a problem hiding this comment.
Via AI:
Error logs are duplicated and the details are lost. Many converted sites call with the default Log::Enabled and then log their own message without passing error_msg. You get two lines per failure, and the caller’s line no longer includes the exception text it used to. Affected sites:
- AMCL addNewScanner and updateFilter
- ObservationBuffer::bufferCloud (both lookups)
- transformPathInTargetFrame
- feasible_path_handler
- costmap_filter
The addNewScanner message now ends with a dangling "...message notifier is in use:" and nothing after it. The consistent pattern is Log::Disabled plus &tf_error wherever the caller logs.
The information is not lost, but it's on a different message, having the internal logger means that what previously was unified in a single message like
Now often looks like a tf error + a separate contextual error.
Currently (according to AI) of 73 calls 12 only log outside (using the debug string), 18 only log inside, 43 have the double log. If we want to avoid the double log, we could
In both cases that would imply adding a lot of std::strings declarations in the codebase for the errors. Let me know if you prefer it to stay as it is, if you prefer following one of the 2 approaches or something else. |
|
From our discussion
|
| // An immediate cleanup must not cancel the executor before spin() starts. | ||
| while (!executor_->is_spinning() && get_node_base_interface()->get_context()->is_valid()) { | ||
| std::this_thread::yield(); | ||
| } |
There was a problem hiding this comment.
This fixes a race conditions on the tests that can happen on rclcpp < 33.1.0: cleanup could run before the executor thread starts, so its stop request gets overwritten and the test hangs waiting for the thread to finish.
This loop waits until the executor starts before allowing cleanup, preventing that race.
Newer version of rclcpp preserve cancellation requested before spin() starts.
If you think this should be removed, as rclcpp has a fix for it already, I can remove it.
| It also allows a central and controlled location to make future changes such as adding tracing, replacing APIs, controlling QoS profiles, or enabling advanced settings. | ||
| Thus, see the migration guide below for how to migrate from the previous versions of these objects to the new ones in this package from ROS 2 Kilted to Lyrical. | ||
|
|
||
| ### Transform manager |
There was a problem hiding this comment.
Now that we're nearing the end of this PR, rewrite this as a human for expaining this object and how to use it. This reads too much like mechanical AI focusing on unimportant implementation details/arguments rather than the high level of what it is, why, and the key APIsto use.
There was a problem hiding this comment.
A few small cleanup details:
Unused clock_ in six BT nodes. GetCurrentPose, RemovePassedGoals, TruncatePathLocal, DistanceTraveled, GoalReached and DistanceController still set it, but nothing uses it now.
IsGoalNearby now reads transform_tolerance_. The member is uninitialized (is_goal_nearby_condition.hpp:95) if the node never declared the parameter, for example in test fixtures. Give it a default of {0.1}; are_poses_near_condition.hpp:89 has the same problem.
How about the clock timing changes for the collision monitor that you were manipulating the clocks for? (#6651 (comment))
There was a problem hiding this comment.
Only 1 open file left on my end is the README. The readme I think you just need to be more human and thoughtful in the write up. These details are the things people actually touch regularly.
You can rebase now as everything else is approved. Afterward, spend a few minutes writing a new readme by hand from scratch to describe the object, its use, and APIs at a high level. You don't need to give all the detail about the implementation to such a degree. This is a high level introduction.
b6b0b01 to
4e44543
Compare
Signed-off-by: Marco Bassa <[email protected]>
…r transform_tolerance Signed-off-by: Marco Bassa <[email protected]>
Signed-off-by: Marco Bassa <[email protected]>
Signed-off-by: Marco Bassa <[email protected]>
Signed-off-by: Marco Bassa <[email protected]>
…hared pointer Signed-off-by: Marco Matteo Bassa <[email protected]>
Signed-off-by: Marco Matteo Bassa <[email protected]>
Signed-off-by: Marco Matteo Bassa <[email protected]>
Signed-off-by: Marco Matteo Bassa <[email protected]>
Signed-off-by: Marco Bassa <[email protected]>
Signed-off-by: Marco Bassa <[email protected]>
…r.cpp Signed-off-by: Steve Macenski <[email protected]>
Signed-off-by: Marco Bassa <[email protected]>
Signed-off-by: Marco Bassa <[email protected]>
Signed-off-by: Marco Bassa <[email protected]>
Signed-off-by: Marco Bassa <[email protected]>
Signed-off-by: Marco Bassa <[email protected]>
Signed-off-by: Marco Bassa <[email protected]>
Signed-off-by: Marco Bassa <[email protected]>
Signed-off-by: Marco Bassa <[email protected]>
Signed-off-by: Marco Bassa <[email protected]>
…tf samples Signed-off-by: Marco Bassa <[email protected]>
Signed-off-by: Marco Bassa <[email protected]>
Signed-off-by: Marco Bassa <[email protected]>
Signed-off-by: Marco Bassa <[email protected]>
4e44543 to
3545002
Compare
| // An immediate cleanup must not cancel the executor before spin() starts. | ||
| while (!executor_->is_spinning() && get_node_base_interface()->get_context()->is_valid()) { | ||
| std::this_thread::yield(); | ||
| } |
There was a problem hiding this comment.
From our previous discussions: please remove this. If this is fixed now, we can remove this.
Signed-off-by: Marco Bassa <[email protected]>
* Pin Fields2Cover to v2.1.1 for the upstreamed fixes Fields2Cover v2.1.1 carries the fixes and APIs this package used to work around: HL_SWATH densification, the corridor headland and the degenerate-polygon guard. (cherry picked from commit 2ef1796, part of #162) Signed-off-by: u33549 <[email protected]> * Drop the unused multi-cell headland overload The server only calls the Field overload; the F2CCells one had no callers left after the headland-first decomposition rework. (cherry picked from commit 93915e2, part of #162) Signed-off-by: u33549 <[email protected]> * Let Fields2Cover densify headland passes Path::discretizeSwath now splits HL_SWATH states as well, so the local copy that did the same is no longer needed. The step guard stays at the call site since Fields2Cover does not clamp a zero step. (cherry picked from commit 195b002, part of #162) Signed-off-by: u33549 <[email protected]> * Carve the inter-cell corridor with Fields2Cover CorridorHL finds the borders cells really share and carves the corridor from the smaller cell. route_headland_width is now the total corridor width; the previous code could carve it from both cells, or miss a partially shared border. Also drops the sliver filter Fields2Cover no longer needs: CorridorHL already removes the zero-width pieces carving leaves, and the degenerate-polygon crash the filter guarded against is fixed upstream. (cherry picked from commit 8ecb2f4, part of #162) (cherry picked from commit a4f3a87, part of #162) Signed-off-by: u33549 <[email protected]> * Remove the unused default_max_swaths_for_global_route parameter It has had no effect since multi-cell TSP routing moved to a per-cell solve; the threshold it set is no longer read. (cherry picked from commit 852e0f1, part of #162) Signed-off-by: u33549 <[email protected]> * Report where a swath ends in the coverage path message With Fields2Cover v2 a straight swath is a single path state, so taking the end from that state's start point gave every swath start == end. Use PathState::atEnd() instead. (cherry picked from commit af70ccf, part of #162) Signed-off-by: u33549 <[email protected]> * Densify GPS paths before leaving the field frame The densification step is in meters, but it ran after the path was converted to the GPS frame, so swath lengths were in degrees and no state was ever split. (cherry picked from commit e7eb93b, part of #162) Signed-off-by: u33549 <[email protected]> * Fix the rolling CI build against nav2 main (#163) * Use the ROS ompl that nav2 main builds against in CI The CI dropped ros-rolling-ompl for the system libompl-dev 1.6 because nav2 main was once written against the older ReedsShepp API. nav2 now builds with the ROS ompl 2.x (and links its ompl::ompl target), so keep it and drop libompl-dev. * Include the ament_index_cpp header the navigator uses coverage_navigator.cpp and its test call get_package_share_directory but relied on nav2 headers to pull it in, which nav2 main no longer does. Include it and declare the dependency. * Build the navigator test's tf objects with the nav2 factories Newer tf2_ros dropped the CreateTimerROS and TransformListener constructors the test used. nav2::create_transform_buffer and create_transform_listener pick the right ones for the installed rclcpp. --------- Adapted for lyrical: the navigator's ament_index_cpp include and dependency are already on lyrical, so only the CI ompl change and the navigator test's tf2 factories apply. Lyrical's CI image, distro and launch_testing shim are kept. (cherry picked from commit eb43d10) Signed-off-by: u33549 <[email protected]> * Build the lyrical CI against nav2's lyrical branch nav2 main changed its TF API in ros-navigation/navigation2#6651 (FeedbackUtils::tf became tf_manager and tf2_factories.hpp is gone), so the navigator no longer builds against it. Lyrical follows nav2's lyrical branch, which keeps the API this package uses. Signed-off-by: u33549 <[email protected]> * Set headers on generated coverage path poses (#159) * Set headers on generated coverage path poses * Set pose headers in the PathState converter --------- Adapted for lyrical: keeps lyrical's existing SWATH densify check in TesttoNavPathMsg. (cherry picked from commit c4c1225) Signed-off-by: Bram Odrosslij <[email protected]> Signed-off-by: u33549 <[email protected]> --------- Signed-off-by: u33549 <[email protected]> Signed-off-by: Bram Odrosslij <[email protected]> Co-authored-by: Bram O <[email protected]>
Basic Info
Description of contribution in a few bullet points
Replaces all calls to the tf buffer with the new tf utils.
Description of documentation updates required from your changes
ros-navigation/docs.nav2.org#954
Description of how this change was tested
Only local tests and TB simulation
Future work that may be required in bullet points
For Maintainers:
backport-*.