mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-31 20:21:35 +08:00
Manual Smoth Vel - Override reActivate to not reset Z axis (prevented takeoff)
This commit is contained in:
+29
-3
@@ -42,16 +42,42 @@ bool FlightTaskManualPositionSmoothVel::activate()
|
|||||||
{
|
{
|
||||||
bool ret = FlightTaskManualPosition::activate();
|
bool ret = FlightTaskManualPosition::activate();
|
||||||
|
|
||||||
|
reset(Axes::XYZ);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FlightTaskManualPositionSmoothVel::reActivate()
|
||||||
|
{
|
||||||
|
reset(Axes::XY);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FlightTaskManualPositionSmoothVel::reset(Axes axes)
|
||||||
|
{
|
||||||
|
int count;
|
||||||
|
|
||||||
|
switch (axes) {
|
||||||
|
case Axes::XY:
|
||||||
|
count = 2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Axes::XYZ:
|
||||||
|
count = 3;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
count = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: get current accel
|
// TODO: get current accel
|
||||||
for (int i = 0; i < 3; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
_smoothing[i].reset(0.f, _velocity(i), _position(i));
|
_smoothing[i].reset(0.f, _velocity(i), _position(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
_position_lock_xy_active = false;
|
_position_lock_xy_active = false;
|
||||||
_position_setpoint_xy_locked(0) = NAN;
|
_position_setpoint_xy_locked(0) = NAN;
|
||||||
_position_setpoint_xy_locked(1) = NAN;
|
_position_setpoint_xy_locked(1) = NAN;
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FlightTaskManualPositionSmoothVel::_updateSetpoints()
|
void FlightTaskManualPositionSmoothVel::_updateSetpoints()
|
||||||
|
|||||||
+3
@@ -50,6 +50,7 @@ public:
|
|||||||
virtual ~FlightTaskManualPositionSmoothVel() = default;
|
virtual ~FlightTaskManualPositionSmoothVel() = default;
|
||||||
|
|
||||||
bool activate() override;
|
bool activate() override;
|
||||||
|
void reActivate() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@@ -63,6 +64,8 @@ protected:
|
|||||||
)
|
)
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
enum class Axes {XY, XYZ};
|
||||||
|
void reset(Axes axes);
|
||||||
VelocitySmoothing _smoothing[3]; ///< Smoothing in x, y and z directions
|
VelocitySmoothing _smoothing[3]; ///< Smoothing in x, y and z directions
|
||||||
matrix::Vector3f _vel_sp_smooth;
|
matrix::Vector3f _vel_sp_smooth;
|
||||||
bool _position_lock_xy_active{false};
|
bool _position_lock_xy_active{false};
|
||||||
|
|||||||
Reference in New Issue
Block a user