He’s working on improving the performance of ArduPilot. His latest contribution, developed in conjunction with Randy, is pretty big. So big, it will be a while before it can be incorporated into a beta release.
“New Loiter” is a more responsive Loiter mode which accepts lean angle inputs from the pilot, making it feel more like AltHold mode. Despite accepting lean-angle inputs, the position, velocity and acceleration controllers remain active at all times, ensuring the vehicle fights against disturbances. This is quite different from PosHold mode which does not attempt to maintain position or velocity while the pilot provides stick input. New Loiter also includes active braking when the pilot releases the sticks.
A lot of testing has been done, in SITL and real aircraft, but we need more, and hope that some of the more experienced members of our community can assist. If you think this is you, read on. We’d love for you to help out (very carefully, and at your own risk). Prebuilt firmware for Pixhawk, the Cube/PH2.1 and PixRacer is here: https://goo.gl/tyJ1mT. If you decide to try it, please post links to your log files and descriptions of your test vehicle in the comments below.
Some of the outstanding issues that need to be resolved before this can go into master:
QuadPlane and Sub position controller gains have changed (because they are the same as Copter) so we need to either pass in the default gains to the position controller constructor or have the vehicles actively set the defaults as part of their startup.
More testing of Copter to ensure the vehicle doesn’t move around too much after the pilot releases the sticks
More testing that the porpoising in auto has been resolved
More testing of Sub and Quadplane to ensure nothing has been broken
My main question is where should we set PSC_VELXY_D on the range from 0 to 1?
Higher values will encourage porpoising in AUTO missions when fighting into a head wind.
Lower values may require PSC_VELXY_P and PSC_VELXY_I to drop from 2 and 1 down to 1 and 0.5. You will be able to tell this is the case because the aircraft bobs around a bit after a large stick input in loiter.
To set up Loiter correctly you should set WPNAV_LOIT_SPEED to your maximum speed when holding 30 degrees lean angle assuming you have default maximum lean angle set. So I would be interested in what people think we should set this to. I am thinking approximately 1500 at this stage.
I will definitely do some test flights with this. The weather is looking good through the weekend and I’m not traveling for Thanksgiving. I’ll be using a Solo and tweak settings with MP or Tower.
Do changes to the PSC_ parameters require rebooting to take effect in flight, or can I adjust them on the fly?
I reviewed all the commits in the PR and I think this mode may have some problems for helicopters. That big racing quad in the video is about the size of one of my smaller heli’s - 600-class. But there are some differences
helicopters are regularly flown at 20+ m/s in Auto (we really need the L1 Nav Controller in TradHeli)
a 600-class heli at 30 deg “lean angle” will accelerate at 1G
it will hit 120km/hr in a few dozen meters, still accelerating like a rocket sled on rails
let the speed build to 25+ m/s and it will pull 6G in a braking maneuver based on lean angle
These are some of the reasons braking in Position Hold mode does not work very well with helicopters.
I intend to pull these commits into our ArduHeli development code, built it and test it in a helicopter to see if there’s a reasonable set of parameters that can yield satisfactory results for UAV heli’s.
@rmackay9 is this intended to eventually replace the current Loiter flight mode? Or is it intended to be a separate flight mode like Pos Hold?
It’s intended to replace the current Loiter mode. Loiter is our most challenging mode (from a developer point of view) to get right which is why we are taking it slow and appreciate any feedback and testing you can do.
The code in your branch won’t build here due to the compiler complaining about:
ArduCopter/Log.cpp:680:1: error: uninitialized const member ‘LogStructure::units’
};
^
compilation terminated due to -Wfatal-errors.
NOTE: I did not actually clone your branch. I started with the most current 3.6-dev code because I’m going to add some other helicopter-specific changes to it. I merged the new loiter PR into that. ArduCopter/Log.cpp was a conflict in the merge and I forced it to your code.
Builds for TradHeli are here if anybody wants to test New Loiter with a helicopter. I test flew it twice already.
Keep in mind if you test it with a heli this is a multicopter-specific modification to Loiter and my initial test flights indicates it works worse than I thought with heli’s. If you fly it make sure you have plenty of altitude - don’t test less than 10m above ground. And make sure you have Acro set up for easy bailout when it goes sour (especially if you have one of the CHx_OPTS set to 43 and engage it with the New Loiter).
If this eventually replaces the current Loiter flight mode in Copter, TradHeli will require it’s own category like Plane or Rover. Unless it can be significantly reworked. Helicopters are essentially more closely related to airplanes than they are multirotors. The only common trait they share with multi’s is that they both have fans on top going around.
No logs yet. They are b()rked. Merging my dev branch, and Randy’s branch, resulted in merge conflicts that I thought I fixed, but effectively broke the logging. We have not moved our helicopter development code to 3.6-dev yet (until this attempt). And I found some things in 3.6-dev that need to fixed (or locked out) first for TradHeli.
I have to discuss this with the other guys and figure out what direction we’re going to take. If this change to Loiter affects Auto too, then we have a problem.
The builds I posted will fly your helicopter, and allow you to try new loiter. But it is by no means anything but experimental firmware.
Edit:
I found two issues not related to New Loiter in those helicopter builds, one of which will cause a crash. I pulled them. If anybody downloaded them to try it, don’t fly it. We have some work to do on 3.6-dev before we get excited about experimenting with New Loiter with helicopters.
They’re not hard at all if you look at them from an airplane standpoint. In hover they sort of share some characteristics with multi’s (very loosely). But that’s where the similarities end. In flight they fly like an airplane - the control inputs, short of collective management, are even like an airplane. They pitch up and down, roll, climb, dive and create lift in forward flight - just like an airplane. The only real difference is that the wing on a heli is rotary and used for propulsion thru cyclic pitch, on an airplane it’s fixed.
Let’s face it - current Loiter controller (and Nav controller) in Copter is far from ideal for heli’s. We really need the L1 Nav controller from Plane. And this New Loiter will be fun to test to see if I can arrive at a combination of settings for it that is suitable for helicopters and maybe get better performance on Auto flights.
I didn’t get a chance to play with settings in my first two flights. But the defaults were not ideal. How do you turn off that “braking” feature? Or least limit it to say 0.1G or something so you can get a smooth stop with a heli vs it acting like somebody just whacked it with a baseball bat? Maybe that can be tuned with the lean angle? As long as it doesn’t limit my acceleration coming off turns in Auto. I run 590-650 for WPNAV_ACCEL to keep the “leash” short and kind of, sort of, roughly get the heli to hit the waypoints @ 30m/s. But the current implementation still pretty much sucks for heli’s. It took me a long time to arrive at a setup that (kind of) works with the current controller. There’s a lot of stuff to test here.
This should work fine with Heli with appropriate parameters. The trick is to not put it into a situation where it is climbs dramatically when you pull back in Alt Hold. While Heli’s behave like a plane at high speed they are the same as a multi at low speed. If you set Loiter up with that in mind I think you will get good results. In any case, if you were able to get Loiter working before then this Loiter will also work but with a more direct feeling on the sticks.
For Heli I would suggest keeping the maximum Loiter speed to about 15m’s
WPNAV_LOIT_SPEED 1500
Then set the maximum lean angle to be whatever you need to achieve 15m/s.
WPNAV_LOIT_ANGM 20 (It is in degrees at the moment)
Drop the deceleration down so you get a more gentle braking and slow the transition time.
WPNAV_LOIT_MINA = 50;
WPNAV_LOIT_TRAN = 1.0
You may also like to reduce the aggressiveness with which it corrects for position errors by dropping:
WPNAV_LOIT_MAXA to 250.
The issues you highlight with heli are all around the fact that heli transitions from a mode where the altitude is controlled primarily by the thrust with only a small coupling to pitch (or angle of attack), to a mode where it is primarily controlled by angle of attack and the thrust has little to do with it. We see this issue with a number of aircraft types including multi rotor aircraft with lifting surfaces. I have not formulated an acceptable solution but I am working on it.
This is the param I was wondering about. Roughly 7 degrees of nose-down pitch is what’s required with my 600 test heli to cruise at 15m/s in no-wind conditions. But I can pull 20 degrees or more in hard acceleration. So if I set that to 7 how does it affect the heli’s lateral accel capabilities? And what effect does it have in Auto flight?
These are questions based on the fact that I haven’t tested it enough yet. But just curious up-front as to what to look for.
It does matter, and thanks! That was one of the things I had to fix and I br()ke it as I did it quickly and didn’t review your changes close enough to merge with Peter’s changes adding units. The other issue is that my test heli has a DDVP drive on the tail and that’s still broken in master. I fixed that in my test code and as soon as I have a working implementation of New Loiter for heli’s with everything working I’ll re-post the binaries so other interested folks can test it too.
The logging works so you can report issues and provide logs. DDVP drives now work properly. I was going to remove InvertedFlight (CHx_OPT = 43) from this build because I found a problem with it. Some TradHeli users might not be aware that you can engage inverted flight in Loiter with helicopters in 3.6-dev. I decided to leave it in for now, but just don’t use it in testing New Loiter until we get a chance to look at the issues with it.
The primary function of loiter isn’t to thrash around and perform hard accelerations. Lets start by getting it working for precise placement of the aircraft during a landing or aerial filming situation. So start with a lean angle that is representative of what you would do if you were trying to fly around smoothly below 15m/s.
It does not affect auto flight. It does limit your acceleration to what you would get with a maximum lean angle of 7 degrees. I would suggest starting with 10 to 15 degrees based on what you have said. This will not restrict the aircraft’s ability to fight the wind.
I would suggest that you start with a maximum lean angle of 10 degrees and maximum speed of 15m/s. Then look at increasing up to something like 20 degrees and 30m/s (or whatever your top speed is at 20 degrees). In any case start slow and think of this as tuning the repositioning during landing in an RTL. Then you can push it.