enabling ultrasonic sensor and altitude hold

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
noobee
Posts: 66
Joined: Fri Feb 25, 2011 2:57 pm

enabling ultrasonic sensor and altitude hold

Post by noobee »

hey Alex,

i'm working on enabling the parallax/seedstudio ultrasonic sensor for altitude hold.

http://www.seeedstudio.com/depot/ultra- ... p-626.html
http://www.parallax.com/Store/Sensors/O ... fault.aspx

so far, the module code is working using interrupts (PCINT10) and is integrated into the main loop to sample once every 50ms.

a couple of questions:
- what is your expected range for altitudesmooth? i don't have the bmp085 so i don't know what that sensor is supposed to return. multiwiiconf seems to use a limit of 300, which i thought has relatively low resolution (9 bits vs the potential 16 bits for altitudesmooth). is the intended range for the sensor output for altitudesmooth 0-300?
- the current baromode altitude hold algorithm is p=5 (not PID), do you plan to incorporate PID control eventually?

thanks!

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: enabling ultrasonic sensor and altitude hold

Post by Alexinparis »

Hi,
I plan to implement a PID with a mix between Z ACC and baro values.
I still don't know precisely how. (not enough time these days)
Currently, on the GUI, one unit = 10cm.

User avatar
dramida
Posts: 473
Joined: Mon Feb 28, 2011 12:58 pm
Location: Bucharest
Contact:

Re: enabling ultrasonic sensor and altitude hold

Post by dramida »

Alexinparis wrote:Hi,
I plan to implement a PID with a mix between Z ACC and baro values.
I still don't know precisely how. (not enough time these days)
Currently, on the GUI, one unit = 10cm.

Use the same Kalman filter for one axis only in witch Baro readings are interpreted as ACC input and Z ACC interpreted as giro input.

OpticalFlow
Posts: 5
Joined: Sun Feb 27, 2011 12:22 pm

Re: enabling ultrasonic sensor and altitude hold

Post by OpticalFlow »

At the risk of taking the fun obtained by working it out for yourself away,
the following link provides some useful information on fusing accelerometer
and barometric data:

http://diydrones.com/profiles/blogs/imp ... e-estimate

This is only the sensor fusion aspect, the PID aspect is separate. I guess altitude hold
without stick input is reasonably straightforward, but I imagine altitude hold during
forward flight would be rather tricky as changing the throttle to adjust altitude
would also affect the forward velocity. I guess without a velocity sensor (e.g. GPS)
it won't be possible to maintain both constant altitude and constant velocity.

noobee
Posts: 66
Joined: Fri Feb 25, 2011 2:57 pm

Re: enabling ultrasonic sensor and altitude hold

Post by noobee »

OpticalFlow wrote:At the risk of taking the fun obtained by working it out for yourself away,
the following link provides some useful information on fusing accelerometer
and barometric data:

http://diydrones.com/profiles/blogs/imp ... e-estimate

This is only the sensor fusion aspect, the PID aspect is separate. I guess altitude hold
without stick input is reasonably straightforward, but I imagine altitude hold during
forward flight would be rather tricky as changing the throttle to adjust altitude
would also affect the forward velocity. I guess without a velocity sensor (e.g. GPS)
it won't be possible to maintain both constant altitude and constant velocity.


cool! thanks for the link! it was really helpful.

i was reading up about kalman filters and my eyes just glazed over :) there is a nice code example in the web, but this one is straightforward and easier to understand.

have not added pid control yet. so far, using P only leads to oscillations even if i constrained the throttle changes.

also plan to disengage altitude hold if the copter is tilted too much.

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: enabling ultrasonic sensor and altitude hold

Post by Alexinparis »

At the risk of taking the fun obtained by working it out for yourself away, ...


Don't worry, my aim is to bring the best I can find, from my brain or from other open place, I don't care ;)

One more example of open source power:
I discovered today this video:
http://vimeo.com/20764213

This man is a genius: he took my code, improved it, made a demonstration, and shared it.
This is exactly what I expected when I decided to release and share the code.

OpticalFlow
Posts: 5
Joined: Sun Feb 27, 2011 12:22 pm

Re: enabling ultrasonic sensor and altitude hold

Post by OpticalFlow »

He's been posting a fair bit on diydrones, it appears he's been building pretty much every VTOL kit that's out there,
KK multicopter, MultiWii, nVader and a few others - so far I didn't have the impression he did his own development though.

To be honest, I couldn't quite gather what he did based on the video. Did he share his modified code for altitude hold?
Also, he seems to live in your neck of the woods.

noobee
Posts: 66
Joined: Fri Feb 25, 2011 2:57 pm

Re: enabling ultrasonic sensor and altitude hold

Post by noobee »

i have simple code for interrupt-based sampling for 1-pin and 2-pin ultrasonic sensors (tested for 1-pin). currently reporting raw altitude in cm (instead of decimeter) since i think it has better resolution than the barometric sensor.

i can post the code if anyone is interested. after this, i'm planning to get some PID control working for altitude hold and also fuse with the ACC sensor (thanks to OpticalFlow's link).

jimnaz
Posts: 16
Joined: Fri Jan 21, 2011 5:21 pm

Re: enabling ultrasonic sensor and altitude hold

Post by jimnaz »

To be honest, I watched the video but I cannot see what is so wonderful. He was not holding altitude but was still going up and down. Leveling on the other hand looks pretty good. Couldn't find the code he alleges to have shared either. :?:

Post Reply