Hi All,
I have been thinking about the way we have implemented our throttle and the performance issues that we have observed. First of all I would like to say that I get great altitude hold. I can cruise around at 1 or 2 meters above the ground with no problems. It is only when I start to get aggressive with my pitch, roll and speed that I start to see areas that we could improve. So I started thinking about how we are doing things and why this might cause us problems.
So the problems I see are:
- The pwm input to the esc is not linear with respect to the lifting force generated by the motors. Randy improved this by adding a throttle curve, however this can only be truly accurate for a particular combination of esc, motor, and propeller AT HOVER. When we start to climb, descend or move forward, the curve changes and we are back to a non linear response.
- Boost throttle compensates for the angle that the copter is compared to the ground. But how much do we compensate? We don’t know because of point 1. We know what force we need but not how this translates to pwm. Hang on...... Force.... Acceleration.....
So I got thinking about how we could ensure we could get the correct acceleration from the props for any given situation. Then I thought we have a sensor to measure that!!! Why don’t we put the Z accelerometer in a pid loop to directly measure and calibrate the lifting force supplied by the motors and propellers. The Pid loop design I started thinking about is shown above and compared to our current design at the top of the figure.
This has a number of advantages over the current system:
- The last pid loop, running at 100 Hz, takes an acceleration request then uses the z-axis accelerometer to vary the motor pwm until the required acceleration is achieved.
- The last pid loop linearises the rest of the system making analysis and tuning simpler.
- The frame translation takes care of the angle boost function automatically.
- When at hover or in fast forward flight changes in pitch will cause much smaller variations in altitude because the last pid loop will be working to ensure the vertical acceleration (in the earth frame) will stay as close to 9.9g as possible. We no longer are waiting to detect a change in altitude, we are reacting when we feel that we are accelerating at the very beginning of the unwanted movement.
- This should also improve the rise on yaw problem. As the yaw command is entered we experience a positive acceleration body frame z axis. The final control loop should sense this very quickly and reduce the throttle to bring it back to 9.8G.
There are a number of problems we may also need to solve:
- The z accelerometer will have noise that may need to be filtered. A moving average filter is the best choice for this because it give the greatest noise reduction with the fastest step response. This filter will be one of the biggest contributors to the delay in the throttle control.
- When at rest on the ground the copter will experience an acceleration in the vertical direction of 9.8G provided the motors are going slower than that required to lift off. How do we ensure that the copter provides the user with the appropriate feedback to let them know that they are near hover or not? How does the user know when the copter is about to lift off? This could be a problem because the integrator could wind the motors down to minimum throttle. This may not increase until the requested G increases above 9.8 and then it could increase very quickly to make the copter take off as requested. I believe that these effects could be minimized by sensible selection of Imax in the final loop but only experience will say.
Ok, so that pretty much sums up my idea. I would really appreciate any feedback that people can give. Has this been tried before? Does anybody know if this is being done in other systems?
Thanks for taking the time to read this far,
Leonard
Comments
Thanks Phil!
I have just finished testing the idea and it is working pretty well. I have made a few changes on the diagram above though.
I have set up a number of test examples where the throttle control vertical acceleration, vertical speed, or altitude. I have noticed that the slow barometer response makes it hard to get really decisive response from the controller. I think it is better than the current Alt Hold but I wanted better. The good news is that Randy is working on some other stuff that will give a much faster altitude measurement that should let us really lock it in!
Doing this work is a little hard on the equipment so I my progress will slow a little until I get replacement parts for my quad.
Thanks again for the encouragement!
Hi Hans,
I have no experience with the sonar but I understand that it can be quiet sensitive to both electrical and physical noise. Both of these will increase when you up the throttle so it may be that. I think there are a few threads around that can probably tell you more than I can.
Let me know how you go!
Hi Hans,
I just did it manually through the mission planner and it worked fine so I didn't go any further.
I am working on an improved version at the moment and I have some matlab code that I have tried to use to work out optimal pid parameters but it is hard to get the model right with the time that I have spent on it. The throttle controller is the most complicated controller in the system in my opinion and it is still giving me trouble. It is also hard because we need to come up with something that is relatively easy to tune.
I am glad you liked the simpson desert video :) It was a bit rough around the edges but I hope I can improve the quality with my next frame.
Let me know how you go with the noise problem and the filtered BEC. I will be very interested to hear the results!
Thanks
Hi Hans,
The way I tune Alt hold is to start with the default parameters and go fly it. Make sure everything is working well in Stabilise mode before trying to tune Alt hold.
With the default parameters for the throttle switch to Alt hold a good altitude (20m or above) and see what it does. If it starts a slow oscillation up and down, reduce the Rate P on the throttle.
The problem with Alt hold is that there is a large delay in the altitude reading so it can be tricky to tune if you are starting from scratch.
Good luck and let me know how you go!
@leonardthall
"... HOWEVER in fast forward flight the drag force counters
the lifting force resulting in a reduced accel measurement..."
Thats the problem i encountered today. The main forumla in my code (wich is taken from Mwii forum/Mahowik, and wich i don't understand :) ) will produce a wrong velocity sum with tilted copter. Althold in one place ie good, but moving around will result in serious drop due to misreading. A throttle angle compensation can not compensate for that error. Because of my very limited understanding of mathematics, i did a workaround, wich minimizes the problem without eliminating it. I took the tiltangle (0.99 = Horizontal 0 = 180 degree) multiwii: "float TiltAngle = EstG.V.Z/acc_1G;" and multiplied the wrong accz projection result 4 times with it (don't know the correct english expression for "hoch 4"). So when tilting the copter the wrong readings are diminished in the sum. Besides this i used a small deadband for the resulting accz of "5". This solution is not perfect but def. ok to fly. I think a bigger deadband could stop wrong readings completely - didn't try today.
Here is the code i added after the accz "formula"
float TiltAngle = EstG.V.Z/acc_1G;
accZ = accZ*(TiltAngle*TiltAngle*TiltAngle*TiltAngle);
if (abs(accZ) < 5) accZ = 0;
velz = velz+accZ*accVelScale*ACCDeltaTime;
Sorry, that i am not able to present you a mathematically correct solution, but perhaps you can make some use of my findings.
So long
Kraut Rob
I did used Z-ACC to monitor Throttle when rotating in my HefnyCopter2 ... I noticed the YAW change altitude disappeared or minimized based on the value.. I used a simple P value to be multiplied by ACC delta from 9.8 then to be added to Thr with negative sign...
I will study your model more closely.. Thanks for sharing.
Just a quick correction to my blog post. I have you used "9.8G" but I should have written "1G" or "9.81 m/s^2". And I think this pretty much sums up the problem with the approach too!
Thanks Marooned!
Thanks for that Crashpilot! I will have a look.
Hi all,
I haven't had a chance to read through all the emails but overnight I
have been thinking about this and I did discover a problem. While in
hover the z accelerometer is proportional to the force being applied
to the copter, HOWEVER in fast forward flight the drag force counters
the lifting force resulting in a reduced accel measurement..........
I need to think about this to work out how it effects the idea, it
defiantly throws a spanner in the works!
Thanks everybody for their help. I will read through the discussion asap!
A accz integration into althold and throttle angle correction is the key. I did a much more simpler solution for multiwii, wich works really good http://diydrones.com/xn/detail/705844:Comment:1009947
So long
Kraut Rob
-
1
-
2
of 2 Next