mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-10-06 09:02:52 +08:00
rework(navigator): let navigator handle mission route cache updates
This commit is contained in:
@@ -60,5 +60,3 @@ menuconfig NAVIGATOR_ADSB_FAKE_TRAFFIC
|
||||
---help---
|
||||
Adds the `navigator fake_traffic` shell command and the scripted scenarios
|
||||
used to validate the Detect and Avoid pipeline without a real transponder.
|
||||
Add support for acting on ADSB transponder_report or ADSB_VEHICLE MAVLink messages.
|
||||
Actions are warnings, Loiter, Land and RTL without climb.
|
||||
|
||||
@@ -249,6 +249,7 @@ void Navigator::run()
|
||||
fds[2].events = POLLIN;
|
||||
|
||||
uint32_t geofence_id{0};
|
||||
mission_s mission{};
|
||||
|
||||
/* rate-limit position subscription to 20 Hz / 50 ms */
|
||||
orb_set_interval(_local_pos_sub, 50);
|
||||
@@ -274,7 +275,6 @@ void Navigator::run()
|
||||
orb_copy(ORB_ID(vehicle_status), _vehicle_status_sub, &_vstatus);
|
||||
|
||||
if (fds[2].revents & POLLIN) {
|
||||
mission_s mission;
|
||||
orb_copy(ORB_ID(mission), _mission_sub, &mission);
|
||||
|
||||
if (mission.geofence_id != geofence_id) {
|
||||
@@ -284,6 +284,8 @@ void Navigator::run()
|
||||
|
||||
}
|
||||
|
||||
_mission_route_cache.update(mission);
|
||||
|
||||
/* gps updated */
|
||||
if (_gps_pos_sub.updated()) {
|
||||
_gps_pos_sub.copy(&_gps_pos);
|
||||
|
||||
@@ -74,11 +74,6 @@ RTL::RTL(Navigator *navigator) :
|
||||
_rtl_direct.initialize();
|
||||
}
|
||||
|
||||
void RTL::updateDatamanCache()
|
||||
{
|
||||
_navigator->get_mission_route_cache().update(_mission_sub.get());
|
||||
}
|
||||
|
||||
void RTL::on_inactive()
|
||||
{
|
||||
_global_pos_sub.update();
|
||||
@@ -87,8 +82,6 @@ void RTL::on_inactive()
|
||||
_home_pos_sub.update();
|
||||
_wind_sub.update();
|
||||
|
||||
updateDatamanCache();
|
||||
|
||||
parameters_update();
|
||||
|
||||
if (_rtl_mission_type_handle) {
|
||||
@@ -147,8 +140,6 @@ void RTL::on_activation()
|
||||
_home_pos_sub.update();
|
||||
_wind_sub.update();
|
||||
|
||||
updateDatamanCache();
|
||||
|
||||
setRtlTypeAndDestination();
|
||||
|
||||
switch (_rtl_type) {
|
||||
@@ -193,8 +184,6 @@ void RTL::on_active()
|
||||
_home_pos_sub.update();
|
||||
_wind_sub.update();
|
||||
|
||||
updateDatamanCache();
|
||||
|
||||
switch (_rtl_type) {
|
||||
case RtlType::RTL_MISSION_FAST:
|
||||
[[fallthrough]];
|
||||
|
||||
@@ -112,11 +112,6 @@ private:
|
||||
*/
|
||||
bool reverseIsFurther() const;
|
||||
|
||||
/**
|
||||
* @brief Refresh the safe-point and land-item cache used by RTL destination selection.
|
||||
*/
|
||||
void updateDatamanCache();
|
||||
|
||||
void setRtlTypeAndDestination();
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user