Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nav2_msgs/ParticleCloud display plugin #541

Open
wants to merge 2 commits into
base: rolling
Choose a base branch
from

Conversation

naiveHobo
Copy link

Closes #538
Original navigation2 PR ros-navigation/navigation2#1688

Added a display plugin for nav2_msgs/ParticleCloud which closely resembles geometry_msgs/PoseArray display, but scales arrows based on the allotted weights.

@naiveHobo
Copy link
Author

I had to add nav2_msgs as a dependency for rviz_default_plugins which might be a problem since nav2_msgs is not part of the default ros2 packages right now.

@SteveMacenski
Copy link
Contributor

SteveMacenski commented May 7, 2020

We can also move those messages into nav_msgs if you prefer as to not increase dependencies.

We would really like to get this in for Foxy as this is now our state of master branch that will be the nav2 foxy release. We will keep backwards compatibility with the pose array for a few months but it will be dropped relatively quickly because this interface is superior.

Copy link
Contributor

@SteveMacenski SteveMacenski left a comment

Choose a reason for hiding this comment

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

You should add your name to copyright headers

@SteveMacenski
Copy link
Contributor

@clalancette can we get some movement on this? It is blocking some efforts on navigation.

Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

Overall, I'd like to hear reasons we should pull this into the core and not just have it live in navigation2. It seems pretty nav-specific, and adding new stuff this way will increase the core build times. Meanwhile, navigation2 seems to have all of the infrastructure and dependencies it needs to host this.

