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

[WIP] Collision Prevention Update #3364

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Claudio-Chies
Copy link
Contributor

@Claudio-Chies Claudio-Chies commented Aug 27, 2024

adapted the collision prevention documentation to reflect the move to Acceleration based collision prevention

Associated PR

@@ -26,7 +26,7 @@ Multiple sensors can be used to get information about, and prevent collisions wi
If multiple sources supply data for the _same_ orientation, the system uses the data that reports the smallest distance to an object.
:::

The vehicle restricts the maximum velocity in order to slow down as it gets closer to obstacles, and will stop movement when it reaches the minimum allowed separation.
The vehicle restricts the current velocity in order to slow down as it gets closer to obstacles and adapts the acceleration setpoint in order to disallow collision trajectories.
Copy link
Collaborator

Choose a reason for hiding this comment

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

The first bit makes sense to me - you're approaching a wall, so the vehicle reduces the velocity such that you stop before you hit it.

FMI, what does "adapts the accel. setpoint to disallow collision trajectories" mean?

Assume I'm heading towards a wall at a 45 degree angle, does this mean? I.e. I'm guessing it might mean that the setpoint is adjusted such that you curve into the wall and then move alongside it. Some images showing the behaviour might be nice.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also youtube the video to the PX4 account and include that in the docs too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yea, some figures might actually help, but for that i first need feedback on my PR from Mathias, as its not yet set in stone how the compensation works.
Regarding "adapts the accel. setpoint to disallow collision trajectories", see comment below.

@@ -57,13 +57,14 @@ If so, the vehicle velocity is restricted.
This velocity restriction takes into account both the inner velocity loop tuned by [MPC_XY_P](../advanced_config/parameter_reference.md#MPC_XY_P), as well as the [jerk-optimal velocity controller](../config_mc/mc_jerk_limited_type_trajectory.md) via [MPC_JERK_MAX](../advanced_config/parameter_reference.md#MPC_JERK_MAX) and [MPC_ACC_HOR](../advanced_config/parameter_reference.md#MPC_ACC_HOR).
The velocity is restricted such that the vehicle will stop in time to maintain the distance specified in [CP_DIST](#CP_DIST).
The range of the sensors for each sector is also taken into account, limiting the velocity via the same mechanism.
the restricted velocity is then transformed into an acceleration with [MPC_XY_VEL_P_ACC](../advanced_config/parameter_reference.md#MPC_XY_VEL_P_ACC).
Copy link
Collaborator

Choose a reason for hiding this comment

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

FWIW as above, I don't really understand what this means. I think that perhaps we're always controlling the acceleration setpoint, so for our controller, so what this says is that we've worked out what our restricted velocity is supposed to be, and this converts it to the value that we need for our accel. setpoint?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
the restricted velocity is then transformed into an acceleration with [MPC_XY_VEL_P_ACC](../advanced_config/parameter_reference.md#MPC_XY_VEL_P_ACC).
The restricted velocity is then transformed into an acceleration with [MPC_XY_VEL_P_ACC](../advanced_config/parameter_reference.md#MPC_XY_VEL_P_ACC).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea, its a bit complicated. which is also why the rewrite has not been done before.
we have our velocity and acceleration setpoint coming from the operator. and the problem is that they can point into different directions. so we need to compensate the current velocity if its heading into an obstacle, and restrict the acceleration setpoint from the operator.
the current approach worked fine with velocities. which is why i take the constrained velocity with the old approach, subtract the current velocity to get a velocity error, and just add the proportional gain of the acceleration controller (the input to whom is an velocity error). you can kind of think of the gain as something which modifies the units, input is [m/s] output is [m/s²]. (in an abstract sense)

and for the setpoint of the operator, i just scale it in regard of the distance to the minimum distance. the closer the vehicle is to the minimum distance, the more the normal component gets scaled to zero.

@hamishwillee
Copy link
Collaborator

Looks good, though I have some questions.

  • This works only in Position mode in Acceleration based implementation right? So not in Missions or in Jerk-restricted modes? (i see that MPC_JERK_MAX is mentioned, so just checking.
  • We should make the restrictions clear, if they are not currently.

As a post process I think perhaps we should also restructure this a little to "deprioritise" the companion side option, as it is untested.

@hamishwillee
Copy link
Collaborator

  • Release note?

@hamishwillee hamishwillee changed the title Collision Prevention Update [WIP] Collision Prevention Update Aug 27, 2024
Copy link

github-actions bot commented Sep 6, 2024

No flaws found

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.

2 participants