mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-22 22:32:11 +08:00
FlightTasks safer matrix usage
This commit is contained in:
@@ -228,7 +228,7 @@ void FlightTaskAuto::_set_heading_from_mode()
|
||||
switch (MPC_YAW_MODE.get()) {
|
||||
|
||||
case 0: { // Heading points towards the current waypoint.
|
||||
v = Vector2f(&_target(0)) - Vector2f(&_position(0));
|
||||
v = Vector2f(_target(0), _target(1)) - Vector2f(_position(0), _position(1));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ float StraightLine::getMaxAcc()
|
||||
Vector3f u_orig_to_target = (_target - _origin).unit_or_zero();
|
||||
|
||||
// calculate the maximal horizontal acceleration
|
||||
float divider = Vector2f(u_orig_to_target.data()).length();
|
||||
float divider = Vector2f(u_orig_to_target(0), u_orig_to_target(1)).length();
|
||||
float max_acc_hor = MPC_ACC_HOR_MAX.get();
|
||||
|
||||
if (divider > FLT_EPSILON) {
|
||||
|
||||
Reference in New Issue
Block a user