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

Guidance feature for Collision Prevention #12917

Closed
wants to merge 15 commits into from
Closed

Conversation

baumanta
Copy link
Contributor

@baumanta baumanta commented Sep 6, 2019

Add guidance feature to the collision prevention library. Enable the algorithm to slightly change the setpoint direction to help navigate in cluttered environments and fly through narrow gaps.

SITL and flight tested

@hamishwillee
Copy link
Contributor

@baumanta Let me know if this needs any docs - when you're ready to submit.

@baumanta
Copy link
Contributor Author

baumanta commented Sep 17, 2019

@mhkabir it is a bit of a long story related to overlapping long and short range sensors. The correction for pitch was quite minimal, so I don't think that will impair the breaking maneuver. But doing the adaption had some negative effects on recognizing valid sensor data. E.g. if the sensor registers no obstacle, it sends a value just above the sensor range. Then we know, we should limit flight speed, such we can break at that distance, but we do not actually have any sensor data. If that sensor overlaps with a longer range sensor, we will want to use the data of that one, because the other value is not actually valid. If we now do the pitch adaption and the value gets smaller to the point that is is inside sensor range, we cannot know anymore whether it is an actual obstacle reading or not. We could solve that by using another array stating whether data is valid or not, but I don't think it is worth the effort.

Screenshot from 2019-09-17 09-40-00

The light green bin which is constantly around 7.9 is the distance sensor, the other bins are filled with camera data. You can see that distance sensor bin goes inside range (which was 7.9m) all the time due to pitch correction even though the raw signal is constantly at 7.9m (no obstacle). If we receive a valid signal (inside range) from a short range sensor, this has priority over the long range sensor. So we were constantly limiting the flight speed to be able to break in 7.9m even though we did not need to.

@mhkabir
Copy link
Member

mhkabir commented Sep 17, 2019

How about we perform the pitch correction in the distance sensor callback, and only if the sensor is within range?

When testing in simulation, I had found that the pitch correction helped greatly when accelerating (pitch down) towards obstacles.

@baumanta
Copy link
Contributor Author

baumanta commented Sep 17, 2019

@mhkabir with distance sensor callback do you refer to the mavlink receiver? that would actually be an option that should work I think, the question is just if that would be ok for all other modules etc. using this data

otherwise, I might be able to put it back in with an if statement as well, such that we just leave the data at max range without correction and only perform the step for close data

@baumanta baumanta changed the title WIP: Guidance feature for Collision Prevention Guidance feature for Collision Prevention Sep 19, 2019
@baumanta
Copy link
Contributor Author

@baumanta baumanta requested a review from jkflying September 19, 2019 13:44
EXPECT_FLOAT_EQ(modified_setpoint.norm(), 0.f);
if (setpoint_length > 0.f) {
matrix::Vector2f setpoint_dir = modified_setpoint / setpoint_length;
float sp_angle_body_frame = atan2(setpoint_dir(1), setpoint_dir(0));
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
float sp_angle_body_frame = atan2(setpoint_dir(1), setpoint_dir(0));
float sp_angle_body_frame = atan2f(setpoint_dir(1), setpoint_dir(0));

@jkflying
Copy link
Contributor

jkflying commented Sep 24, 2019

Replaced by #13017 due to branch permissions

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.

5 participants