Skip to content

Commit

Permalink
Copter: Fix sign in Z velocity
Browse files Browse the repository at this point in the history
* Copter velocity doesn't follow NED

Signed-off-by: Ryan Friedman <[email protected]>
  • Loading branch information
Ryanf55 committed Aug 10, 2023
1 parent 01e3564 commit b4251a1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ArduCopter/AP_ExternalControl_Copter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ bool AP_ExternalControl_Copter::set_linear_velocity_and_yaw_rate(const Vector3f
return false;
}
const float yaw_rate_cds = isnan(yaw_rate_rads)? 0: degrees(yaw_rate_rads)*100;
Vector3f velocity_cms = linear_velocity * 100;
copter.mode_guided.set_velocity(velocity_cms, false, 0, !isnan(yaw_rate_rads), yaw_rate_cds);

// Copter velocity is positive if aicraft is moving up which is opposite the incoming NED frame.
Vector3f velocity_up_cms = -linear_velocity * 100;
copter.mode_guided.set_velocity(velocity_up_cms, false, 0, !isnan(yaw_rate_rads), yaw_rate_cds);
return true;
}

0 comments on commit b4251a1

Please sign in to comment.