mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-27 23:33:35 +08:00
commander: internalize system status bools
Most condition bools in the commander are not used anywhere but in the commander. It therefore makes sense to move them to a different internal struct and remove them from the vehicle_status message. Also, the land_detected should be used by all the modules instead of getting it through the commander and system_status.
This commit is contained in:
@@ -107,6 +107,7 @@ Navigator::Navigator() :
|
||||
_gps_pos_sub(-1),
|
||||
_home_pos_sub(-1),
|
||||
_vstatus_sub(-1),
|
||||
_land_detected_sub(-1),
|
||||
_capabilities_sub(-1),
|
||||
_control_mode_sub(-1),
|
||||
_onboard_mission_sub(-1),
|
||||
@@ -118,6 +119,7 @@ Navigator::Navigator() :
|
||||
_geofence_result_pub(nullptr),
|
||||
_att_sp_pub(nullptr),
|
||||
_vstatus{},
|
||||
_land_detected{},
|
||||
_control_mode{},
|
||||
_global_pos{},
|
||||
_gps_pos{},
|
||||
@@ -241,6 +243,12 @@ Navigator::vehicle_status_update()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Navigator::vehicle_land_detected_update()
|
||||
{
|
||||
orb_copy(ORB_ID(vehicle_land_detected), _land_detected_sub, &_land_detected);
|
||||
}
|
||||
|
||||
void
|
||||
Navigator::vehicle_control_mode_update()
|
||||
{
|
||||
@@ -290,6 +298,7 @@ Navigator::task_main()
|
||||
_sensor_combined_sub = orb_subscribe(ORB_ID(sensor_combined));
|
||||
_capabilities_sub = orb_subscribe(ORB_ID(navigation_capabilities));
|
||||
_vstatus_sub = orb_subscribe(ORB_ID(vehicle_status));
|
||||
_land_detected_sub = orb_subscribe(ORB_ID(vehicle_land_detected));
|
||||
_control_mode_sub = orb_subscribe(ORB_ID(vehicle_control_mode));
|
||||
_home_pos_sub = orb_subscribe(ORB_ID(home_position));
|
||||
_onboard_mission_sub = orb_subscribe(ORB_ID(onboard_mission));
|
||||
@@ -299,6 +308,7 @@ Navigator::task_main()
|
||||
|
||||
/* copy all topics first time */
|
||||
vehicle_status_update();
|
||||
vehicle_land_detected_update();
|
||||
vehicle_control_mode_update();
|
||||
global_position_update();
|
||||
gps_position_update();
|
||||
@@ -374,6 +384,12 @@ Navigator::task_main()
|
||||
vehicle_status_update();
|
||||
}
|
||||
|
||||
/* vehicle land detected updated */
|
||||
orb_check(_land_detected_sub, &updated);
|
||||
if (updated) {
|
||||
vehicle_land_detected_update();
|
||||
}
|
||||
|
||||
/* navigation capabilities updated */
|
||||
orb_check(_capabilities_sub, &updated);
|
||||
if (updated) {
|
||||
|
||||
Reference in New Issue
Block a user