Skip to content

Comments

Switch nav2_rviz_plugins to modern CMake idioms.#4600

Merged
SteveMacenski merged 2 commits intoros-navigation:mainfrom
clalancette:clalancette/main-nav2-rviz-plugins
Aug 7, 2024
Merged

Switch nav2_rviz_plugins to modern CMake idioms.#4600
SteveMacenski merged 2 commits intoros-navigation:mainfrom
clalancette:clalancette/main-nav2-rviz-plugins

Conversation

@clalancette
Copy link
Contributor

In addition, make some fixes to the code to more appropriately hold on to the Node object (there were warnings from the compiler without these fixes).


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

Change nav2_rviz_plugins to use modern CMake idioms:

  1. Make it a "nav2_package". This ended up adding in additional warnings, which then required some code changes to fix. Thus, there are some additional code changes in here to more appropriately hold onto weak pointers.
  2. Switch from ament_target_dependencies to target_link_libraries.
  3. Export the target so downstream CMake consumers can use it.
  4. Push the include directory down one level, which is best practice since Humble.

Description of documentation updates required from your changes

None needed.


Future work that may be required in bullet points

This is part of a larger series to switch Navigation2 to use modern CMake idioms. There will be follow-up PRs converting more of the packages.

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

In addition, make some fixes to the code to more appropriately
hold on to the Node object (there were warnings from the
compiler without these fixes).

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
auto node = getDisplayContext()->getRosNodeAbstraction().lock()->get_raw_node();
node_ptr_ = getDisplayContext()->getRosNodeAbstraction().lock();
if (node_ptr_ == nullptr) {
// The node no longer exists, so just don't initialize
Copy link
Member

Choose a reason for hiding this comment

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

For all: Some kind of log, even if cout, that this is the case would be nice (for all instances)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call. Fixed in 864a450.

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
@SteveMacenski SteveMacenski merged commit 9a5f7b2 into ros-navigation:main Aug 7, 2024
josephduchesne pushed a commit to josephduchesne/navigation2 that referenced this pull request Dec 10, 2024
* Switch nav2_rviz_plugins to modern CMake idioms.

In addition, make some fixes to the code to more appropriately
hold on to the Node object (there were warnings from the
compiler without these fixes).

Signed-off-by: Chris Lalancette <clalancette@gmail.com>

* Feedback from review.

Signed-off-by: Chris Lalancette <clalancette@gmail.com>

---------

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
Signed-off-by: Joseph Duchesne <josephgeek@gmail.com>
stevedanomodolor pushed a commit to stevedanomodolor/navigation2 that referenced this pull request Apr 29, 2025
* Switch nav2_rviz_plugins to modern CMake idioms.

In addition, make some fixes to the code to more appropriately
hold on to the Node object (there were warnings from the
compiler without these fixes).

Signed-off-by: Chris Lalancette <clalancette@gmail.com>

* Feedback from review.

Signed-off-by: Chris Lalancette <clalancette@gmail.com>

---------

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
Signed-off-by: stevedanomodolor <stevedan.o.omodolor@gmail.com>
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.

2 participants