mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-08 11:10:34 +08:00
vehicle_attitude only based yaw control fix (#10803)
* Add attitude sub to mc_pos_control for yaw usage. * Initialize pos control _states struct. * Remove unnecessary init for struct in mc pos ctrl. * Only use att topic for yaw setting in FlightTask.
This commit is contained in:
@@ -90,6 +90,11 @@ void FlightTask::_evaluateVehicleLocalPosition()
|
||||
_yaw = NAN;
|
||||
_dist_to_bottom = NAN;
|
||||
|
||||
if ((_time_stamp_current - _sub_attitude->get().timestamp) < _timeout) {
|
||||
// yaw
|
||||
_yaw = matrix::Eulerf(matrix::Quatf(_sub_attitude->get().q)).psi();
|
||||
}
|
||||
|
||||
// Only use vehicle-local-position topic fields if the topic is received within a certain timestamp
|
||||
if ((_time_stamp_current - _sub_vehicle_local_position->get().timestamp) < _timeout) {
|
||||
|
||||
@@ -113,9 +118,6 @@ void FlightTask::_evaluateVehicleLocalPosition()
|
||||
_velocity(2) = _sub_vehicle_local_position->get().vz;
|
||||
}
|
||||
|
||||
// yaw
|
||||
_yaw = _sub_vehicle_local_position->get().yaw;
|
||||
|
||||
// distance to bottom
|
||||
if (_sub_vehicle_local_position->get().dist_bottom_valid
|
||||
&& PX4_ISFINITE(_sub_vehicle_local_position->get().dist_bottom)) {
|
||||
|
||||
Reference in New Issue
Block a user