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

Fix Wrong Map Pointer (#3311) #3315

Merged
merged 1 commit into from
Dec 6, 2022
Merged

Fix Wrong Map Pointer (#3311) #3315

merged 1 commit into from
Dec 6, 2022

Conversation

borongyuan
Copy link
Contributor


Basic Info

Info Please fill out this column
Ticket(s) this addresses #3311
Primary OS tested on Ubuntu
Robotic platform tested on Gazebo Simulation of TurtleBot3, Our Own Robot)

Description of contribution in a few bullet points

Not assigning fixed map pointer to particle filter, using latest when resample.

Description of documentation updates required from your changes


Future work that may be required in bullet points

For Maintainers:

  • Check that any new parameters added are updated in navigation.ros.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

Not assigning fixed map pointer to particle filter, using latest when resample.

(cherry picked from commit cc6f205)

Signed-off-by: Borong Yuan <yuanborong@hotmail.com>
@mergify
Copy link
Contributor

mergify bot commented Dec 6, 2022

@borongyuan, please properly fill in PR template in the future. @SteveMacenski, use this instead.

  • Check that any new parameters added are updated in navigation.ros.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

@SteveMacenski SteveMacenski linked an issue Dec 6, 2022 that may be closed by this pull request
Copy link
Member

@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.

@mikeferguson can you let me know if this looks good to you? You have far more experience in the AMCL codebase than I.

@mikeferguson
Copy link
Contributor

So, comparing this against ROS1, this looks like it will work - but there may be other issues lurking:

  • In ROS1 - the function handleMapMessage() resets the particle filter instance entirely after loading the map
  • In ROS2 - the function handleMapMessage() just updates the map, and does nothing else....

@SteveMacenski
Copy link
Member

SteveMacenski commented Dec 6, 2022

Ugh. The person that migrated AMCL to ROS 2 had the best intentions of cleaning things up, but ended up creating more issues than solving problems. I'll merge in this fix for @borongyuan but this may be something that needs to be revisited in more detail if any more issues come up.

It may be worth a re-port

@SteveMacenski SteveMacenski merged commit 85735ea into ros-navigation:main Dec 6, 2022
1 check passed
jwallace42 pushed a commit to jwallace42/navigation2 that referenced this pull request Dec 14, 2022
Not assigning fixed map pointer to particle filter, using latest when resample.

(cherry picked from commit cc6f205)

Signed-off-by: Borong Yuan <yuanborong@hotmail.com>

Signed-off-by: Borong Yuan <yuanborong@hotmail.com>
andrewlycas pushed a commit to StratomInc/navigation2 that referenced this pull request Feb 23, 2023
Not assigning fixed map pointer to particle filter, using latest when resample.

(cherry picked from commit cc6f205)

Signed-off-by: Borong Yuan <yuanborong@hotmail.com>

Signed-off-by: Borong Yuan <yuanborong@hotmail.com>
@hidmic
Copy link
Contributor

hidmic commented Nov 2, 2023

@SteveMacenski would you consider backporting this patch to Humble?

@SteveMacenski
Copy link
Member

It changes function signatures -- which is an ABI breaking change. Generally I wouldn't backport something but if this resolves a crash I'm more open to it. Can you confirm that you can reproduce a crash that this fully resolves (and understand why it resolves it)?

@hidmic
Copy link
Contributor

hidmic commented Nov 3, 2023

I can confirm, under the exact same conditions described in #3311, BUT I don't have an MRE to share at hand. I can try and craft one.

That said, the problematic execution path is more or less evident once you know where to look. The underlying particle filter is initialized on configure and upon dynamic re-parametrization, but the map gets clobbered and recreated every time a new occupancy grid gets published. It doesn't take much for the underlying particle filter to wind up with a non-owning reference to nothing, which doesn't become a problem unless adaptive resampling is enabled (and the particle filter tries to use that reference).

@SteveMacenski
Copy link
Member

SteveMacenski commented Nov 3, 2023

OK. Backport in progress.

AMCL is a codebase I haven't looked into for a few years. I read through it a few time as an exercise early in my career and intentionally avoided it afterwards for reasons I'm sure you and your team are all too familiar with ;-)

mergify bot pushed a commit that referenced this pull request Nov 3, 2023
Not assigning fixed map pointer to particle filter, using latest when resample.

(cherry picked from commit cc6f205)

Signed-off-by: Borong Yuan <yuanborong@hotmail.com>

Signed-off-by: Borong Yuan <yuanborong@hotmail.com>
(cherry picked from commit 85735ea)
SteveMacenski pushed a commit that referenced this pull request Nov 3, 2023
Not assigning fixed map pointer to particle filter, using latest when resample.

(cherry picked from commit cc6f205)

Signed-off-by: Borong Yuan <yuanborong@hotmail.com>

Signed-off-by: Borong Yuan <yuanborong@hotmail.com>
(cherry picked from commit 85735ea)

Co-authored-by: Borong Yuan <yuanborong@hotmail.com>
RBT22 pushed a commit to EnjoyRobotics/navigation2 that referenced this pull request Nov 16, 2023
…s-navigation#3938)

Not assigning fixed map pointer to particle filter, using latest when resample.

(cherry picked from commit cc6f205)

Signed-off-by: Borong Yuan <yuanborong@hotmail.com>

Signed-off-by: Borong Yuan <yuanborong@hotmail.com>
(cherry picked from commit 85735ea)

Co-authored-by: Borong Yuan <yuanborong@hotmail.com>
RBT22 pushed a commit to EnjoyRobotics/navigation2 that referenced this pull request Nov 16, 2023
…s-navigation#3938)

Not assigning fixed map pointer to particle filter, using latest when resample.

(cherry picked from commit cc6f205)

Signed-off-by: Borong Yuan <yuanborong@hotmail.com>

Signed-off-by: Borong Yuan <yuanborong@hotmail.com>
(cherry picked from commit 85735ea)

Co-authored-by: Borong Yuan <yuanborong@hotmail.com>
redvinaa pushed a commit to EnjoyRobotics/navigation2 that referenced this pull request Nov 20, 2023
…s-navigation#3938)

Not assigning fixed map pointer to particle filter, using latest when resample.

(cherry picked from commit cc6f205)

Signed-off-by: Borong Yuan <yuanborong@hotmail.com>

Signed-off-by: Borong Yuan <yuanborong@hotmail.com>
(cherry picked from commit 85735ea)

Co-authored-by: Borong Yuan <yuanborong@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AMCL Crashes Randomly When Using Recovery Parameters
4 participants