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

Discount the scaling of future footprints when scoring a trajectory #90

Merged
merged 4 commits into from
Nov 30, 2023

Conversation

siferati
Copy link

@siferati siferati commented Nov 15, 2023

Description

The obstacle cost critic scales the footprint of the robot when scoring the trajectory.
And uses this scaled footprint to check for collisions at each trajectory point.
This means that DWA will start slowing down when there is an obstacle touching the scaled footprint in the last point of the trajectory.

This PR adds a discount factor to apply to the scaling of the future footprints.
This works similarly to typical RL algorithms:

scaling(t₀) = scale
scaling(t₁) = discount_factor * scale
scaling(t₂) = discount_factor * discount_factor * scale
...
scaling(tₙ) = discount_factorⁿ * scale

As a bonus also added visualization for all of the future footprints.
This should help us tune the parameter and understand when DWA starts braking early.
Future footprints are under a different namespace, such that we can disable the noise and visualize only the current one.

By default the parameter is set to 1.0, meaning it's the same behavior as current devel.

Demo

2023-11-15.15-03-17.mp4

@siferati siferati requested a review from renan028 November 17, 2023 01:08
Copy link
Member

@renan028 renan028 left a comment

Choose a reason for hiding this comment

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

please add the link of suggestions to the task about DWA optimizations

Copy link

@ChristofDubs ChristofDubs left a comment

Choose a reason for hiding this comment

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

Nice visualization / video.
I think the current implementation is fine (simple); few more comments based the video:

  • maybe it would be easier to tune if rather than a discount factor, one could instead e.g. specify the reduction factor at the end? Or make the discount factor such that it applies to how much the next trajectory's point's footprint extends over the previous one (because in the video, with factor 0.8, basically all the future footprints just were in the initial one, which is not obvious by looking at the number 0.8)
  • for guiding the robot better towards its future path, it might help if only the sideward inflation is reduced?
  • on another note, it seems like we could massively increase the sim_granularity without much loss in precision? I.e. could we make dwa use half the CPU by just doubling sim_granularity? (note: addressing the first point would e.g. decouple tuning sim_granularity; right now, doubling sim_granularity would mean you have to set discount factor to its square to retain the same behavior)

dwa_local_planner/src/dwa_planner_ros.cpp Show resolved Hide resolved
@siferati siferati requested a review from renan028 November 27, 2023 00:51
@siferati siferati merged commit 2b7a9fe into devel Nov 30, 2023
1 check passed
@siferati siferati deleted the tiago/discount_factor branch November 30, 2023 05:52
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.

4 participants