Pages: 1 [2] 3 4 5   Go Down
Author Topic: Arduino Helicopter Autopilot  (Read 7616 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

Firstly, the code I borrowed some of the kalman filtering was based on the Wii nunchuck, but this code uses the Sparkfun accel and gyros.

I'm constantly omptimising the code, and yes delay is bad, I never use pulse in.

I am interested in looking at some of the other hardware timers, but for the moment I'm concentrating on getting the hardware smaller and well integrated into the helicopter. I have a collective pitch version too now, there are two platforms to build.

Cheers for all the support!
Logged

London
Offline Offline
Faraday Member
**
Karma: 8
Posts: 6240
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
But i suggest to use external interrupts with a hardware timer to count the pulses... Without wasting CPU power, the secret is never use pulseIn
Hi jordi,

The most recent ardupilot code I could find does use pulseIn, have you posted a version of the code that uses the timer?
« Last Edit: January 07, 2009, 06:59:13 am by mem » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all,

Once again, thanks for all your input and interest.

The code is now online and both Collective pitch and fixed pitch development code-bases are available.

The serial API has been implemented with control input from the processing sketch.

Come and get it from www.eclipseaudioservices.co.uk/extras/helicopter.html

Have fun!
Logged

London
Offline Offline
Faraday Member
**
Karma: 8
Posts: 6240
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Ed, interesting writup – I would love to see the helicopter in flight – have you posted a video?

BTW,  I see that your RC signal decode and servo output code  are both done in the foreground. This eats into the number of sensor readings you can process. You may want to consider using code that does the decoding and servo driving in background using  the ATmega168 hardware timers to do the work.

The RC decoder is here : http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1228137503
it uses pin 8 as input and has failsafe that can be set to last good signal or any preset

The servo driver code is here: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1230479947/13

PM me if you would like help integrating the code into your app.
« Last Edit: January 22, 2009, 07:47:20 am by mem » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi mem,

I'd like to work on integrating these, I've looked at both libraries in an effort to understand the timer functions etc. I'd be interested in trying to now that I've got my tax return out of the way.

The servo outputs seem to have the biggest impact on performance, it would be great to get that going in the background. I also like the idea of the preset values on signal loss, given that there is mixing between RC and Serial control it would not be good to include noise from the RC when flying on the serial 'line'.

I've upped the sensor count too, I now have the code ready for 6 degrees of freedom, but there's a few little issues to iron out.


There will be some video soon, but the hardware needs some more work before I risk actually flying properly. It's dangerous enough on a tether! (For a little while, it was over-reacting to movements)

Cheers,

Ed
Logged

Cincinnati, OH
Offline Offline
Newbie
*
Karma: 0
Posts: 26
Still Learning
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is fantastic! Keep us posted
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all, Mem in particular, you might be interested to know that I've adopted your libraries.

The servodecode and servotimer2 libraries work very nicely.

As I expected, they're a lot less heavy on the processor. I have to say I enjoyed the process of implementing these features myself, it certainly taught me a lot in the process, but implementing this in hardware is the way forwards.

The refresh rate has practically doubled, and I've honed my control system further, there is no noticable change in performance between signal present and failsafe states (my first encounter with servodecode had some unexpected results - I am so glad I've been working without the speed controller connected!!)

Do you know of the reason for the spurious state changes between failsafe and ready when the RC transmitter is turned off? I'm guessing that it's because of noise on the input which lies within the timing range we're interested in.

I've put in a counter and only allow the signal to pass once 10 consecutive cycles are OK.

 smiley
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Gah - a continuation of the previous post...

I've also spotted that because I'm disregarding the failsafe state readings, the function of the failsafe set positions is lost.

Although, this may not be a problem, I'd like to look into ways of making the library's failsafe response more certain, it's prone to letting through 1 or 2 sets of spurious readings in between a whole load of failsafe positions.

Getting there, flight testing will re-commence soon.
Logged

London
Offline Offline
Faraday Member
**
Karma: 8
Posts: 6240
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well done!

