StraightLine: allow resetting reached flag

This commit is contained in:
Matthias Grob 2020-07-06 16:33:29 +02:00 committed by Julian Kent
parent 5823101f07
commit e9498064ef
2 changed files with 6 additions and 4 deletions

View File

@ -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;
}
}

View File

@ -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 */
};