navigation2 icon indicating copy to clipboard operation
navigation2 copied to clipboard

Revamp nav2_behavior_tree CMakeLists.txt to use modern idioms.

Open clalancette opened this issue 1 year ago • 17 comments

Basic Info

Info Please fill out this column
Ticket(s) this addresses Follow-up to #4357
Primary OS tested on Ubuntu 24.04
Robotic platform tested on N/A
Does this PR contain AI generated software? No

Description of contribution in a few bullet points

This commit does a number of things:

  1. Switches to using target_link_libraries everywhere. This gives us finer-grained control over what dependencies are exported to downstream as public, or private. In the particular case of nav2_behavior_tree, this actually doesn't matter too much, but it will help for other packages.
  2. Moves the include directory down one level to include/${PROJECT_NAME}, which is best practice in ROS 2 since Humble.
  3. Makes sure to export nav2_behavior_tree as a CMake target, so downstream users of it can use that target.
  4. Removes the use of boost. To do this, we had to introduce our own version of the "split_string" method.
  5. Moves the test_action_server.hpp file into the main include directory. This is slightly odd, but because downstream packages (opennav_docking_bt) depend on this header file to compile their own tests, it is technically part of the public interface.

Description of documentation updates required from your changes

None needed.


Future work that may be required in bullet points

The rest of the packages in this repository need a similar treatment (PRs will be upcoming).

For Maintainers:

  • [ ] Check that any new parameters added are updated in docs.nav2.org
  • [ ] Check that any significant change is added to the migration guide
  • [ ] Check that any new features OR changes to existing behaviors are reflected in the tuning guide
  • [ ] Check that any new functions have Doxygen added
  • [ ] Check that any new features have test coverage
  • [ ] Check that any new plugins is added to the plugins page
  • [ ] If BT Node, Additionally: add to BT's XML index of nodes for groot, BT package's readme table, and BT library lists

clalancette avatar Jun 24 '24 23:06 clalancette

@clalancette, your PR has failed to build. Please check CI outputs and resolve issues. You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

mergify[bot] avatar Jun 24 '24 23:06 mergify[bot]

@clalancette, your PR has failed to build. Please check CI outputs and resolve issues. You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

mergify[bot] avatar Jun 24 '24 23:06 mergify[bot]

This one needs a release of behaviortree.cpp to be done so we can get the exported target there. I'll contact the maintainers tomorrow and see if we can get a release of that.

clalancette avatar Jun 24 '24 23:06 clalancette

Are these changes backportable to Jazzy or only rolling?

SteveMacenski avatar Jun 25 '24 01:06 SteveMacenski

Are these changes backportable to Jazzy or only rolling?

They are backportable to Jazzy, assuming that https://github.com/BehaviorTree/BehaviorTree.CPP/pull/826 is released into Jazzy (it has not yet been, as far as I can tell).

clalancette avatar Jun 25 '24 11:06 clalancette

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

mergify[bot] avatar Jun 25 '24 17:06 mergify[bot]

@clalancette thanks for all this work, especially this package + Smac Planner + MPPI + System Tests are the largest time hogs so even this alone probably cuts off minutes. It would be great if during these PRs you gave a ballpark of time saved for that package and/or stack. Nothing formal, just something to acknowledge your efforts for.

I was curious to know what capacity you're working on this. Is this something of your own volition to help me / the community / yourself if doing stuff on the rare occasion that Nav2 needs assistance -- or is this something Intrinsic needs bc you're looking at starting to use it?

SteveMacenski avatar Jun 25 '24 18:06 SteveMacenski

Is this something of your own volition to help me / the community / yourself if doing stuff on the rare occasion that Nav2 needs assistance

It is me doing it on my own volition. I've been using Navigation2 as a test bed for rmw_zenoh work, and I noticed that the compile times were high, so I decided to look into it.

It would be great if during these PRs you gave a ballpark of time saved for that package and/or stack. Nothing formal, just something to acknowledge your efforts for.

I can give some numbers as I open PRs, but this is unfortunately a case where we won't see a lot of savings until we get the bulk of it done. That is, most of savings are going to be when the downstream packages can rely on the exported targets, rather than the LIBRARIES/INCLUDE_DIRS.

