mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 10:23:34 +08:00
reset transition command to current state when not in offboard
This commit is contained in:
committed by
Simon Wilks
parent
1da703a13d
commit
5463c6767d
@@ -325,9 +325,6 @@ VtolAttitudeControl::vehicle_cmd_poll() {
|
|||||||
|
|
||||||
if (updated) {
|
if (updated) {
|
||||||
orb_copy(ORB_ID(vehicle_command), _vehicle_cmd_sub , &_vehicle_cmd);
|
orb_copy(ORB_ID(vehicle_command), _vehicle_cmd_sub , &_vehicle_cmd);
|
||||||
if (_vehicle_cmd.command == vehicle_command_s::VEHICLE_CMD_DO_VTOL_TRANSITION) {
|
|
||||||
orb_copy(ORB_ID(vehicle_command), _vehicle_cmd_sub , &_vehicle_transition_cmd);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -505,9 +502,25 @@ void VtolAttitudeControl::task_main()
|
|||||||
vehicle_battery_poll();
|
vehicle_battery_poll();
|
||||||
vehicle_cmd_poll();
|
vehicle_cmd_poll();
|
||||||
|
|
||||||
|
// update transition command if necessary
|
||||||
|
if (_vehicle_cmd.command == vehicle_command_s::VEHICLE_CMD_DO_VTOL_TRANSITION) {
|
||||||
|
orb_copy(ORB_ID(vehicle_command), _vehicle_cmd_sub , &_vehicle_transition_cmd);
|
||||||
|
}
|
||||||
|
|
||||||
// update the vtol state machine which decides which mode we are in
|
// update the vtol state machine which decides which mode we are in
|
||||||
_vtol_type->update_vtol_state();
|
_vtol_type->update_vtol_state();
|
||||||
|
|
||||||
|
// reset transition command if not in offboard control
|
||||||
|
if (!_v_control_mode.flag_control_offboard_enabled)
|
||||||
|
{
|
||||||
|
if (_vtol_type->get_mode() == ROTARY_WING) {
|
||||||
|
_vehicle_transition_cmd.param1 = vehicle_status_s::VEHICLE_VTOL_STATE_MC;
|
||||||
|
}
|
||||||
|
else if (_vtol_type->get_mode() == FIXED_WING) {
|
||||||
|
_vehicle_transition_cmd.param1 = vehicle_status_s::VEHICLE_VTOL_STATE_FW;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// check in which mode we are in and call mode specific functions
|
// check in which mode we are in and call mode specific functions
|
||||||
if (_vtol_type->get_mode() == ROTARY_WING) {
|
if (_vtol_type->get_mode() == ROTARY_WING) {
|
||||||
// vehicle is in rotary wing mode
|
// vehicle is in rotary wing mode
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ public:
|
|||||||
~VtolAttitudeControl();
|
~VtolAttitudeControl();
|
||||||
|
|
||||||
int start(); /* start the task and return OK on success */
|
int start(); /* start the task and return OK on success */
|
||||||
|
bool is_fixed_wing_requested();
|
||||||
|
|
||||||
struct vehicle_attitude_s* get_att () {return &_v_att;}
|
struct vehicle_attitude_s* get_att () {return &_v_att;}
|
||||||
struct vehicle_attitude_setpoint_s* get_att_sp () {return &_v_att_sp;}
|
struct vehicle_attitude_setpoint_s* get_att_sp () {return &_v_att_sp;}
|
||||||
|
|||||||
@@ -134,8 +134,8 @@ void VtolType::set_idle_fw()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return true if fixed-wing mode is requested.
|
* Returns true if fixed-wing mode is requested.
|
||||||
* Either via switch or via command.
|
* Changed either via switch or via command.
|
||||||
*/
|
*/
|
||||||
bool VtolType::is_fixed_wing_requested()
|
bool VtolType::is_fixed_wing_requested()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user