How to start programming the ELEV-8 V2 flight controller?
WolvesOfTheNight
Posts: 9
in Propeller 1
I have an ELEV-8 V2 that I would like to use for a project in my controls class [college senior level]. While the V3 looks like it is a lot better I am on a tight budget, both for time and cost.
I have a lot of programming experience, though not much with the Parallax system. I would like to be able to access the code for the flight controller, figure out how the system works, and demonstrate how simple modifications affect performance. (Yes, I know how easy it will be to come up with impossible to fly settings). Since it is open source I assume that this should be possible.
My problem is that all of my searches are coming up with information on the V3. The source code on gethub is for the V3 and the links on parallax.com are coming up with only stuff for the V3. Can anybody point me where to get started on programming for the V2? What I really need is:
1) Where to download the latest source code
2) Documentation related to how it works (if it is not included above)
3) Instructions on compiling and installing the code on my quad (if they differ from compiling and installing other stuff with the propeller tool).
Any help is appreciated!
I have a lot of programming experience, though not much with the Parallax system. I would like to be able to access the code for the flight controller, figure out how the system works, and demonstrate how simple modifications affect performance. (Yes, I know how easy it will be to come up with impossible to fly settings). Since it is open source I assume that this should be possible.
My problem is that all of my searches are coming up with information on the V3. The source code on gethub is for the V3 and the links on parallax.com are coming up with only stuff for the V3. Can anybody point me where to get started on programming for the V2? What I really need is:
1) Where to download the latest source code
2) Documentation related to how it works (if it is not included above)
3) Instructions on compiling and installing the code on my quad (if they differ from compiling and installing other stuff with the propeller tool).
Any help is appreciated!
Comments
While the HoverflyOpen claims to be open, it is the hardware design that is open. The software is closed and has never been shared.
Having said that, Jason, who wrote the code for the Parallax V3 controller, took a stab at some code for the HoverflyOpen.
I have attached the files.
Note that the HoverFly will never be self-leveling without additional sensors and code. It might be possible to add the sensors used on the V3, or just add an accelerometer, then port the code to gain the new flight modes, but it would be a significant amount of effort.
http://forums.parallax.com/discussion/148190/quadx-source-code-for-hoverfly-open-elev-8/p1
I will let you know how it goes. And, longer term, I will see if I can budget for a V3, or some other more up to date multi-rotor...
https://www.parallax.com/product/31500
May even produce a new thread.
However, I have been unable to get a stable position using the ITG-3200 from Jason's Quadx. The position drifts up or down too much to be useful. Once it starts drifting it tends to consistently drift in the same direction, but it is somewhat unpredictable what direction it will drift in.
I am setting it up the same way as he is, except that I leave out the high/pass filter or gain option. (I tried using the filter but it didn't help). I integrate the position once, just as he does. I did a temperature calibration using his code and ground station, and I put those value in for the temperature drift. However, while the graph on the ground station comes up with nice consistent lines, the numbers tend to vary by +/- 50, so I don't know if this is part of the problem.
A few thoughts:
- There could be something wrong with the temperature drift. Any idea how many degrees/min these things will drift if they are not calibrated? And how consistent are your drift readings from the ground station?
- It looks to me like Gyro.GetRy & Gyro.GetRx are returning velocity not acceleration. Is this actually the case?
- My control loop does not currently have any synchronization; it just runs as fast as it can. It reads and integrates the gyros every time around. This is an undesirable way to handle gyro integration; you really want proper management of the integration time. However, it should work if the loop always takes the same amount of time to run (which is a big if).
Any thoughts on where I should focus? And is there some working gyro code out there that will just give me the current angle of the system?
Thank you!
Drift compensation does help, and everything tuned well I've been able to hold a set orientation for up to 30 seconds, but that's rare.
An accelerometer is subject to the force of gravity, so you can use that vector as a "down" reference and correct your orientation estimate slowly to counter the gyro drift.
So, what exactly do GetRX/Y/Z, GetRawX/Y/Z, and GetAX/Y/Z do? Will one of those give me the current orientation of the quad? If not, do you have any tips on how to approach the problem?
When I first looked at your code I was assuming that you were getting the velocity from the gyro and then integrating it to get the orientation. Now it sounds like that is not the case; maybe you are getting the orientation. So, what is GetRX doing? Giving you the acceleration, velocity, or position? And, depending on that answer, why are you integrating it.
I really appreciate your help!
The QuadX-Open code behaves a lot like a heading-hold gyro on all 3 axis. It tries to hold a specific orientation based on the integrated values from the gyro, but it requires a pilot and will never do auto-level or heading hold without additional sensors and code.
If you're interested in doing a full orientation solution, take a look at the code and descriptions (readme files) in here:
https://github.com/parallaxinc/Flight-Controller/tree/master/Firmware-C
There's a rich-text doc here that explains how the internals work and provides formulas for a lot of the IMU code too:
https://github.com/parallaxinc/Flight-Controller/tree/master/Helpers
Over the summer I hope to work on some more interesting projects with the Propeller chip. But I don't know if I will find the time or not...