Matrix - Explicitly cast array[3] to Vector3f

Use .xy() for Vector2 -> Vector3 assignment
This commit is contained in:
bresch
2019-09-12 13:54:35 +02:00
committed by Mathieu Bresciani
parent f405bf506b
commit 0153e1b126
3 changed files with 9 additions and 9 deletions

View File

@@ -211,10 +211,10 @@ void FlightTaskManualPositionSmoothVel::_setOutputState()
void FlightTaskManualPositionSmoothVel::_setOutputStateXY()
{
_jerk_setpoint = _smoothing_xy.getCurrentJerk();
_acceleration_setpoint = _smoothing_xy.getCurrentAcceleration();
_velocity_setpoint = _smoothing_xy.getCurrentVelocity();
_position_setpoint = _smoothing_xy.getCurrentPosition();
_jerk_setpoint.xy() = _smoothing_xy.getCurrentJerk();
_acceleration_setpoint.xy() = _smoothing_xy.getCurrentAcceleration();
_velocity_setpoint.xy() = _smoothing_xy.getCurrentVelocity();
_position_setpoint.xy() = _smoothing_xy.getCurrentPosition();
}
void FlightTaskManualPositionSmoothVel::_setOutputStateZ()

View File

@@ -74,10 +74,10 @@ TEST_F(ManualVelocitySmoothingXYTest, getCurrentState)
Vector3f a_end;
Vector3f v_end;
Vector3f x_end;
j_end = _smoothing.getCurrentJerk();
a_end = _smoothing.getCurrentAcceleration();
v_end = _smoothing.getCurrentVelocity();
x_end = _smoothing.getCurrentPosition();
j_end.xy() = _smoothing.getCurrentJerk();
a_end.xy() = _smoothing.getCurrentAcceleration();
v_end.xy() = _smoothing.getCurrentVelocity();
x_end.xy() = _smoothing.getCurrentPosition();
// THEN: the returned values should match the input
EXPECT_EQ(j_end, Vector3f(0.f, 0.f, 0.f));

View File

@@ -673,7 +673,7 @@ MulticopterPositionControl::run()
// Inform FlightTask about the input and output of the velocity controller
// This is used to properly initialize the velocity setpoint when onpening the position loop (position unlock)
_flight_tasks.updateVelocityControllerIO(_control.getVelSp(), local_pos_sp.thrust);
_flight_tasks.updateVelocityControllerIO(_control.getVelSp(), Vector3f(local_pos_sp.thrust));
// Part of landing logic: if ground-contact/maybe landed was detected, turn off
// controller. This message does not have to be logged as part of the vehicle_local_position_setpoint topic.