mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
HomePosition: Add an instance counter
This commit is contained in:
parent
3ac7ed6afa
commit
5e1f0b73ce
@ -17,3 +17,5 @@ bool valid_hpos # true when the latitude and longitude have been set
|
||||
bool valid_lpos # true when the local position (xyz) has been set
|
||||
|
||||
bool manual_home # true when home position was set manually
|
||||
|
||||
uint32 update_count # update counter of the home position
|
||||
|
||||
@ -129,6 +129,7 @@ bool HomePosition::setHomePosition(bool force)
|
||||
if (updated) {
|
||||
home.timestamp = hrt_absolute_time();
|
||||
home.manual_home = false;
|
||||
home.update_count = _home_position_pub.get().update_count + 1U;
|
||||
updated = _home_position_pub.update(home);
|
||||
}
|
||||
|
||||
@ -193,6 +194,7 @@ void HomePosition::setInAirHomePosition()
|
||||
|
||||
setHomePosValid();
|
||||
home.timestamp = hrt_absolute_time();
|
||||
home.update_count++;
|
||||
_home_position_pub.update();
|
||||
|
||||
} else if (!_failsafe_flags.local_position_invalid && _gps_position_for_home_valid) {
|
||||
@ -211,6 +213,7 @@ void HomePosition::setInAirHomePosition()
|
||||
|
||||
setHomePosValid();
|
||||
home.timestamp = hrt_absolute_time();
|
||||
home.update_count++;
|
||||
_home_position_pub.update();
|
||||
}
|
||||
|
||||
@ -230,6 +233,7 @@ void HomePosition::setInAirHomePosition()
|
||||
fillLocalHomePos(home, home_x, home_y, home_z, NAN);
|
||||
|
||||
home.timestamp = hrt_absolute_time();
|
||||
home.update_count++;
|
||||
_home_position_pub.update();
|
||||
}
|
||||
|
||||
@ -268,6 +272,7 @@ bool HomePosition::setManually(double lat, double lon, float alt, float yaw)
|
||||
home.yaw = yaw;
|
||||
|
||||
home.timestamp = hrt_absolute_time();
|
||||
home.update_count++;
|
||||
_home_position_pub.update();
|
||||
setHomePosValid();
|
||||
return true;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user