1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #pragma once
- #include <AP_Common/AP_Common.h>
- #include <AP_Common/Location.h>
- #include <AP_Math/AP_Math.h>
- #include <AP_HAL/AP_HAL.h>
- class AP_OABendyRuler {
- public:
- AP_OABendyRuler() {}
-
- AP_OABendyRuler(const AP_OABendyRuler &other) = delete;
- AP_OABendyRuler &operator=(const AP_OABendyRuler&) = delete;
-
- void set_config(float lookahead, float margin_max) { _lookahead = MAX(lookahead, 1.0f); _margin_max = MAX(margin_max, 0.0f); }
-
-
- bool update(const Location& current_loc, const Location& destination, const Vector2f &ground_speed_vec, Location &origin_new, Location &destination_new);
- private:
-
- float calc_avoidance_margin(const Location &start, const Location &end);
-
-
- bool calc_margin_from_circular_fence(const Location &start, const Location &end, float &margin);
-
-
- bool calc_margin_from_polygon_fence(const Location &start, const Location &end, float &margin);
-
-
- bool calc_margin_from_object_database(const Location &start, const Location &end, float &margin);
-
- float _lookahead;
- float _margin_max;
-
- float _current_lookahead;
- };
|