@@ -63,6 +63,7 @@ find_package(interactive_markers REQUIRED)
find_package(laser_geometry REQUIRED)
find_package(map_msgs REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(nav2_msgs REQUIRED)
Copy link
Contributor

Choose a reason for hiding this comment

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

As you discussed, this could be a problem. I really don't want to add more dependencies to the core, as it is way too big already.

Stepping back, why can this plugin not live in nav2_rviz_plugins? You already have the dependency available there and you have all of the infrastructure.

Copy link
Contributor

@SteveMacenski SteveMacenski May 15, 2020

Choose a reason for hiding this comment

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

I'd be more than happy to move this message to nav_msgs, so if you're OK with that then, I'll make that PR. We can discuss a home below.

Copy link
Member

Choose a reason for hiding this comment

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

I think we should see it moved to nav_msgs or have nav2_msgs accepted into common_interfaces, which is ever is more suitable (sounds like the former). This step ensures the message type being visualized is broad and generic enough to justify shipping with rviz, and is not specific to the nav2 project specifically.

@SteveMacenski
Copy link
Contributor

SteveMacenski commented May 15, 2020

So the home, here are my thoughts.

  • Set 2D pose is pretty navigation specific. You can definitely hijack it for other things, but there's a clear purpose for it
  • Set goal is pretty navigation specific as well. You can definitely validly use it for other things, but there's clear historical purpose to it.
  • The Pose array's basic demo is running AMCL (http://wiki.ros.org/rviz/DisplayTypes/PoseArray), for the 2D case, I think pretty much the only role this finds over arrow visualization_msgs/markers is for navigation

So if Navigation no longer supports the 2D navigation topic (move_base_simple/goal) then we should change that topic - which we did maybe... a year ago? We could have had a nav2 specific rviz plugin for this and asked people to change over to it, but that's a less good out of box experience. If navigation's PF no longer supports PoseArray's I think this is a pretty analog thing since the default intended behavior for users is going to be looking at AMCL clouds which they wouldn't be able to do.

Even a step more, since this is a general message for a particle cloud, it could have uses for other forms of particle cloud visualization from the N forks of AMCL that have exposed this (really, there are a bunch) and other MCL-based localizers like NDT-MCL and other AMCL-3D like variants. It seems to be a sufficiently general and potentially widely used type like any of the other sensor-derived visualizations. This feels to me like a "base" robotics type that would be totally reasonable to expect to be supported out of the box. I think this is also analog to supporting a new class of sensor like a radar, which would also make sense to have default support for, if/when radars get more commonly used on robots (which are rapidly increasing).

Going down the "slippery slope trail" for a moment: Keeping the list of plugins here static seems like it would be a mistake and result in overall stagnation of the project. Even many of these I think should probably be merged here as well for those same reasons to keep RVIZ relevant. Its one of the biggest drawers of users to ROS from industry and more support and more types I think is only better.

@clalancette
Copy link
Contributor

Going down the "slippery slope trail" for a moment: Keeping the list of plugins here static seems like it would be a mistake and result in overall stagnation of the project. Even many of these I think should probably be merged here as well for those same reasons to keep RVIZ relevant. Its one of the biggest drawers of users to ROS from industry and more support and more types I think is only better.

It's not that I (necessarily) want to keep it static. But building rviz_default_plugins is already the longest part of the CI build by a wide margin, and adding more to it is going to make it worse. In my view, rviz has a plugin system for exactly this purpose; so things outside of the core can expand on the core capabilities. From that perspective, I'd actually rather go the other way and move more things out of rviz_default_plugins, and provide them in separate packages.

But I'm sure my opinion isn't universally shared. I guess I'll ask @wjwwood and @ros2/team for some other feedback here.

@Martin-Idel
Copy link
Contributor

Maybe we need some sort of marketplace inside RViz to make it easy to discover and install plugins and then have a discussion about which plugins are absolutely essential and move the others to other packages? And instead add more "helpers" for plugin development (maybe in a separate package)?

@SteveMacenski
Copy link
Contributor

I wouldn't push moving the Navigation2 plugins like the lifecycle manager interface / waypoint follower interface here - but for visualizing basic robotics display types, I really think they should live and be shiped with rviz for out of the box use.

@wjwwood
Copy link
Member

wjwwood commented May 18, 2020

The default plugins is a compromise between the concerns raised here. I really don't want to be adding new message packages and paradigms for the reasons @clalancette pointed out (about this being the whole point of plugins), but if it's a new message that is accepted as broadly useful enough to make it into "common interfaces" then I think it's ok to add it to the default plugins. As @SteveMacenski pointed out, really custom stuff like the lifecycle of nav2 specifically or the "waypoint follower", would not be good candidates for inclusion here, imo.

As for the performance issues of CI, that's a reasonable thing to consider, but I wouldn't use it as the deciding factor in a case like this.

@wjwwood
Copy link
Member

wjwwood commented May 18, 2020

@clalancette can we get some movement on this? It is blocking some efforts on navigation.

I don't understand this, why can this plugin not live in nav2_rviz_plugins for now?

As I see it the necessary steps are (and I know this is only becoming clear now, so I'm not trying to point any fingers):

  • get the message type added into common interfaces to justify its inclusion in rviz's default plugins
  • add the display plugin to rviz
  • deprecate the display plugin it is replacing in nav2_rviz_plugins
  • remove it later

I think we're way too close to foxy to be considering it at this point, especially since it requires additions to common interfaces. If it ends up being completely new stuff (seems to be) then we can add it in a patch release of foxy most likely, but that also means it can wait until things settle down in the release pipeline.

Basically, please don't make this precondition of progress in nav2, we're just going to slow you down.

@wjwwood
Copy link
Member

wjwwood commented May 18, 2020

Even a step more, since this is a general message for a particle cloud, it could have uses for other forms of particle cloud visualization from the N forks of AMCL that have exposed this (really, there are a bunch) and other MCL-based localizers like NDT-MCL and other AMCL-3D like variants.

If the data structure is not specific to nav then maybe it should be in visualization_msgs or geometry_msgs or something? That's a decision for you and the common interface reviewers to decide.

I know I said it already, but I think sorting all of this out is a necessary precondition for having a display plugin for it in rviz's default plugins.

@SteveMacenski
Copy link
Contributor

SteveMacenski commented May 18, 2020

It could live in nav2 for now, but I'm hesitant to merge it if its final home is here. I don't want to merge it there under one name and then transfer it over here under another name (or as the same name and cause potential collisions in the middle of a distribution release cycle). We're currently supporting the PoseArray alongside this ParticleCloud message for backwards compatibility for Foxy. After we branch off Foxy, it will be removed for all future distributions. I don't like the idea of using a temporary fix in place of a permanent one. I'll wait for the permanent one. There's not a big reason to merge it in nav2 for the short term if we are keeping compatibility for Foxy with PoseArray.

Msgs:

If you look over them, I'm not sure there's a whole lot there to argue with, but I have no problem with it not shipping out in the first debian form of Foxy. This isn't massively blocking. However, I imagine once people sit down to review it, it shouldn't be a big deal.

On your point about geometry_msgs or other msgs, agreed. I'm not terribly concerned about the specific package its put into. I think nav_msgs makes most sense as visualization_msgs are typically only useful as visualizations, and this is useful in its own right. An argument could be made for geometry_msgs and that would be fine too.

@naiveHobo please submit a PR to https://github.com/ros2/common_interfaces with these 2 messages and we can follow up there with William and Co.

  • Submit PR for 2 msgs
  • Merge them into some package
  • Remove them from nav2_msgs and use this new message for the rviz plugin / AMCL
  • Merge this
  • Make a happy dance

@jacobperron
Copy link
Member

+1 for waiting on the message's inclusion into common_interfaces.

@wjwwood
Copy link
Member

wjwwood commented May 18, 2020

It could live in nav2 for now, but I'm hesitant to merge it if its final home is here.

I'll just say, having a new plugin start out as in a separate package is way better process in my opinion. It let's people try it now more easily, and it lets you should the value of the plugin when trying to motivate a pull request like this one.

Msgs:

Wait, why not just use a point cloud?

@SteveMacenski
Copy link
Contributor

A custom templated pointcloud in rviz would still require a custom RVIZ plugin to represent the particles' orientations and scores/weights.

@wjwwood
Copy link
Member

wjwwood commented May 19, 2020

Oh, I see, sorry, I misread the particle message.

It would be interesting to have an option to visualize a set of channels in a pointcloud2 as a pose. That way you could use pointcloud2 and get all the tools that come with that automatically.

@SteveMacenski
Copy link
Contributor

I think a pointcloud is not really the right data structure. If it were just a point and a weight, yeah, I could make an argument for that. But because orientation is important, we're now talking about a PointXYZIRPY, which seems excessive.

@wjwwood
Copy link
Member

wjwwood commented May 19, 2020

I think a pointcloud is not really the right data structure

I'm not sure that I agree.

But because orientation is important, we're now talking about a PointXYZIRPY, which seems excessive.

I don't think that it is. It's no more excessive than something like pcl::PointXYZRGBA or similar. And we have special handling for RGB and RGBA in our pointcloud plugin too. Also, I think this could be used to do things like visualize normals which also have an orientation associated with each point. It's likely to be more efficient than your message type as well for large particle fields.

Also, now that I'm thinking about it more, "particle" doesn't really imply anything about orientation to me, I'm guessing it is terminology specific to the type of navigation filters you're using. If we want to generalize it would need to be something like pose cloud or pose with weight cloud or a version of pose array/cloud that has arbitrary channels attached similar to pointcloud2. Which leads me back to the point that the flexibility and structure of pointcloud2 was honed over a long period and is worth reusing if you can.

@SteveMacenski
Copy link
Contributor

SteveMacenski commented May 19, 2020

PointXYZRGBA

Having a colored point from a RGB-D sensor is a reasonable thing to have because its derivative of a sensor for which a Point has some properties to put into a cloud. Having a PointXYZWRPY is not derivative of a set of sensor measurements and is really a Pose with some properties being put into a cloud. I disagree that because you could represent it a certain way, that is the right way to think about it, since it is fundamentally not of a Point type as a Pose (with some related properties). The use of a pointcloud to me seems like an incorrect choice for meaning.

More thematically: your point also then invalidates the concept of the PoseArray message, which was used prior and clearly has a different semantic meaning than a PointCloud, or I don't think it would exist.

A particle in a particle filter to me is a set of quantizations of state of some noisy information. The fact that its called a "particle" shouldn't imply 2D to you or imply 3D pose to me. That's just nomenclature of a higher level concept that an MCL uses.

This seems a little off topic, but we should have it somewhere, whether that's here or in the common_interfaces PR.

Edit: I'm not sure I really care one way or another, I just want to make sure there's a principled reason behind it. Dragging PCL into projects especially should be well reasoned because that's a big dependency to casually add after years of effort to remove it in ROS1.

@wjwwood
Copy link
Member

wjwwood commented May 19, 2020

At least there is a version of point for normals (which I don't feel is that different) in pcl:

https://pointclouds.org/documentation/structpcl_1_1_point_x_y_z_i_normal.html

Having a colored point from a RGB-D sensor is a reasonable thing to have because its derivative of a sensor for which a Point has some properties to put into a cloud.

What does coming from a sensor have to do with it? The points in the point cloud library, while often used with RGBD cameras, are also general data structures that can be used in a variety of ways. It happens that Pointcloud2 is in sensor_msgs in ROS because of how it is traditionally used, but I don't think it should be a tautology, i.e. "Pointcloud2 should only be used with sensor data because it is in sensor_msgs and it is in sensor_msgs because it is only used with sensor data".

More thematically: your point also then invalidates the concept of the PoseArray message, which was used prior and clearly has a different semantic meaning than a PointCloud, or I don't think it would exist.

PoseArray adds some semantic meaning, but it's also older than both point cloud and point cloud 2 if I understand correctly. So, I think it's likely that if PointCloud2 had existed it might have not been created.

A particle in a particle filter to me is a set of quantizations of state of some noisy information. The fact that its called a "particle" shouldn't imply 2D to you or imply 3D pose to me. That's just nomenclature of a higher level concept that an MCL uses.

Which I think lends to my point that having a 3D pose in it makes it more than just a particle, it's a specific kind of particle. For the 3D/2D case we usually say, when doing 2D just use the 3D type and leave z as 0, but if your particle was storing something else, then this name really makes no sense anymore right?

This seems a little off topic, but we should have it somewhere, whether that's here or in the common_interfaces PR.

I agree, I think a lot of what I'm asking now will be seen when considering it for inclusion in a general package.

I do feel, however, that is would be nice to reuse and extend the point cloud display plugin in order to visualize this case, just because it is so flexible and polished. I could see the argument that having a semantically meaningful message is valuable for communicating between nodes and recording and architecture, but I also think it's ok to have something like /particle_cloud and /particle_cloud_as_pointcloud side by side, where the latter is optional and used for visualization. This kind of thing happens a lot, and while not as "clean" as having a custom display plugin, it might benefit from performance improvements and shared maintenance.

Dragging PCL into projects especially should be well reasoned because that's a big dependency to casually add after years of effort to remove it in ROS1.

There's no need for pcl here I think. It's just a good reference for what "points" are being used for more broadly. We've managed to avoid it in a lot of places, e.g.: https://github.com/ros2/common_interfaces/blob/master/sensor_msgs/include/sensor_msgs/point_cloud2_iterator.hpp

@SteveMacenski
Copy link
Contributor

Lets pause and let @naiveHobo jump in as this is his work that I'm just advising / managing. Maybe he totally agrees with you and I'm outvoted and we just do it that way. Either way, before going much deeper on this, he should have his opinion voiced.

The point on sensor data I was trying to make wasn't that PCs are only suited for sensors, but rather an example of where that type of information may derive from because the raw "thing" that it represents is a Point, which then has some attributes about it. The argument I was trying to make is that our core "thing" isn't a point, but a Pose and semantically representing a pose as a point in a pointcloud seems to me like a misrepresentation. All the example PointT's that I am aware of represent points with properties, which I think is enough different from pose with properties it doesn't quite belong.

I can certainly live with it. I think it would be alot more difficult in every way however. I'm not sure there's an option for visualizing points as arrows in the pointcloud2 display, is that then an addition you would merge? Because then the only user of it is this plugin and invalid for all other uses of the pointcloud visualization type.

@naiveHobo
Copy link
Author

I have to say I agree with @SteveMacenski here. There are several messages which can technically be used to carry particle cloud information (visualization_msgs/MarkerArray, or PointCloud2 as @wjwwood pointed out). But the point here is that a message specifically aimed to carry particle cloud information does justice to the concept of particle clouds which is a core part of robotics. We are trying to conform particle clouds to the existing messages to support re-usability but I think a ParticleCloud message will find sufficient usage in the community.

Using PointCloud2 definitely makes it easier to integrate from the visualization perspective but having a core message type to represent particle clouds is semantically the way to go in my opinion.

@naiveHobo
Copy link
Author

Here's the PR on common_interfaces to add Particle and ParticleCloud messages to nav_msgs: ros2/common_interfaces#118

@wjwwood
Copy link
Member

wjwwood commented May 19, 2020

Ok, fair enough. I do think that a "mature" version of ParticleCloud would look very much like Pointcloud2, with channels and binary packing in a type erased data field, but perhaps this is sufficient.

I still have mixed feelings on the name, given particles (even in robotics) need not be poses. But I can comment over there.

@SteveMacenski
Copy link
Contributor

SteveMacenski commented May 19, 2020

but perhaps this is sufficient.

We can always update later based on developing needs. If there's a need that appears that would like to use this, we're open to changes. I prefer to be fluid and then optimize when required - I don't foresee this being something alot of people will need to or want to extend. If you foresee a different future for this and you believe that people will, practically, make substantive changes to a message like this for their different needs, then I agree, maybe we should go the pointcloud route.

wrt the rviz plugin, I still feel that the pointcloud display type with arrows would be more of a user net-negative, since functionally no other PC2 type would use the arrows markers as they lack orientation data. I would though yield that adding a PC2 arrow type could be useful for representing potential fields. That would be nice.

@wjwwood
Copy link
Member

wjwwood commented May 19, 2020

We can always update later based on developing needs. If there's a need that appears that would like to use this, we're open to changes. I prefer to be fluid and then optimize when required - I don't foresee this being something alot of people will need to or want to extend.

This sort of indicates to me that these messages are not ready for standardization, and therefore are not ready for inclusion in nav_msgs nor the default plugins list, but we can discuss it on the other issue.

since functionally no other PC2 type would use the arrows markers as they lack orientation data.

I think it would be useful for Normals, which are just points with orientations associated with them.

@SteveMacenski
Copy link
Contributor

SteveMacenski commented May 19, 2020

This sort of indicates to me that these messages are not ready for standardization, and therefore are not ready for inclusion in nav_msgs nor the default plugins list, but we can discuss it on the other issue.

This is representative of my style, not of the selection of this message. I'd say the same thing about Image, GetPlan, or PoseArray. I have no reason to believe changes will be required, I was giving you an opportunity to defend the claim that there will need to be some extensions later by providing specific evidence or intuition that you think it will be necessary.

We can discuss in the other thread now. Link for posterity: ros2/common_interfaces#118 (review)

@audrow audrow changed the base branch from ros2 to rolling June 28, 2022 14:25
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.

Support for new particle filter messages for AMCL
6 participants