One other thing I'll mention is that I started this journey on the iron branch, and there, this series made a huge difference (as stated in https://github.com/ros-navigation/navigation2/pull/4357, I went from 22 minutes to 9 minutes locally). As I've been porting to the main branch, I've been seeing less of a difference. I'm not sure if that is because main is just better to start with, or if it's because I haven't yet ported everything over yet.

clalancette avatar Jun 25 '24 20:06 clalancette

Got it! Your help is much appreciated :saluting_face:

as a test bed for rmw_zenoh work

I had some threads with Angelo on this but haven't heard back.. I need to ping them. I wanted to add into our build matrix to run Zenoh once the binaries are available like we have to run Fast/Cyclone on our nightlies. That'll show issues if they exist. Even now, Fast and Cyclone fail on different things.

One other thing I'll mention is that I started this journey on the iron branch, and there, this series made a huge difference (as stated in https://github.com/ros-navigation/navigation2/pull/4357, I went from 22 minutes to 9 minutes locally). As I've been porting to the main branch, I've been seeing less of a difference. I'm not sure if that is because main is just better to start with, or if it's because I haven't yet ported everything over yet.

Must be - Iron is pretty close or essentially the same as main. Probably just not ported yet!

SteveMacenski avatar Jun 25 '24 20:06 SteveMacenski

@clalancette, your PR has failed to build. Please check CI outputs and resolve issues. You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

mergify[bot] avatar Jun 25 '24 21:06 mergify[bot]

It would be great if during these PRs you gave a ballpark of time saved for that package and/or stack. Nothing formal, just something to acknowledge your efforts for.

I can give some numbers as I open PRs

As a not very scientific number, locally I went from a compile time for all of navigation2 of 10 minutes 32 seconds on main to 10 minutes 19 seconds with this PR.

clalancette avatar Jun 26 '24 14:06 clalancette

I think just waiting on the BT stuff to sync (and perhaps https://github.com/ros-navigation/navigation2/pull/4485#discussion_r1655183962?)? Otherwise, let me know when we can retrigger CI for this to go on!

SteveMacenski avatar Jun 26 '24 16:06 SteveMacenski

I think just waiting on the BT stuff to sync (and perhaps #4485 (comment)?)? Otherwise, let me know when we can retrigger CI for this to go on!

Yep, exactly. Once those are synced out, we can rerun CI on this and it should pass.

clalancette avatar Jun 26 '24 17:06 clalancette

OK, if there's others you can open while we wait, happy to have a few of these open in parallel. Whatever works for you :-)

SteveMacenski avatar Jun 26 '24 17:06 SteveMacenski

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

mergify[bot] avatar Jun 27 '24 18:06 mergify[bot]

Fixed the merge conflict :+1:

SteveMacenski avatar Jun 27 '24 18:06 SteveMacenski

@clalancette, your PR has failed to build. Please check CI outputs and resolve issues. You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

mergify[bot] avatar Jun 27 '24 18:06 mergify[bot]

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

mergify[bot] avatar Jul 05 '24 17:07 mergify[bot]

@clalancette, your PR has failed to build. Please check CI outputs and resolve issues. You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

mergify[bot] avatar Jul 08 '24 15:07 mergify[bot]

All right, so this now builds against the latest Rolling. Unfortunately, it looks like the test_goal_updater_node test is failing now, but that is also failing on the main branch for me locally. So I think this is blocked until that is fixed, then we can consider merging this.

clalancette avatar Jul 22 '24 20:07 clalancette

Unfortunately, it looks like the test_goal_updater_node test is failing now, but that is also failing on the main branch for me locally. So I think this is blocked until that is fixed, then we can consider merging this.

Its failing in our CI too for the last ~week or so, I'm not sure why that popped up out of no where, but that's not related to this PR. We can merge this now I think and no worse for ware. Are you OK with that?

SteveMacenski avatar Jul 22 '24 20:07 SteveMacenski

Its failing in our CI too for the last ~week or so, I'm not sure why that popped up out of no where, but that's not related to this PR. We can merge this now I think and no worse for ware. Are you OK with that?

Yep, that sounds good to me. Thanks!

clalancette avatar Jul 23 '24 10:07 clalancette