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

Initialize particle filter with last known estimate #185

Merged
merged 6 commits into from
May 15, 2023

Conversation

nahueespinosa
Copy link
Member

@nahueespinosa nahueespinosa commented May 12, 2023

Related to #183. Now the particle filter will use the last known estimate for initialization when a new map arrives. Ideally we would update the occupancy grid in the particle filter without losing the current particle set, but that feature doesn't exist in Beluga yet.
Related to #85.

Summary

  • Initialize particle filter with last known estimate when we have a map update
  • Warn when callbacks are ignored
  • Remove this usage for consistency
  • Remove unused member odom_to_base_transform_
  • Change default configuration file to play nicely with the example rosbag
  • Add always_reset_initial_pose parameter
  • Add first_map_only parameter
  • Add mutually exclusive callback group

Checklist

  • Read the contributing guidelines.
  • Configured pre-commit and ran colcon test locally.
  • Signed all commits for DCO.
  • Added tests (regression tests for bugs, coverage of new code for features).
  • Updated documentation (as needed).
  • Checked that CI is passing.

@nahueespinosa nahueespinosa added enhancement New feature or request cpp Related to C++ code labels May 12, 2023
@nahueespinosa nahueespinosa self-assigned this May 12, 2023
@nahueespinosa nahueespinosa force-pushed the nahuel/minor-node-cleanup branch from 5beb4b9 to 7e42e3d Compare May 12, 2023 21:08
* Initialize later maps with last known estimate
* Warn when callbacks are ignored
* Remove `this` usage for consistency
* Remove unused member `odom_to_base_transform_`
* Add `always_reset_initial_pose` parameter
* Add `first_map_only` parameter

Signed-off-by: Nahuel Espinosa <[email protected]>
@nahueespinosa nahueespinosa force-pushed the nahuel/minor-node-cleanup branch from 7e42e3d to b57e8b2 Compare May 12, 2023 21:17
@nahueespinosa nahueespinosa requested a review from glpuga May 12, 2023 21:20
Signed-off-by: Nahuel Espinosa <[email protected]>
Copy link
Collaborator

@hidmic hidmic left a comment

Choose a reason for hiding this comment

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

Is there a way we can validate this functionality in system tests?

beluga_amcl/src/amcl_node.cpp Outdated Show resolved Hide resolved
beluga_amcl/src/amcl_node.cpp Show resolved Hide resolved
@nahueespinosa
Copy link
Member Author

Is there a way we can validate this functionality in system tests?

Those are system tests for the Beluga library. It re-uses Beluga AMCL code, but I hope we can break that dependency at some point. We need to add tests for this node in this package. That's why #101 is still open.

@nahueespinosa nahueespinosa requested a review from hidmic May 14, 2023 21:45
@glpuga
Copy link
Collaborator

glpuga commented May 15, 2023

(I've not seen the code)

Probably reinitializing with the last known estimate is a thing we can do, but I wonder about the usefulness of any type of reinitialization here.

The map could be changed to anything, with little or relation to the previous map, so the previous estimation (in the previous map frame of reference) may be totally random in the new map if the frame changed.

For instance, the one case I know of updating maps while in operation is one of our clients management of lifts. The robot would take the lift, and update the map between floors. In this case, the previous estimate would usually be totally unrelated to the pose of the robot in the new map, so they would have to set the pose as well in sequence.

In the lift example above things would work regardless if we just assume a pose (e.g. the previous estimate) and then the filter estimation is externally set. However, there's a small chance that the glitchy interval between us resetting the previous estimate and the mission control setting a new pose within the updated map might trigger other processes in unfortunate cases (for instance, an alarm because the robot is thought to be close to some dangerous area during the glitch).

I wonder if we should estimate at all if we have a brand new map but no initial pose in it.

@hidmic
Copy link
Collaborator

hidmic commented May 15, 2023

Probably reinitializing with the last known estimate is a thing we can do, but I wonder about the usefulness of any type of reinitialization here.

IMO it's completely useless except during node cycling (deactivate, reactivate). I also agree that in most cases you want the filter to be externally initialized. We still need it for feature parity though.

there's a small chance that the glitchy interval between us resetting the previous estimate and the mission control setting a new pose within the updated map might trigger other processes in unfortunate cases (for instance, an alarm because the robot is thought to be close to some dangerous area during the glitch).

Indeed it would be nice for the node to wait for pose initialization upon map update, perhaps by default.

@glpuga
Copy link
Collaborator

glpuga commented May 15, 2023

We still need it for feature parity though.

+1

Indeed it would be nice for the node to wait for pose initialization upon map update, perhaps by default.

Maybe in the future we can add a parameter to enable this and probably other "sane" behaviors. We would default to full AMCL compatibility, but you can set it to true if you feel like it.

@nahueespinosa
Copy link
Member Author

nahueespinosa commented May 15, 2023

Somewhat related to the conversation, I added a check to verify that the map frame is the global frame (also done in nav2_amcl).
I guess according to REP 105, map is a world fixed frame.

We still need it for feature parity though.

+1

Indeed it would be nice for the node to wait for pose initialization upon map update, perhaps by default.

That can be achieved with the set_initial_pose: false since it will wait for the initial pose topic message. Nevermind.

Maybe in the future we can add a parameter to enable this and probably other "sane" behaviors.

Sounds good! Or we can keep this one and build a new ROS node with the lessons learned.

@nahueespinosa nahueespinosa force-pushed the nahuel/minor-node-cleanup branch from 0a66111 to 8553503 Compare May 15, 2023 15:53
beluga_amcl/src/amcl_node.cpp Outdated Show resolved Hide resolved
Signed-off-by: Nahuel Espinosa <[email protected]>
@nahueespinosa nahueespinosa merged commit ff7b8d1 into main May 15, 2023
@nahueespinosa nahueespinosa deleted the nahuel/minor-node-cleanup branch May 15, 2023 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cpp Related to C++ code enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants