mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-29 03:36:07 +08:00
HomePosition: Add an instance counter
This commit is contained in:
@@ -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 valid_lpos # true when the local position (xyz) has been set
|
||||||
|
|
||||||
bool manual_home # true when home position was set manually
|
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) {
|
if (updated) {
|
||||||
home.timestamp = hrt_absolute_time();
|
home.timestamp = hrt_absolute_time();
|
||||||
home.manual_home = false;
|
home.manual_home = false;
|
||||||
|
home.update_count = _home_position_pub.get().update_count + 1U;
|
||||||
updated = _home_position_pub.update(home);
|
updated = _home_position_pub.update(home);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,6 +194,7 @@ void HomePosition::setInAirHomePosition()
|
|||||||
|
|
||||||
setHomePosValid();
|
setHomePosValid();
|
||||||
home.timestamp = hrt_absolute_time();
|
home.timestamp = hrt_absolute_time();
|
||||||
|
home.update_count++;
|
||||||
_home_position_pub.update();
|
_home_position_pub.update();
|
||||||
|
|
||||||
} else if (!_failsafe_flags.local_position_invalid && _gps_position_for_home_valid) {
|
} else if (!_failsafe_flags.local_position_invalid && _gps_position_for_home_valid) {
|
||||||
@@ -211,6 +213,7 @@ void HomePosition::setInAirHomePosition()
|
|||||||
|
|
||||||
setHomePosValid();
|
setHomePosValid();
|
||||||
home.timestamp = hrt_absolute_time();
|
home.timestamp = hrt_absolute_time();
|
||||||
|
home.update_count++;
|
||||||
_home_position_pub.update();
|
_home_position_pub.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,6 +233,7 @@ void HomePosition::setInAirHomePosition()
|
|||||||
fillLocalHomePos(home, home_x, home_y, home_z, NAN);
|
fillLocalHomePos(home, home_x, home_y, home_z, NAN);
|
||||||
|
|
||||||
home.timestamp = hrt_absolute_time();
|
home.timestamp = hrt_absolute_time();
|
||||||
|
home.update_count++;
|
||||||
_home_position_pub.update();
|
_home_position_pub.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,6 +272,7 @@ bool HomePosition::setManually(double lat, double lon, float alt, float yaw)
|
|||||||
home.yaw = yaw;
|
home.yaw = yaw;
|
||||||
|
|
||||||
home.timestamp = hrt_absolute_time();
|
home.timestamp = hrt_absolute_time();
|
||||||
|
home.update_count++;
|
||||||
_home_position_pub.update();
|
_home_position_pub.update();
|
||||||
setHomePosValid();
|
setHomePosValid();
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user