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

Collision Prevention with distance sensor #12179

Merged
merged 19 commits into from
Jul 15, 2019
Merged

Collision Prevention with distance sensor #12179

merged 19 commits into from
Jul 15, 2019

Conversation

mrivi
Copy link
Contributor

@mrivi mrivi commented Jun 4, 2019

Replacement for #10998

Changes:

  • map distance_sensor data to obstacle_distance message (Collision Prevention now supports range data from distance sensor only, companion computer only, both companion and distance sensor)
  • start cm8jl65 distance sensor with an orientation set by a parameter
  • add failsafe if the range data are stale. Go first into loiter

@mrivi
Copy link
Contributor Author

mrivi commented Jun 4, 2019

FYI @mhkabir - I already flew it today and I have few things to fix. I'll keep you updated

@hamishwillee
Copy link
Contributor

@mrivi You're my hero!

When this is done we need to update a couple of docs. Just some notes for me ... off the top of my head:

  • Distance Sensors (Rangefinders) - top paragraph can now link to collision prevention doc
  • Collision Prevention > PX4 Distance Sensor
    • Needs to clarify setup - ie any hardware, software parameters that need to be set, including supported physical orientation of sensor.
    • Confirm that supporting collision prevention does not disable anything else, unless other use has incompatible sensor orientation.
    • Confirm how many sensors can be used - ie whether multiple rangefinders are supported on the vehicle and for what purpose, and if multiple are supported, which are used for collision sensors.
    • Confirm modes collision prevention using distance sensor works in.

@mrivi
Copy link
Contributor Author

mrivi commented Jun 6, 2019

@mhkabir Flight with a distance sensor where really god. Log is coming (Flight Review is down).
I still need to test data from companion + distance sensor

@jkflying jkflying changed the title [WIP] Collision Prevention with distance sensor Collision Prevention with distance sensor Jun 6, 2019
@jkflying
Copy link
Contributor

jkflying commented Jun 6, 2019

@jkflying
Copy link
Contributor

jkflying commented Jun 6, 2019

FYI @dagar we got a bunch of [load_mon] wq:lp_default low on stack! (292 bytes left) and [load_mon] wq:I2C1 low on stack! (276 bytes left) messages, and this shouldn't affect those subsystems.

@dagar
Copy link
Member

dagar commented Jun 6, 2019

FYI @dagar we got a bunch of [load_mon] wq:lp_default low on stack! (292 bytes left) and [load_mon] wq:I2C1 low on stack! (276 bytes left) messages, and this shouldn't affect those subsystems.

That should already be resolved in master. 26e041c

@mrivi
Copy link
Contributor Author

mrivi commented Jun 25, 2019

@MaEtUgR would you mind reviewing it? We had good flights with it already

@mrivi
Copy link
Contributor Author

mrivi commented Jun 26, 2019

@dagar with these changes the mc_pos_control is low on stack. See log https://review.px4.io/plot_app?log=4ad9105e-55f1-4f2e-9253-8ea41d2372de

@mrivi
Copy link
Contributor Author

mrivi commented Jul 1, 2019

Out of flash on fmu v2

@mrivi mrivi force-pushed the col_prev_dist_sensor branch from 97c3add to a340ac7 Compare July 1, 2019 16:47
@mrivi mrivi requested a review from jkflying July 1, 2019 16:48
void CollisionPrevention::_calculateConstrainedSetpoint(Vector2f &setpoint,
const Vector2f &curr_pos, const Vector2f &curr_vel)
{
obstacle_distance_s obstacle = {};
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
obstacle_distance_s obstacle = {};
obstacle_distance_s obstacle{};

} else {
// if distance data are stale, switch to Loiter and disable Collision Prevention
// such that it is still possible to fly in Position Control Mode
_publishVehicleCmdDoLoiter();
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if this is the best way to handle this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mhkabir what do you suggest?

Copy link
Contributor

Choose a reason for hiding this comment

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

IMO this is the best way. If your sensors fail you don't want the drone to continue flying as per normal. Ideally I think this should happen only once per arm, but if that will complicate the architecture a lot this is fine, it just means that you need to disable collision prevention in flight if the sensors fail.

mrivi added 18 commits July 15, 2019 08:24
CollisionPrevention: rename a few variables to make the code more readable
distance sensor such that if one of the two fails the vehicle goes into
failsafe, do not switch off CollisionPrevention if it fails
@mrivi mrivi force-pushed the col_prev_dist_sensor branch from 74d4f09 to f07cf09 Compare July 15, 2019 06:25
@mrivi mrivi force-pushed the col_prev_dist_sensor branch from f07cf09 to f319813 Compare July 15, 2019 07:57
Copy link
Member

@bkueng bkueng left a comment

Choose a reason for hiding this comment

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

Thanks @mrivi, let's bring this in.
ROS CI failure unrelated, I see the same failure on master.

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.

6 participants