diff --git a/src/lib/flight_tasks/tasks/Utility/StraightLine.cpp b/src/lib/flight_tasks/tasks/Utility/StraightLine.cpp index db38e522cf..eb49726878 100644 --- a/src/lib/flight_tasks/tasks/Utility/StraightLine.cpp +++ b/src/lib/flight_tasks/tasks/Utility/StraightLine.cpp @@ -76,7 +76,7 @@ void StraightLine::generateSetpoints(matrix::Vector3f &position_setpoint, matrix // check if we plan to go against the line direction which indicates we reached the goal if (start_to_end * vehicle_to_end < 0) { - end_reached = true; + _end_reached = true; } } @@ -85,6 +85,6 @@ void StraightLine::setLineFromTo(const Vector3f &start, const Vector3f &end) if (PX4_ISFINITE(start.norm_squared()) && PX4_ISFINITE(end.norm_squared())) { _start = start; _end = end; - end_reached = false; + _end_reached = false; } } diff --git a/src/lib/flight_tasks/tasks/Utility/StraightLine.hpp b/src/lib/flight_tasks/tasks/Utility/StraightLine.hpp index 5097999cde..cdd776da06 100644 --- a/src/lib/flight_tasks/tasks/Utility/StraightLine.hpp +++ b/src/lib/flight_tasks/tasks/Utility/StraightLine.hpp @@ -66,7 +66,9 @@ public: * * @return false when on the way from start to end, true when end was reached */ - bool isEndReached() { return end_reached; } + bool isEndReached() const { return _end_reached; } + + void reset() { _end_reached = true; } private: const matrix::Vector3f &_position; /**< vehicle position (dependency injection) */ @@ -75,5 +77,5 @@ private: matrix::Vector3f _end; /**< End point of the straight line */ float _speed = 1.f; /**< desired speed between accelerating and decelerating */ - bool end_reached = true; /**< Flag to lock further movement when end is reached */ + bool _end_reached = true; /**< Flag to lock further movement when end is reached */ };