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 differential motion model #28

Merged
merged 3 commits into from
Dec 20, 2022
Merged

Add differential motion model #28

merged 3 commits into from
Dec 20, 2022

Conversation

nahueespinosa
Copy link
Member

@nahueespinosa nahueespinosa commented Dec 19, 2022

This patch adds a differential drive motion model to the main package with its corresponding tests. The implementation is based on Probabilistic Robotics, Chapter 5.4.2 with some extras from the nav2_amcl package that were also re-implemented in QuickMCL:

  • If $\delta_{trans}$ is too small (<0.01 m), set $\delta_{rot1}$ to 0. This avoids some numerical instability when rotating in place.
  • It has a rather neat check for driving backwards, taking the minimum of $\delta_{rotN}$ and $\pi-\delta_{rotN}$ as the basis for the variances. This prevents severe overestimating of the noise when reversing.

See https://vorpal.se/posts/2019/apr/04/amcl-reverse-engineering/#odometry.

Related to #3.

@nahueespinosa nahueespinosa self-assigned this Dec 19, 2022
@nahueespinosa nahueespinosa requested a review from glpuga December 19, 2022 12:09
Copy link
Collaborator

@glpuga glpuga left a comment

Choose a reason for hiding this comment

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

Is the implementation of update_min_d and update_min_a left for the future? ProbRobotics mentions their reason to be as a strategy for variance reduction in p109, section 4.3.4, since a static robot may cause diversity loss in the particle set

(I confess I always though that was more of an implementation specific problem, since even in that case, the motion model should add diversity by adding zero-mean noise, instead of not moving any particle and therefore eventually depleting randomness by leaking it through the resampling process, but they wrote a book, I didn't).

beluga/include/beluga/motion/differential_drive_model.h Outdated Show resolved Hide resolved
beluga/include/beluga/motion/differential_drive_model.h Outdated Show resolved Hide resolved
Base automatically changed from nahuel/sophus to master December 19, 2022 23:28
@nahueespinosa
Copy link
Member Author

nahueespinosa commented Dec 20, 2022

Is the implementation of update_min_d and update_min_a left for the future?

Yes, I'd rather defer that for now, since it affects our resampling strategy. For the record, I've experimented with the extreme case they mention in the book: static robot, no sensor updates, and continuous resampling. Diversity disappears almost immediately leaving a single particle. I've also seen the filter (with sensor updates) converge quickly to a sub-optimal location when the variance of the motion model is small, which will happen if the robot doesn't move.

Regarding the motion update and apply step, I think we can keep updating the particle poses when we skip the resampling step.

@nahueespinosa nahueespinosa requested a review from glpuga December 20, 2022 02:02
glpuga
glpuga previously approved these changes Dec 20, 2022
Copy link
Collaborator

@glpuga glpuga left a comment

Choose a reason for hiding this comment

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

LGTM. Notice that dropping the alpha prefix may make it harder to match parameters in this mcl to parameters in the current AMCL implementation (and the book, fwtw).

@nahueespinosa nahueespinosa merged commit a4f5fb2 into master Dec 20, 2022
@nahueespinosa nahueespinosa deleted the nahuel/motion branch December 20, 2022 13:40
@nahueespinosa nahueespinosa added enhancement New feature or request cpp Related to C++ code labels Jan 7, 2023
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.

2 participants