Refactor: Use new matrix::Vector2f constructor

This commit is contained in:
Matthias Grob
2018-10-01 08:10:21 -04:00
committed by Daniel Agar
parent ada0179cda
commit bee6a6b8b0
13 changed files with 98 additions and 95 deletions
@@ -78,7 +78,7 @@ void FlightTaskManualPosition::_scaleSticks()
FlightTaskManualAltitude::_scaleSticks();
/* Constrain length of stick inputs to 1 for xy*/
Vector2f stick_xy(_sticks_expo(0), _sticks_expo(1));
Vector2f stick_xy(&_sticks_expo(0));
float mag = math::constrain(stick_xy.length(), 0.0f, 1.0f);
@@ -119,8 +119,8 @@ void FlightTaskManualPosition::_scaleSticks()
void FlightTaskManualPosition::_updateXYlock()
{
/* If position lock is not active, position setpoint is set to NAN.*/
const float vel_xy_norm = Vector2f(&_velocity(0)).length();
const bool apply_brake = Vector2f(&_velocity_setpoint(0)).length() < FLT_EPSILON;
const float vel_xy_norm = Vector2f(_velocity).length();
const bool apply_brake = Vector2f(_velocity_setpoint).length() < FLT_EPSILON;
const bool stopped = (MPC_HOLD_MAX_XY.get() < FLT_EPSILON || vel_xy_norm < MPC_HOLD_MAX_XY.get());
if (apply_brake && stopped && !PX4_ISFINITE(_position_setpoint(0))) {