When my plane is in Auto mode and flies out of range of my RC gear (at about 1.2km), the failsafe is triggered. I have set my receiver to deliver a signal around 920 when it loses the Tx. This results in CIRCLE mode followed by RTL. However, looking at the code, I don't see how this is possible in Auto mode.
The code below (from events.pde) is the short event failsafe. If I am in auto mode, it should go and check the short_fs_action, determine that I have set it to 1 and then RTL. However, what I see when flying is circle mode then RTL 20 seconds later.
What I really want to do is stay in auto mode even if the failsafe triggers and finish the mission. However, if I set the failsafe action to none, the plane goes into MANUAL mode if failsafe is detected when in Auto mode. I've only tested this last one on the ground by turning off my Tx - to test in the air would be catastrophic if the same thing happened.
So my question is - how does the plane end up in Circle or Manual modes on failsafe?
I'm running Arduplane 2.65.
static void failsafe_short_on_event(int16_t fstype)
{
// This is how to handle a short loss of control signal failsafe.
failsafe = fstype;
ch3_failsafe_timer = millis();
gcs_send_text_P(SEVERITY_LOW, PSTR("Failsafe - Short event on, "));
switch(control_mode)
{
case MANUAL:
case STABILIZE:
case FLY_BY_WIRE_A: // middle position
case FLY_BY_WIRE_B: // middle position
set_mode(CIRCLE);
break;
case AUTO:
case GUIDED:
case LOITER:
if(g.short_fs_action == 1) {
set_mode(RTL);
}
break;
case CIRCLE:
case RTL:
default:
break;
}
gcs_send_text_fmt(PSTR("flight mode = %u"), (unsigned)control_mode);
}
Replies
@Paul - I agree that laptop screens are not very good in the full sun. I don't have any brilliant ideas here. What I do is take a fold up chair outside and put the laptop on it. Arrange the chair back so it shades the screen. In the middle of the day I tie an umbrella to the chair to provide shade. Turn the screen brightness to maximum.
A few weeks ago it was over 40C here in Perth, Western Australia. I foolishly went flying anyway. My laptop is black and got so hot in the sun that it shut itself down to protect the processor! I guess I need better shading!
Regards
James
Regarding the failsafe functions with spektrum receivers.
Not all spektrum receivers have a desirable failsafe behaviour.
While it seems the throttle signal will be commanded to the low position or a preset position during a failsafe condition on most if not all spektrum RX's, the same cannot be said for the other channels.
Some of the ones that I have, [ AR6200, AR6210, AR400, AR600C ] do not allow the other channels to be pre-set with failsafe positions. Instead some either HOLD last position or they REMOVE the output pulse during the failsafe condition, it varies from RX to RX.
If you were flying in MANUAL mode with APM and the failsafe function on your RX implemented the HOLD feature, the hardware failsafe on the APM would prevent the autopilot from being able to control the servos because the RX would maintain the same PWM output & keep APM in manual mode. :(
So check & double check that the failsafe functions on both APM & your RX work as you expect them to.
Ok, figured it out. The failsafe on my Reciever on channel 8 was sending a PWM signal for MANUAL, so when the receiver failsafes, it switches the APM to MANUAL, which then triggers circle mode. That also explains the behaviour when failsafe action is set to none.