Thanks for taking the time to read this post. First of all I would like to reassure you that this is in no way a criticism of the code or the Dev team, they have done a fantastic job.
I am working towards making my own contribution to the Arducopter code base to improve the "Fly by Wire" aspects, but it will take time for me to get the environment set up. (two kids under 2 and 2 jobs) So in the mean time I would like to discuss my ideas. If they are supported and still not implemented when I get my finger out then I will start attempting to implement and test them.
I would appreciate any feedback you can give me.
So this is my first idea to address two problems I and others have experienced in using the Arducopter.
The dreaded drop in altitude when transitioning from Alt Hold or any other Auto mode to Stabilize. Ok, it isn't a big deal once you get used to it but it isn't pretty and I think we could do better.
So I see a number of problems to be addressed:
1. Drop or increase in height when changing modes.
2. Throttle hover position in Stabilize is not in a fixed location so it needs to be "found"
3. Alt Hold is implemented such that it changes height rather aggressively.
I was able to address point 2 and even point 1 to a lesser degree setting up my throttle curve in my transmitter to set hover at mid stick.
Point 3 makes using Alt Hold to control altitude while learning or filming quite clumsy or impractical.
Ok so here is the idea. It has three parts to bare with me.
Manual Throttle curve making hover at mid stick
Now I could see in the code where the throttle offset was changed to place throttle_cruise at mid stick but it did this by simply offsetting and limiting the curve. What I suggest above is to add two slopes for > throttle_cruise and < throttle_cruise. This means that no matter what throttle_cruise is set to the pilot will have access to full throttle range in Stabilize. throttle_cruise takes approximately 5 seconds to move 90% to hover. This means that the throttle position during hover for a bad throttle_cruise setting would move quiet slowly even in the worst case.
Alt Hold has progressive rate vs stick input and smaller dead band
The diagrams on the right show the throttle input vs requested climb rate when using Alt Hold. I am suggesting that we should make this progressive with only a small dead band in the middle. This makes it possible to make smooth and slow altitude changes without having to use the Manual Throttle. (great for learning and filming)
Transitioning from Auto mode via Alt Hold mode
When switching from Auto to Stabilize we could pause in Alt Hold mode. How I was thinking we could do this is to spend a maximum of 2 seconds in Alt Hold mode or until we move the throttle to the dead zone in Alt Hold. What ever happens first. The effect of this is to limit the sudden drop or increase in hight to -120cm/s to 180cm/s and give the pilot time to react by moving the throttle to the central position. Once in the dead band the throttle setting should be within 10% of that required for Hover.
Advantages:
Mid stick is always what you need to hover.
Change from Alt Hold to Stabilize should not result in scary moments because the throttle stick position should be within 10% of Hover.
Change from Auto modes, when the throttle has been set to max or min, will give the pilot 2 seconds warning before going to full or no throttle.
Alt Hold is much more "Fly by Wire".
Disadvantages:
Alt Hold would drift if the throttle is just outside the much small dead band.
There may be times when the 2 second delay moving to Stabilize could prevent the pilot adding full throttle in time to prevent a crash.
I would really appreciate any feedback and insight people have into this idea or these problems in general.
Thanks
Edit:
Code for this approach:
As always the code is marching on and there are already changes made in the areas I have been discussing. So I thought I would list the main requirements in the code to make this work the way I describe.
The main requirement is that g.throttle_cruise is only updated when the copter is in a stable stationary hover. The simple testes for this could be
(g.rc_3.control_in > g.throttle_min && abs(climb_rate) < 60&& abs(g.rc_1.control_in) < 1000 && abs(g.rc_2.control_in) < 1000 )
This can happen in all flight modes. Altitude is kept in different flight conditions other than hover using the Rate I term. The Rate I term limit needs to be large enough to compensate for all flight conditions.
The code for the throttle position to manual throttle output is very straight forward.
if(g.rc_3.control_in < (500 - th_deadband/2)){
g.rc_3.servo_out = g.throttle_cruise * (g.rc_3.control_in / (500 - th_deadband/2));
break;
}else if(g.rc_3.control_in > (500 + th_deadband/2){
g.rc_3.servo_out = g.throttle_cruise + (1000-g.throttle_cruise) * ((g.rc_3.control_in-500-th_deadband/2) / (500-th_deadband/2));
break;
}else{
g.rc_3.servo_out = g.throttle_cruise;
}
The code for the throttle position to altitude rate output is something like this:
if(g.rc_3.control_in < (500 - th_deadband/2)){
th_Rate = -120 * (g.rc_3.control_in / (500 - th_deadband/2));
break;
}else if(g.rc_3.control_in > (500 + th_deadband/2){
th_Rate = 180 * ((g.rc_3.control_in-500-th_deadband/2) / (500-th_deadband/2));
break;
}else{
th_Rate = 0;
}
Sorry but I am not familiar enough with C to add the types quickly.
In the latest version of the code the throttle_cruise factor is updated in two places. Here where it was before and what I think works well with this approach.
http://code.google.com/p/ardupilot-mega/source/browse/ArduCopter/ArduCopter.pde#1813
throttle_avg = throttle_avg * .99 + (float)g.rc_3.control_in * .01;
g.throttle_cruise = throttle_avg;
The new addition here is a problem for this approach. The code is Here:
http://code.google.com/p/ardupilot-mega/source/browse/ArduCopter/ArduCopter.pde#1891
and here:
http://code.google.com/p/ardupilot-mega/source/browse/ArduCopter/system.pde#635
The second update prevents this approach from working because it is constantly resetting the Altitude I term and adding it to g.throttle_cruise.
Comments
As for the logs, I have thread on this forum. I'm unable to read them. I'll try again on Monday, maybe new soft fixed this as Chris said.
Marooned, just to help you understand the language, the term "cruise" in this case comes from the term "cruise control" used in cars. Drive on the highway, get the speed you want, push a button, and the computer automatically holds the set speed so that you can take your foot off the gas pedal.
"Throttle_Cruise" basically means that the controller automatically holds a hover, so you can take your thumb off the throttle stick.
If the motors stopped I don't know what happened. What do you have the minimum motor output set to. If it is zero maybe the PIDs were able to stop the motors completely. But it could be a bug. The logs might say something about it too.
As for the cruise throttle. You are spot on :)
From wiki: "You cannot land and turn off the motors manually in Loiter mode." and motors stopped. I've heard that. It was buzzing 15m over me, in complete silent environment.
Hmm, from that description it looks for me that throttle speed makes a quad to hover/maintain the altitude. Am I right? So it's such throttle which makes vertical thrust equals G.
Nice to meet you too :)
Hi Marooned,
I looked through the code for where it might change to Stabilize mode from RTL but I couldn't find it. So I don't think it is Stabilize you saw. I think it is Loiter Mode. Loiter Height can be controlled by the throttle input but I can't find anything that stops this in RTL.
So what might have happed is that when it entered the Loiter Mode of RTL it started it's -120cm's decent and this could have looked like it stopped the motors if you were very quick to respond.
To answer your question, cruise speed would be the speed that you can hold for a long time. So in the case of throttle cruise, it is the throttle setting that we can set without landing or climbing out of sight.
Nice it meet you Marooned, I like people with a sense of humor :)
I would like to understand that code more but I'm not English native. What exactly is "throttle cruise"? I found that "cruise" can be understood as "moving with slow constant speed" but I would like explanation more close the the code used in ArduCopter project. How to understand that variable. I'm a programmer so I understand the code pretty well but not variable meaning.
Thanks.
Haha :)
Anyway, I assume this as a bug that RTL switched to manual at some altitude instead of wait for mode to change.
Randy, that is a good idea too. Just implement a slow move from the Cruze_Throttle to what ever the manual setting is. That would give people a little more time to react and maybe let Marooned come back from flying his quad wearing the same pants he left in :)
I made a mistake with the Manual throttle input, no dead band, here is the correction:
if(g.rc_3.control_in < (500)){
g.rc_3.servo_out = g.throttle_cruise * (g.rc_3.control_in / 500);
break;
}else if(g.rc_3.control_in > 500){
g.rc_3.servo_out = g.throttle_cruise + (1000-g.throttle_cruise) * ((g.rc_3.control_in-500) / 500);
break;
}else{
g.rc_3.servo_out = g.throttle_cruise;
}
I had almost heart attack yesterday. I was flying my quad, decided to check RTL function, put throttle stick down to confirm it's in auto mode. Copter returned, made a circle at about 15m altitude and... shut down all motors! Adrenaline flooded my heart and I was switched to Stabilization mode with throttle stick up in a blink of an eye but still..
My settings for RTL is 1m (0 meant: "land" but it's impossible to set via Planner, 1 is a minimum) and I would expect it should hover on this altitude, for sure not shut down all motors!
I thought this thread is a good place as we are talking about drastic changes of altitude. That would be too drastic if I would do like many on the Internet, laying radio on the ground to show it's really auto...