mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-07-27 00:48:23 +08:00
StraightLine: allow resetting reached flag
This commit is contained in:
committed by
Julian Kent
parent
5823101f07
commit
e9498064ef
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 */
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user