Yes, if there is noise on the input that is within the valid signal timing range it can turn the failsafe off. A fix for this would be to modify the failsafe code to wait for some larger number of consecutive value frames before coming out of failsafe.  Also, I would like to do a check to detect if the timings on consecutive frames is random (and therefore probably noise). This is on my todo list but its pretty far down so feel free to add this if you want to.

edit: I was composing this when you sent your previous post
« Last Edit: January 22, 2009, 04:31:07 pm by mem » Logged

Norway@Oslo
Offline Offline
Edison Member
*
Karma: 12
Posts: 2033
loveArduino(true);
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Great Project!

This thread has made me almost buy a RC heli too many times. smiley-wink
I was into the fuel RC 4x4 some 7 years ago, and I find myself missing it when reading this post. I remember I actually wanted a helicopter, but I was 13yr and the age restriction was set at 14. smiley-sad

Would you recommand a el or fuel heli? [I have a lot of space, both indoors and outdoors, and I also have some/little experience starting twostroke engines (? do not remember their name, but those engines that helis and planes uses)] Also; I also want a 4channel heli or more.

Sorry for being slightly off topic, but I love the whole idea of radicontrolled complex machinery 8-)
Logged

London
Offline Offline
Faraday Member
**
Karma: 8
Posts: 6240
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Recommending the ideal heli power source is a bit like recommending the ideal programming language – it depends on what you want to do.

I prefer electric – its clean, low hassle, and I can fly indoors in a large enough space. The battery technology available today has virtually eliminated the traditional power to weight advantages of gas/nitro fueled engines.

There are many other choices you need to make – size, rotor mechanics, kit or built, type of electronics etc.

There is lots of information on the web of the pros and cons of each – www.rcgroups.com is a good source for detailed info.

If there is a radio control flying club near you – drop in on and ask the people there – having someone local experienced in the kind of heli that you have can make learning much easier.

Have fun!
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'd second what Mem was saying, electric helis seem to be the way forwards especially for the development of something like this, I personally quite enjoy being able to sit indoors working on the code with the helicopter attached to the computer for debugging.

Nitro engines vibrate more, giving more grief to the sensors (more noise) and potentially can harm the electronics in other ways too (fuel contaminations etc etc)

Brushless motors and LIpoly batteries yield a similar performance to nitro engines these days anyhow. Having two or more available means you can cycle the batteries between use and charging.

The code works equally well with either, but it may be advisable to make some small adjustments to how the throttle pulse is calculated in order to maintain a smooth idle.

Oh - and did I mention that you can fly this system over a wireless serial link from Processing, or anything else you fancy coding to output the right control data...
Logged

Norway@Oslo
Offline Offline
Edison Member
*
Karma: 12
Posts: 2033
loveArduino(true);
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What is a typical max load for a beginners el heli with 55-60cm main rotor?

This has inspired me to add another project on my TODO
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Umm - my 450 Trex has a max flying weight of about 900 grams. The heli itself without the batteries is about  600 grams.

If you are using a CCPM (collective pitch) heli, look at the CPHeli code on my site, if you are thinking of using a fixed pitch heli, look at the Piccolo code.

www.eclipseaudioservices.co.uk/extras/helicopter.html

I'm so glad to hear people are liking this project - any productive ideas that you have, please let me know and I'll see what I can do to integrate them.

I've ditched the autonomous procedures for now, I'll be looking into it again soon. But to be perfectly honest, autonomy is easy in comparison to making it stable in the first place.

Best of luck!!
Logged

The hills of Tennessee
Offline Offline
Newbie
*
Karma: 0
Posts: 49
What, me worry?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Ed and MEM,

Ed, I downloaded your code and tried to run it. Although it compiled fine and runs, the servo movements are very jerky. The servos do move proportionally, but they are not smooth at all. There are three very prominent steps as you move the transmitter sticks. The Yaw servo will not move and I had to change the input pin from pin2(what the code specifies) to pin8(what ServoDecode uses). Do you have any idea why the movements are so jerky?

Another thing. How can you specify 5 timers? I thought Arduino only had three.

I am very interested in your mixing of the channel pulsewidths for use in my Tri Copter.

Jim
« Last Edit: January 23, 2009, 06:39:08 pm by aercam » Logged

Pages: 1 [2] 3 4 5   Go Up
Jump to: