Copter: guided attitude timeout to 1sec

Also add set-attitude-target capabilities flag
Thanks to Fredia and Sebastian for noticing these issues!
This commit is contained in:
Randy Mackay 2015-10-10 21:41:42 +09:00
parent a82c8b241f
commit a142688fea
2 changed files with 3 additions and 1 deletions

View File

@ -9,4 +9,5 @@ void Copter::init_capabilities(void)
hal.util->set_capabilities(MAV_PROTOCOL_CAPABILITY_SET_POSITION_TARGET_LOCAL_NED);
hal.util->set_capabilities(MAV_PROTOCOL_CAPABILITY_SET_POSITION_TARGET_GLOBAL_INT);
hal.util->set_capabilities(MAV_PROTOCOL_CAPABILITY_FLIGHT_TERMINATION);
hal.util->set_capabilities(MAV_PROTOCOL_CAPABILITY_SET_ATTITUDE_TARGET);
}

View File

@ -11,6 +11,7 @@
#endif
#define GUIDED_POSVEL_TIMEOUT_MS 3000 // guided mode's position-velocity controller times out after 3seconds with no new updates
#define GUIDED_ATTITUDE_TIMEOUT_MS 1000 // guided mode's attitude controller times out after 1 second with no new updates
static Vector3f posvel_pos_target_cm;
static Vector3f posvel_vel_target_cms;
@ -470,7 +471,7 @@ void Copter::guided_angle_control_run()
// check for timeout - set lean angles and climb rate to zero if no updates received for 3 seconds
uint32_t tnow = millis();
if (tnow - guided_angle_state.update_time_ms > GUIDED_POSVEL_TIMEOUT_MS) {
if (tnow - guided_angle_state.update_time_ms > GUIDED_ATTITUDE_TIMEOUT_MS) {
roll_in = 0.0f;
pitch_in = 0.0f;
climb_rate_cms = 0.0f;