Mavlink only stream HOME_POSITION if valid (#8440)

This commit is contained in:
Daniel Agar 2017-12-10 02:31:42 -05:00 committed by GitHub
parent 63718bf27b
commit c56b0a0e7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 19 deletions

View File

@ -2070,7 +2070,8 @@ protected:
struct home_position_s home;
if (_home_sub->update(&home)) {
mavlink_home_position_t msg = {};
if (home.valid_hpos) {
mavlink_home_position_t msg;
msg.latitude = home.lat * 1e7;
msg.longitude = home.lon * 1e7;
@ -2080,9 +2081,7 @@ protected:
msg.y = home.y;
msg.z = home.z;
matrix::Eulerf euler(0.0f, 0.0f, home.yaw);
matrix::Quatf q(euler);
matrix::Quatf q(matrix::Eulerf(0.0f, 0.0f, home.yaw));
msg.q[0] = q(0);
msg.q[1] = q(1);
msg.q[2] = q(2);
@ -2097,6 +2096,7 @@ protected:
return true;
}
}
}
return false;
}