I've been trying all day to get this working properly with minimal success. I have followed the guide here: http://code.google.com/p/ardupilot-mega/wiki/Xplane.
I'm running 2.5.4 with the hil firmware from mission planner, and I'm using the QRO_X model and params from JLN. I have calibrated my radio, and set my frame orientation to + mode
There is communication between Mission planner and xplane, but I cant get any real sort of control over the quad in the sim. It will oscillate on the yaw axis, and the pitch and rolls will be way too sensitive and just spin it.
Under the simulation tab of mission planner (after arming) I can see my radio inputs making changes to the values under Ardupilot output .Eg Roll and pitch show 0 when neutral and go to -0.145 and 0.145 at either extreme, yaw seems to wander on its own and I can see in the sim that the quad is sort of tumbling around by itself, and throttle is at 0.100 when it is at its minimum and goes to 0.200 at max. As soon as I start the sim, the quad takes off by itself and there's no way to give it 0 throttle, so I think this is a problem.
How do I sort these issues out?
Also I'm having a really hard time trying to figure out which view to use. I want to learn to fly line of sight and get my nose in hovering sorted.
I've reduced my rate_p to 0.05 and that's helped with slowing down the controls, but the yaw will still oscillate by itself. and I still cant figure out which view to use for a line of sight flight. Selecting 'on runway' is way too far away to get a good view of what is going on, and still can't bring throttle to 0.
There are a lot of tips. Here are a few you will want to explore.
* use X-plane 9 - I have both, and although I like the features in 10, 9 is more stable/reliable for consistent testing
* Change the settings so that you use 3 or more flight models per frame
* for initial work, be sure to completely kill the weather/wind. After you have things sorted, you can turn it back on.
As for the throttle problem, there are many places where you can make changes. It is helpful to catalog these mentally, before you make changes...
You could change your throttle curves in your TX, but I generally don't recommend this as a first step. It sometimes comes in handy for certain combinations of settings, and is even useful to get a more refined/useful throttle control for your actual quad (but it is a somewhat advanced topic for most non-RC regulars so ignore it for now.)
You can change some scaling factors within MP/Simulation.
You can change the X-Plane model's power/engine/motor characteristics. This gets complex, and there are lots of settings, but it is most likely the ideal first place to make changes. Which model are you using? There are some non-intuitive settings, and some settings do not work exactly as you might expect.
Also, revert to whatever settings were recommended for the model, and start over, focusing on getting your throttle working the way you expect it to, at bit better, at least, before messing too much with rate_p. You may have to re-adjust rate_p, however, do so only after you have updated your flight models per frame to 3 or greater.
I feel like I am leaving out an important one, but the point here is not to actually help, yet, but rather to generally outline the places where you will want to look.
The most important thing that I recommend you do first, however, is to go into your data settings in X-Plane, and enable some console/in-sim data. I recommend at least enabling (names from memory) Frame Rate, Prop RPM, Engine HP, Throttle level, Airspeed (its a collection of items, this one, but includes the airspeed) and altitude, and after you've re-enabled wind, atmosphere also.
Thanks for that. I'll give it a go once I have xplane 9 demo installed. What do you mean by having 3 flight models per frame? Is this an obvious setting to find?
I have been using the QRO_X model posted by Jean-Louis Nadin.
It is a somewhat obscure setting to find, look for it under "Operations & Warnings" or see http://wiki.x-plane.com/Chapter_5:_X-Plane_Menus#Flight_Model
I have not yet used the QRO_X model, but Jean-Louis Nadin's a good guy, and on here regularly.
One thing you should know is that the HiL system is highly variable from one setup to another. The latencies associated with memory, CPU, and interprocess communications wreak havoc with the sensor response times to/from, and so you often have to re-tune for each computer. It is best to have lots of memory (for MP and X-Plane), a fast CPU, and to reduce or eliminate as much of the other processes as possible. Don't leave any Internet Exploders running in the background, don't leave AV scans going, close all office applications, that is, if you are using Microsoft in the first place, and get rid of anything that is hogging your memory, accessing your disks, or demanding your CPU time that you do not need. Or the PID tuning will vary too much from one run to another, as a general tip.
Consider, in the real world, the "distance/time" between action (throttle change on a motor) until there is new, related data from a sensor, and the "distance/time" from that sensor to the APM processor is more or less fixed, and short, on a specific 50 hz cycle, generally. You might miss one beat, perhaps, maybe two, but it is pretty consistent. However, when you are bouncing the input through the radio, into the APM, kicking it out (during one 50 hz cycle) to a message (another) and out to the USB, where the OS collects it, hands it off to MP, which decodes it, then encodes it into a network message, hands that back to the OS, which packages it to hand it to itself, which gets listened to by X-Plane, which then takes action, then X-plane kicks out some sensor data, possibly related to the input that was just made, but most likely lagging a cycle or two before the input has any effect, then, when it does, it goes back from X-Plane to the OS for networking, then from the OS to MP for relay/repackaging into USB, then the APM rolls around to another cycle of reading the "sensors", and crunches that data into its PID loops.... since the time is more variable from USB->OS->MP->X-Plane->X-Plane Physics->X-Plane Sensors->OS->MP->USB than it is from APM proc->ESC->motors, sensors->APM proc, your flight to flight experience will change if the OS takes more or less time for each operation....even if the sensor update rate is fixed at 50hz in X-plane (which, hopefully, you did not forget to set to begin with, or you'll have a worse time of it..)
After you've read, and made the setting changes I've recommended, reset to the recommended PIDs as a baseline, and enable the on-screen data for frame rate, throttle, RPM, etc, then share how your experience is again, with those changes, and either I or someone else here can help further. Those other things are critical, IMO, so I start with them. Cannot work too many issues in parallel, if these are not addressed first, you're just a cat chancing your own tail...and the circle changes each time as you make adjustments
Thanks for that, just running xplane 9 seems to have eliminated a lot of the weird behaviour I was getting right off the bat. I've enabled those extra boxes you suggested. I am running a reasonably quick pc and framerate seems to be a solid 100/sec (assuming freq = framerate).
So I have gone back to the stock pids JLN posted with his model, and with the stock gains in mission planner, I still can't get it to take off. It shows the throttle in ardupilot output as .100 at min and .200 at max. Max throttle = about 2000rpm in xplane. If I change the throttle gain to 3500, it shifts the throttle range to .288 - .575, which gives me about 5000rpm and allows me to lift off slowly.
Where would I change the motor settings? Do you have an alternative multicopter model I could/should use? ideally I'd like to be able to have a similar amount of thrust/power as your average multicopter, and to be able to drop throttle to 0!
Oh, also, when you want a break from multicopters, take this plane for a spin:
And for some humor, check out one of my HiL Quad flights - I left for food, and came back to find my quad was competing for an X-Prize :)
That was flight gear, but I only use X-Plane these days. It's good for a laugh.
Alright, so I've got it mostly controllable, but the throttle is still a bit of a hack job with the gain reduced to 3100 in mission planner, which gives me an ardupilot throttle output range of 0.325 to 0.650. I can't seem to find a pid parameter for throttle that will let me increase this range. Ideally I'm looking for 0 to 1 I think. Any ideas?
Oh yeah do you have the xplane model of your bixler available somewhere?