Is the MatrixPilotQuad code flyable ? Seems yes :)

302 views
Skip to first unread message

Riccardo Kuebler

unread,
Jan 7, 2012, 4:04:08 PM1/7/12
to uavdevboard
Hi all,

here you will find a video of a flight with r1158 from quad testing branch.

Manual controls are still very weak, but seems that Bill limited the movements for roll and pitch to 30 degrees.

The quad is an Arducopter frame equipped with UDB4. With the latest code it is incredibly stable and very easy to control.

As already stated by Bill in the other thread, there are still several missing pieces in the code, so don't try to fly it hard and especially in circle.

Best regards,

Ric

Mark Whitehorn

unread,
Jan 7, 2012, 4:27:58 PM1/7/12
to uavde...@googlegroups.com
Thanks Ric,

Nice flight and video. Were you using the default gains?
I'm guessing there was no wind.

--markw
--
Mark Whitehorn
kd0...@gmail.com

Riccardo Kuebler

unread,
Jan 7, 2012, 4:32:02 PM1/7/12
to uavde...@googlegroups.com
Thank you Mark,

yes, I'm using the default gains. I find them appropriate. I will probably change something to feel what happens.

There was a strange North wind. Not very strong, but noticeable. You can see the effect when to hold the quad in place I had to pitch it a little bit forward.

Best regards,

Ric

2012/1/7 Mark Whitehorn <kd0...@gmail.com>

William Premerlani

unread,
Jan 7, 2012, 4:55:57 PM1/7/12
to uavde...@googlegroups.com
Hi Ric and Mark,
Thank you so much for doing the first test flights of MatrixPilotQuad and publishing your videos. I find your observations and suggestions to be very useful. I will put a large weight on your design ideas.
Best regards,
Bill

Phil Giacalone

unread,
Jan 8, 2012, 8:59:38 PM1/8/12
to uavdevboard
Hi Ric and Mark,

Thanks for posting those videos, guys. Way cool.

All I can say now is... I gotta get a quad!

Best regards,
Phil


On Jan 7, 1:04 pm, Riccardo Kuebler <kueb...@ticino.com> wrote:
> Hi all,
>
> here <http://www.youtube.com/watch?v=aeNaBSZLd0A> you will find a video of
> a flight with r1158 from quad testing
> branch<http://code.google.com/p/gentlenav/source/browse/#svn%2Fbranches%2Fqu...>
> .

William Premerlani

unread,
Jan 9, 2012, 2:55:54 PM1/9/12
to uavde...@googlegroups.com
Hi Phil,
If you are going to get a quad, I should mention a couple of them that I am aware of. Of course, there is the ArduCopter, that is the one that Ric has.
There is also a "DraganFlier". That is a do-it-youself quad that Ben and I have. We built it from a commercially available frame. You can by the frame for $120 from RC toys:
Its a very nice, lightweight carbon rod frame, about 1/2 of the weight of an ArduCopter.
You would also want to get the additional bracing for $15:
And finally, if you want an exact clone of what I am testing with, you will need four of these:
And, of course a UDB.
If you go with the DraganFlier, there is some do-it-yourself: you will have to come up with some way to mount everything to the frame, and you will have to figure out a way to distribute power from a 3 cell LiPo to the 4 ESCs.
Best regards,
Bill

Phil Giacalone

unread,
Jan 9, 2012, 6:00:12 PM1/9/12
to uavdevboard
Hi Bill,

Thanks for mentioning that option. I'll take a look...

Best regards,
Phil

On Jan 9, 11:55 am, William Premerlani <wpremerl...@gmail.com> wrote:
> Hi Phil,
> If you are going to get a quad, I should mention a couple of them that I am
> aware of. Of course, there is the ArduCopter, that is the one that Ric has.
> There is also a "DraganFlier". That is a do-it-youself quad that Ben and I
> have. We built it from a commercially available frame. You can by the frame
> for $120 from RC toys:http://www.rctoys.com/rc-toys-and-parts/DF-COMPLETE-AIRFRAME/RC-PARTS...
>
> Its a very nice, lightweight carbon rod frame, about 1/2 of the weight of
> an ArduCopter.
> You would also want to get the additional bracing for $15:http://www.rctoys.com/rc-toys-and-parts/DF-FrameBracing/RC-PARTS-DRAG...
>
> And finally, if you want an exact clone of what I am testing with, you will
> need four of these:http://www3.towerhobbies.com/cgi-bin/wti0001p?&I=LXKBF3&P=7
> And, of course a UDB.
> If you go with the DraganFlier, there is some do-it-yourself: you will have
> to come up with some way to mount everything to the frame, and you will
> have to figure out a way to distribute power from a 3 cell LiPo to the 4
> ESCs.
> Best regards,
> Bill
>
> On Sun, Jan 8, 2012 at 8:59 PM, Phil Giacalone <scienceth...@gmail.com>wrote:
>
>
>
> > Hi Ric and Mark,
>
> > Thanks for posting those videos, guys. Way cool.
>
> > All I can say now is... I gotta get a quad!
>
> > Best regards,
> > Phil
>
> > On Jan 7, 1:04 pm, Riccardo Kuebler <kueb...@ticino.com> wrote:
> > > Hi all,
>
> > > here <http://www.youtube.com/watch?v=aeNaBSZLd0A> you will find a video
> > of
> > > a flight with r1158 from quad testing
> > > branch<
> >http://code.google.com/p/gentlenav/source/browse/#svn%2Fbranches%2Fqu...>
> > > .
>
> > > Manual controls are still very weak, but seems that Bill limited the
> > > movements for roll and pitch to 30 degrees.
>
> > > The quad is an Arducopter frame equipped with UDB4. With the latest code
> > it
> > > is incredibly stable and very easy to control.
>
> > > As already stated by Bill in the other thread, there are still several
> > > missing pieces in the code, so don't try to fly it hard and especially in
> > > circle.
>
> > > Best regards,
>
> > > Ric- Hide quoted text -
>
> - Show quoted text -

markw

unread,
Jan 9, 2012, 6:58:31 PM1/9/12
to uavde...@googlegroups.com
Hi Phil,

Another resource for quadcopter construction is here: http://code.google.com/p/matrixpilotheli/wiki/QuadContent

I chose a larger/heavier frame from AeroQuad and cheap brushless motors (KDA20-20L) and 25A ESCs direct from HobbyKing.
My flying weight is about 1.5Kg with a 3S 4200maH LiPo battery and hover current is about 24A for 260W. I estimate (using eCalc: markw's quad config) that it should be able to carry up to 300g of additional payload.

regards,
--markw

Phil Giacalone

unread,
Jan 10, 2012, 11:22:02 PM1/10/12
to uavdevboard
Thanks, Mark. I spent quite some time looking at the AeroQuad web site
and videos. Very interesting and nicely produced content. Looks like a
quality product. More food for thought -- when I'm ready to pull the
trigger :-)

Best regards,
Phil


On Jan 9, 3:58 pm, markw <kd0...@gmail.com> wrote:
> Hi Phil,
>
> Another resource for quadcopter construction is here:http://code.google.com/p/matrixpilotheli/wiki/QuadContent
>
> I chose a larger/heavier frame from AeroQuad and cheap brushless motors
> (KDA20-20L) and 25A ESCs direct from HobbyKing.
> My flying weight is about 1.5Kg with a 3S 4200maH LiPo battery and hover
> current is about 24A for 260W. I estimate (using eCalc: markw's quad config<http://ecalc.ch/xcoptercalc_e.htm?ecalc&weight=1620&calc=auw&rotornum...>)

markw

unread,
Jan 11, 2012, 10:30:06 AM1/11/12
to uavde...@googlegroups.com
Bill,

I am trying to gain some understanding of the effects of the PID gain parameters on the behavior of my quadcopter, and would appreciate comments on the behavior shown in the attached graph (pdf). I've converted the quad_testing rev1158 log values to degrees, and labeled the x axis in seconds for convenience. I am seeing an immediate response to control inputs, followed by a negative reaction which might indicate a bad gain parameter. The complete log file from which this data was extracted is also attached.

My roll and pitch KP values are much lower than the defaults at 0.07, but increasing them to say 0.1 results in large oscillations which I don't believe are pilot induced.

Log header:
ROLL_KP = 0.070000, PITCH_KP = 0.070000
ROLL_KI = 0.010000, PITCH_KI = 0.010000
ROLL_KD = 0.450000, PITCH_KD = 0.450000, YAW_KD = 1.500000
ROLL_KDD = 0.500000, PITCH_KDD = 0.500000
ACCEL_K = 0.000000

pitchResponse.pdf
rev1158mod1_10.csv

William Premerlani

unread,
Jan 11, 2012, 11:55:58 AM1/11/12
to uavde...@googlegroups.com
Hi Mark,

Well, at this point, you and Ric seem to be the experts on tuning the PID gains...right now I am working on the next generation controls, so I do not want to get sidetracked. I have not given PID tuning a lot of thought or experimentation yet. I was able to get my quad flying quite nicely with just a little bit of experimentation. Also, the overall performance of r1158 is pretty good, so PID tuning is not a high priority for me, I will put it on my list. ;-)

For now, I can offer the following comments:

Version 1158 of the quad controls is slight variation of a classical PID controller. The wikipedia entry on PID controllers has some good information on tuning.

The only departure of r1158 from a classical PID controller is the KDD term. I found that, for my draganflier, the KDD dampened a tendency for my quad to wobble. I did some analysis that suggested what is going on with quads: there are a lot of integrators in the response of the quad to changes in ESC commands. There is a fair amount of energy in the rotation of the propellers, so the immediate response of the props to a step change in commanded ESC command is a ramp in speed. That is an integrator.

Also, the ESC itself has a dynamic model, it could be introducing some latency.

And then the response of the orientation of the quad itself to the change in torque generated by the props is inertial in nature, so that is two more integrators. So, all together, there are three integrators in series in the plant model. That is a recipe for oscillations in a feedback loop.

So, I suspect that what you are seeing is the classical response of the dynamic model of a quad to a simple PID controller. Some overshoot or undershoot is expected. In general, raising KP is supposed to reduce overshoot and undershoot, but with the dyanamic model of the quad, raising KP will lead to oscillations. But that is just a conjecture on my part.

I encourage you to read up on PID controllers, and try some of the recommended ways of tuning PID loops. In particular, I would be very interested what would happen if you varied the KDD gain, including setting it to zero.

Best regards,
Bill

William Premerlani

unread,
Jan 11, 2012, 12:10:11 PM1/11/12
to uavde...@googlegroups.com
Hi Mark,

One more thing I forgot to mention in my last email....

The inertia of the propellers works against the roll and pitch control, but it actually aids the yaw control.

The reason for that is the net change in the the total angular momentum of the propellers for a change in roll or pitch is zero, but that is not the case for yaw.

When roll or pitch control applies a step change in commanded motor speeds, it takes a little while for that to produce roll or pitch torque.

When yaw control applies a step change in commanded motor speeds, that produces a yaw torque immediately.

Best regards,
Bill


On Wed, Jan 11, 2012 at 10:30 AM, markw <kd0...@gmail.com> wrote:

markw

unread,
Jan 11, 2012, 8:20:01 PM1/11/12
to uavde...@googlegroups.com
Thanks Bill,

I'll continue experimenting with the PID gains and try to build a Matlab model which behaves in a similar fashion.

I had tried KDD=0 in one of my first tests and the instability was greater.  Now that I have it flying reasonably well it should be possible to find at least a local maximum for stability. My main concern was whether I might be far from the global max in stability.

--markw

William Premerlani

unread,
Jan 11, 2012, 11:19:58 PM1/11/12
to uavde...@googlegroups.com
Hi Mark,

Its good to know that KDD helps. The theory suggested that it might help by providing some phase angle lead to compensate for the lag from the inertia of the props and the quad.

The down side of having the KDD is that you now have 4 knobs to turn instead of 3, and a more complex dynamic system to analyze.

I will be very interested in what you learn from your Matlab model. The trick will be to figure out the dynamic model of your quad. If you can develop an accurate model, you should then be able to determine optimum values for your control gains.

By the way, I think it would be possible to determine the dynamic model of a quad from flight data by injecting pseudo random noise into the motor signals.

Best regards,
Bill

William Premerlani

unread,
Jan 14, 2012, 8:06:30 PM1/14/12
to uavde...@googlegroups.com
Team,

I have tested and released r1174 of MatrixPilotQuad. It now uses a "virtual quad" control model. You will not notice much difference in roll and pitch control, but you should see an improvement in yaw control. The controls work as following:

Roll and pitch angles are commanded by roll and pitch input. Yaw rate is controlled by yaw input. These inputs are applied to an ideal, "virtual quad". The PID controller then adjusts the motors to keep the actual quad aligned with the virtual one.

The controls are self-trimming, so you should try flying without adjusting any trims. Simply get the quad flying and you will find that after a minute or two that the trims have improved. Keep in mind that the yaw channel is rate input, so you should not trim the yaw. Just fly your quad for a little bit, and be patient. Flight procedure is as follows:

1. Place your quad on a level surface. (The more level, the better.) Turn on your Tx with sticks in center position, throttle off.
2. Power up your quad.
3. When led stops blinking, controls are ready to go. Pulses start coming out at that point, if you have to arm your ESCs by running throttle up and down, now is the time to do it.
4. At this point, if you need to move your quad, you can do that. As long as the throttle is off, the PID controls are off, the 4 motors are in manual mode. (I test at home, I find it convenient to power up the quad on a desk, and then move it to the floor.)
5. With the throttle all the way down, test the roll, pitch, and yaw sticks. The motors should respond.
6. Advance the throttle, take off, and fly. (Controls engage at about 20% throttle.)

The yaw drift is surprisingly low, given that I have not yet attached a magnetometer. So, after you take off, please be patient while the yaw controls auto-trim, and do not change the yaw trim on your Tx. You should be able to get by with just an occasional small yaw correction.

There have been a few changes to the options.h file:

1. I have combined the ROLL_XX and PITCH_XX gains to TILT_XX, since roll and pitch gains should be the same.
2. I have added a yaw control gain. It is MAX_YAW_RATE. It translates to the yaw rate, in degrees per second, that you will get with maximum stick input. Set it somewhere between 50 and 500. The default is 100, I found that to be comfortable for me. The higher you set this, the faster the virtual quad will rotate in response to the yaw input.
3. I have added a tilt input gain. It is MAX_TILT. It translates to the maximum roll or pitch angle in degrees that you will get with full roll or pitch input. The maximum allowable value that you can set, 45 degrees, is the default value that I used for this latest testing. In prior versions, the tilt input gain would give about a 20 degree tilt with maximum input.

The default PID(DD) gains are for my draganflier. I have not tested it with my ArduCopter. If you have one of those, you should use the tilt gains you have found for the previous versions of MatrixPilot. I have found that the yaw gains that I needed are about 6 times the tilt gains.

Finally, this is unsupported, alpha software. I have tested it with my draganflier, it works, but be careful.

Best regards,
Bill

William Premerlani

unread,
Jan 18, 2012, 6:53:44 PM1/18/12
to uavde...@googlegroups.com
Team,

Ric Kuebler has reported a flip over of his quad in turbulent wind. I analyzed the data and could see that it was a gradually building yaw oscillation that finally led to a roll-pitch oscillation. So, be careful in windy conditions.

In calm conditions, everything is fine. I have several hours of flight test time without seeing any signs of instability.

I am working on making the controls more robust under windy conditions, but in the meantime you might want to lower the yaw gains in the options.h file of MatrixPilotQuad. In my effort to reduce yaw error, I think I turned the gains up way too high. Right now they are:

// Yaw PID control gains
#define YAW_KI 0.06
#define YAW_KP 0.6
#define YAW_KD 1.5

I suggest you try these instead:

// Yaw PID control gains
#define YAW_KI 0.02
#define YAW_KP 0.2
#define YAW_KD 0.5

In the meantime, I am going to implement some ideas that I have to improve stability, and do some more testing and simulations.

Best regards,
Bill Premerlani

William Premerlani

unread,
Jan 20, 2012, 7:05:17 PM1/20/12
to uavde...@googlegroups.com
Team,
I thought you might be interested in what I am up to at the moment with the quad controls....I am in the research phase again, doing some thinking, some math, and some simulations. I have figured out a few things, and have some ideas:
1. The “virtual quad” is a good idea, and will eventually lead to great performance, but the controls for getting the real quad to line up with the virtual quad have much room for improvement.
2. The default PID gains for the present version of the controls are probably way off from what they should be. I have not done any work on tuning them, the values that are there are literally just guesses. When I have some time, I will tune the draganflier and the Arducopter. Or if any of you have the time to tune the controls, I would be interested in hearing the results.
3. I have an idea for a much better controller that is based on the dynamic model of a quad, including propeller spin dynamics, and quad body rotation dynamics. PID is fine if you do not know the “plant model”, but if you do, there are some much better ways to do that. I am going to explore some ideas.
4. I have an idea for determining the quad dynamics in flight. In principle, it is possible to determine it using something called a “Weiner filter”. That was the sort of thing that I was doing for GE just before I retired, in the problem domain of the dynamics of power systems.
5. It is not possible to partition the controls into separate roll, pitch and yaw feedback, based on roll, pitch and yaw errors. The reason for that is simply the dynamics of rotation. For example, response of the quad to roll and pitch torque is not the same for the quad when it is yawing as when it is not yawing. There is a gyroscopic effect. The dynamics of rotation are known, and there have been several papers written on the subject, including several by Robert Mahony.
It will probably take me several weeks to test out my ideas, I will report back when I have made some progress. In the meantime, be careful with MatrixPilotQuad, its still “alpha”.
Best regards,
Bill Premerlani

proc_rock

unread,
Jan 21, 2012, 12:22:33 PM1/21/12
to uavdevboard
This is fantastic! I can't believe my dumb luck for getting into
quads and this project at just the right time. I also can't believe
how long it's taking for my new parts to arrive. During April I will
be coding some autonomous quad flight. There are 2 fundamental ways I
can do this. The first is to have the front arm forward and steer as
if it were a car (crudely described, yaw maneuvers and always pitch
forward). The second is to pitch or roll in the direction of the
target bearing, with no yaw maneuvers except to perhaps stay fixed.
The second way would be more "quad-like". But, if I used the first
method, it may be possible to use more of your autonomous flight plane
code for wind compensation, etc. Of the two, is there a better
approach?

Thanks as always,

--
Sean
> <wpremerl...@gmail.com>wrote:

William Premerlani

unread,
Jan 21, 2012, 9:16:22 PM1/21/12
to uavde...@googlegroups.com
Hi Sean,
I hope to have most of MatrixPilotQuad finished by late spring, but do-it-yourself is fun, so if you want to work in parallel, I encourage you.
I have several improvements in mind for quads, in the areas of centrifugal compensation, wind estimation, and controls that will eventually find their way into the code for fixed wing.
There are at least two ways that you can approach turn implementation.
One way is to keep the quad yaw-aligned with the earth. In that case, you will control pitch and roll to drive the quad in the direction you want it to go. Keep in mind that tilt will be used to both produce forward velocity, as well as the side acceleration needed to change the direction of motion. Also, some of the tilt will be used to adjust for wind.
Another way is to keep the quad yaw-aligned with the desired air velocity vector (don't forget about the wind), and use pitch to achieve the air velocity, and roll to develop the sideways acceleration needed to make a turn.
In any case, I hope you have fun.
Best regards,
Bill Premerlani

William Premerlani

unread,
Jan 22, 2012, 7:55:12 PM1/22/12
to uavde...@googlegroups.com
Team,
I have revised the default control gains in MatrixPilotQuad, r1199, for a "dragan-flier" frame, to improve stability, especially to soften the yaw response. I arrived at the gains by testing several variations using my dragan-flier, and then testing the final set of gains on my ArduCopter.
Best regards,
Bill Premerlani
Message has been deleted

clemens

unread,
Feb 6, 2012, 1:52:56 PM2/6/12
to uavdevboard
Hi to MatrixPilotQuad Users

I am working currently on the Quad Code.
Today I was sorting the code to make it more readable.... for me :)).
Now my question:
is the code shown below ok?

yaw_error_integral.WW += ((__builtin_mulus ( (unsigned int )
(32.0*RMAX*YAW_KI/40.), yaw_error ))>>5) ;
if ( yaw_error_integral.WW > MAXIMUM_ERROR_INTEGRAL )
yaw_error_integral.WW = MAXIMUM_ERROR_INTEGRAL ;
if ( pitch_error_integral.WW < - MAXIMUM_ERROR_INTEGRAL )
yaw_error_integral.WW = - MAXIMUM_ERROR_INTEGRAL ;

or has the last line changed to
if ( yaw_error_integral.WW < - MAXIMUM_ERROR_INTEGRAL )
yaw_error_integral.WW = - MAXIMUM_ERROR_INTEGRAL ;

found in motorCnrtl.c

Regards Clemens

William Premerlani

unread,
Feb 6, 2012, 2:28:32 PM2/6/12
to uavde...@googlegroups.com
Hi Clemens,
Yes, that is a typo bug. I have fixed it in r1228. Thank you so much for spotting it.
The telemetry from my quad flights shows that the error integrators settle out at very small values, so the saturation logic has never been executed. Still, it is best to have it correct, just in case.
Thank you once again.
Best regards,
Bill

gefkuz

unread,
Feb 11, 2012, 4:26:18 AM2/11/12
to uavde...@googlegroups.com
Hi Bill,
 
In the quad code, why the megnetometer is in comment?
Does the GPS correct the yaw drift in stabilized flight, or does we make some correction with the yaw command?
 
Fab

William Premerlani

unread,
Feb 12, 2012, 6:12:48 PM2/12/12
to uavde...@googlegroups.com
Hi Fab,

We found that the UDB is so stable, the magnetometer is not needed in the fly-by-wire control mode of the quad controls. I am able to fly for 10 minutes without any noticeable yaw drift. We will need the magnetometer eventually for waypoints, but it is not needed at all in fly-by-wire.

In the latest version of the quad code, r1228, you are flying a "virtual quad", also known as a reference model. The controls then keep the actual quad lined up with the reference model. In other words, its like a heading hold heli gyro on steroids.

The way it works, the controls are turned off when the throttle is off, and they engage when you throttle up. It is best to throttle up briskly, to prevent the integrators from winding up if the quad cannot respond to the controls.

As the controls engage, they take the yaw orientation at that instant as the reference, and lock into it.

If you apply yaw command from your Tx, the controls apply that as a yaw rate in the earth frame of reference for the virtual quad, and update its orientation accordingly.

There are three pilots in my local flying club who have tried the quad code, and they all say the yaw control is the best they have ever seen.

Best regards,
Bill

Igal R

unread,
Feb 13, 2012, 5:08:47 AM2/13/12
to uavde...@googlegroups.com
Just a small clarification :
UDB3 can be used for the quad code ?

בתאריך 13 בפברואר 2012 01:12, מאת William Premerlani <wprem...@gmail.com>:

William Premerlani

unread,
Feb 13, 2012, 6:38:55 AM2/13/12
to uavde...@googlegroups.com
Hi Igal,
Yes, UDB3 can be used for the quad code. I am flying an ArduCopter with one.
Best regards,
Bill

gefkuz

unread,
Feb 13, 2012, 3:06:40 PM2/13/12
to uavde...@googlegroups.com
Hi Bill,

I made some modification in the code of qad testing branch.
I want to contribute and give the code for all.
The code i wrote, normally, is correct with your use.
I just play with defines.
I really want to include my code, then I can download the new revision simplier.
Can you tell me if I can upload my code?

Peter Hollands

unread,
Feb 13, 2012, 3:26:21 PM2/13/12
to uavde...@googlegroups.com
Hi Gefkuz

Its always super to receive news that people have been coding and would like to share their software.
Thanks for the offer.

May I suggest that initially you create a patch file, and post that on this thread ?

We, including Bill, can then discuss it, and if appropriate, it can be applied to the quad code with a single click,
and pushed to the repository with one more click.

Best wishes, Pete

gefkuz

unread,
Feb 13, 2012, 4:46:07 PM2/13/12
to uavde...@googlegroups.com
As you suggest, you can find the patch file.
 
The biggest modifications are on the telemetry.c . Because my quad is controled with my PC.
As my pc is the controller, I had a function "PID Tune" on my windows application. For that I have to modify the define for the differents Til_Kx. I transform the defines in variables. Like this, I can modify the Tilt by telemetry.
 
I join to the post my windows application who is totaly managed code with a little directx implementation for Joystick input.
 
In future, I'de like to implent the telemetry of matrixpilot, for others gcs.
 
For the moment, my quad is on the ground with propelers a little broken. I test my code and don't find best pid.
13022012.patch
QuadriControl.zip

markw

unread,
Feb 17, 2012, 6:19:35 PM2/17/12
to uavde...@googlegroups.com
Hi Bill,

I haven't gotten around to Matlab models yet; been dealing with the failure of all 5 of my Turnigy TY-P1 25A ESCs (one at a time, and causing much confusion with tuning).
These apparently all had bad MOSFETs. They've been replaced now with 18A ESCs from the DIYdrones store and the quad is flying much better.

I've modified my working copy to allow in-flight gain adjustment using channels 5 & 7 and am now getting a better feel for the effects of gain changes.
I'd appreciate a sanity check on the attached plot; it shows pitch and commanded pitch in degrees as the copter is flown sideways out into a light breeze.
I wonder whether I should expect to be able to reduce the wobble on the wind axis by further gain tuning; since the roll axis didn't exhibit the increased wobble, perhaps this is a wake effect.

thanks,
--markw
LOG00346_gainadj3.pdf

William Premerlani

unread,
Feb 17, 2012, 7:22:00 PM2/17/12
to uavde...@googlegroups.com
Hi Mark,

Your plots pass the sanity check. They are very similar to what I record for my draganflier. Except in my case, my waveforms look like yours not because of a wobble, but because of vibration from unbalanced propellers.

Can you confirm that what you are seeing is not a resonant response to vibration, and not a feedback generated wobble?

One of the things I did recently was to actually measure the tilt impulse response of ESCs+propellers+frame for my draganflier. From it I can do the following two things:

1. Show that PID plus second derivative is the optimal controller.
2. Determine the optimal gains for the controller.

Interestingly, the theory predicts optimal gain values very close to the gains I selected for the draganflier.

Attached is a plot of the measured tilt impulse response and a second order response selected to fit the measurement.

What is plotted is the response of the gyro to a signal impulse send to the ESC.

One of the things on my list is to measure the same sort of thing for the ArduCopter frame.

Regarding what it going on in your plots, I am not sure. Your guess is as good as mine. Maybe better, because you were watching.

By the way, another thing on my list of things to look into is parametric coupling of yaw and tilt: because the three principle moments are not equal, there are some nonlinear gyroscopic coupling effects between yaw and tilt than can generate a tilt wobble and a yaw oscillation. The way to look at it physically is that the yaw creates a centrifugal acceleration that generates a tilt torque if the yaw axis is not perpendicular to the quad frame.

Best regards,
Bill
draganFlierTiltImpulseFunction.pdf

clemens

unread,
Feb 18, 2012, 6:45:09 AM2/18/12
to uavdevboard
Hi Igal,

I use an UDB3, but I want to change to an UDB4.
The reason:
UDB3 is limited to five input channels (without additional hardware).
Currently I am working on a altitude control (<3m) using a UltaSonic
Sensor. This Sensor has a PWM output.
The need of a mode switch (switching betwwen the modes "altitude hold"
on/off) requires six input channels.
so ....

regards
clemens

On 13 Feb., 11:08, Igal R <iga...@gmail.com>:
> Just a small clarification :
> UDB3 can be used for the quad code ?
>
> בתאריך 13 בפברואר 2012 01:12, מאת William Premerlani <wpremerl...@gmail.com>
> :
> >> Fab- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -

markw

unread,
Feb 19, 2012, 8:30:34 AM2/19/12
to uavde...@googlegroups.com
Bill,

Thanks for the advice. I'll attempt to determine whether vibration is contributing to the wobble.

I like the idea of using the gyros to measure impulse response, and I will try to do this for my AeroQuad frame.

I also discovered that I can connect my EagleTree brushless RPM sensor to a UDB PWM input, and am now logging the RPM of one motor. This will allow me to measure the latency of generated thrust.

For calculating optimal gains, are you modeling the quadcopter as separate damped simple harmonic oscillators in roll and pitch?

--markw

William Premerlani

unread,
Feb 19, 2012, 7:46:20 PM2/19/12
to uavde...@googlegroups.com
Hi Mark,

I measured the transfer functions of roll and pitch on my draganflier to be of the form H(s)=K/(1+a*s+b*s*s), which as you know, is a simple damped harmonic oscillator. This is the transfer function from ESC input to gyro output. The exciting thing is you can exactly compensate for the pitch/roll dynamics by passing the desired rotation rate signal through G(s) = (1+a*s+b*s*s)/K before passing it on to the ESCs. Interesting thing is, when you combine all the blocks in the feedback loop, you wind up with a controller of the form KI/s+KP+KD*s+KDD*s*s.

I have ignored the nonlinear gyroscopic effects that couple roll/pitch when there is significant yaw rate. As long as the yaw rate is low, roll and pitch are decoupled. However, a high yaw rate will couple roll and pitch, and induce wobbles.

Regarding your measurement of the motor RPM, that is very exciting!! Good for you. I will be very interested to see what you find. I think that the dynamic model of the propeller includes the propeller speed, the tilt rate, and motor torque. So, for example, I would expect the response of the propeller to motor torque will depend on the angle of attack of the propeller. In other words, propeller and quad together form a second order system.

Best regards,
Bill

markw

unread,
Feb 20, 2012, 3:59:38 PM2/20/12
to uavde...@googlegroups.com
Here's my first data with motor rpm: 40Hz sample rate and 250msec step input to ESC with quad tied down.
Step amplitude is 500 counts and resulting RPM step is from 6000 to 8000.
There is a little noise on the RPM sensor input, this version uses outlier rejection and a 4 sample boxcar integrator.
(there are 7 cycles/revolution at the sensor output) 

It looks like increasing output PWM rate to 400Hz reduces latency a little with these ESCs.

--markw


rpmPulse_400Hz_9x5.xls

William Premerlani

unread,
Feb 21, 2012, 8:52:14 AM2/21/12
to uavde...@googlegroups.com
Hi Mark,

I found there to be an overall latency of about 0.5 seconds between a change in PWM and the peak of the rotation rate of the quad, for both my draganflier and my Arducopter, so I am not sure whether increasing PWM rate to 400 Hz would make much of a difference in the overall performance.

A good portion of the 0.5 seconds is due simply to the dynamics of the interaction of the propellers with the inertia of the quad frame.

The thing that I found to make a big difference in the overall performance was the use of KDD, which taken together with KP and KD, multiplies the K/(1+a*s+b*s*s) response of the ESC+propeller+frame by (1+a*s+b*s*s)/K to achieve an overall unity gain without any latency lag.

Best regards,
Bill

Mark Whitehorn

unread,
Feb 21, 2012, 10:37:12 AM2/21/12
to uavde...@googlegroups.com
Bill,

I agree with you on the effectiveness of the KDD term; my quad isn't even flyable with KDD set to zero.

If I understand correctly, the control loop bandwidth will be limited by the effective low-pass filter of the ESC/motor/propeller system, and that if this has a time constant of ~500 msec the implication is that disturbances on the order of .5 second cannot be compensated. I assume that frequency response of the closed loop system is important, and that unity gain holds only within a finite range of frequency.

I'm measuring 200msec to peak RPM with the quad clamped a meter off the ground.  Response exceeded 50% within 60msec of the step input.

I've attached a plot of my last test with the telemetry rate increased to 50Hz.

thanks for all the advice,
--markw
--
Mark Whitehorn
kd0...@gmail.com

rpmPulse_9x5.pdf

DodgeManX

unread,
Feb 23, 2012, 1:14:06 AM2/23/12
to uavdevboard

Bill,
First post for me and I'd like to say I know just enough about what
your doing to be amazed and appreciative.
In my work with VFD AC Motor Drives during the installation of a new
motor we run the controller through an automated test that determines
the varous response characteristics/dynamics of the motor to calibrate
the Drive. Would it be unreasonable to bring the flying craft to a
safe hover with some type of default PID settings then have the
controler make micro bursts of throttle inputs to the various motors
allowing the sensors on board to measure the torque and various
rational offsets needed? This could make it easy for us to be able
make adjustments for changing the dynamics of our crafts (changing
battery size or type, adding or removing equipment/cameras or such,
unballanced payloads) with out the painful experimentation of
readjusting PID's. Is this something you see being able to
incorporate in the future?

Regards,
Ed

William Premerlani

unread,
Feb 23, 2012, 9:39:22 AM2/23/12
to uavde...@googlegroups.com
Hi Ed,

Welcome aboard. Thanks for joining our group.

I have taken the first steps in the direction of what you are suggesting. I am able to measure the LaPlace transform of the tilt dynamics from the available data, without having to disturb the controls in any way. Attached is the result for my draganflier.

Best regards,
Bill
draganFlierTiltImpulseFunction.pdf

markw

unread,
Apr 5, 2012, 8:39:51 AM4/5/12
to uavde...@googlegroups.com
Hi All,

Here's a short video of my quad flying in the back yard. UDB4 in AeroQuadFPV frame, 1700 grams

The air was calm for this flight, but I did input some rather large roll/pitch and throttle commands to test stability and look for overshoot. I thought it was quite informative to watch the video in slow motion at 720p, and would be interested in any observations you might have on stability and performance.

I'm running 100Hz telemetry to an OpenLog, and analysis shows the response latency from roll/pitch command to commanded tilt angle is 120msec for this flight. The following plot is a cross-correlation of roll and pitch motor control commands with roll and pitch angles, with the x axis in units of 10msec samples.

regards,
--markw

Phillip Kocmoud

unread,
Apr 6, 2012, 12:28:21 PM4/6/12
to uavde...@googlegroups.com
Mark,

Can you send me your options.h file. I was not able to get my AeroQuad copter to be stable enough for flight.

Thank you,

Phil

Mark Whitehorn

unread,
Apr 6, 2012, 3:40:17 PM4/6/12
to uavde...@googlegroups.com
Hi Phil,

Sorry you're having stability problems, I know how frustrating that is.

I've been "playing" quite a lot with the MatrixPilotQuad code, and have modified the controller logic in such a way that my options.h file is no longer compatible with anything currently in the SVN repository. I'd be pleased to share my modifications, but it's entirely up to you whether you want to go off on the same tangent I'm taking.

Besides just having fun (and demonstrating far less embedded systems competence than I thought I had), my intention has been to see whether I can reduce response latency and whether that would translate to increased stability. I seem to be having some success at that now and would be pleased to share it with you.

I don't have much experience with creating patches and such, but if you like I could zip my whole project up and send it to you. One other caveat, the version of code in the video will only run on a UDB4, because it sets the clock rate to 40MHz; are you using an earlier UDB?

cheers,
--Mark
--
Mark Whitehorn
kd0...@gmail.com

Phillip Kocmoud

unread,
Apr 6, 2012, 6:00:34 PM4/6/12
to uavde...@googlegroups.com
Mark,

That would be great if you could send me your project. I will let you know how I make out with it. I have several UDB4s and just purchased 2 DJI Flame Wheel 450 that I could test on as well. They have much less mass than the AeroQuad, so I expect your changes might make an even greater improvement to the lighter craft.

Thanks,

Phil

Robert Dickenson

unread,
Apr 6, 2012, 7:54:17 PM4/6/12
to uavde...@googlegroups.com, Mark Whitehorn
Hi Mark,

I too would be interested to take a look at the changes you have made, so if you wouldn't mind sending me a copy of the zip, that would be much appreciated. I am not so much interested in the quad support, but what you have done with 40MHz support on the UDB4.

Thanks and regards, Robert.
Message has been deleted
Message has been deleted

Mark Whitehorn

unread,
May 12, 2012, 2:59:38 PM5/12/12
to uavde...@googlegroups.com
Hi Alex and Igal,

Sorry for the slow reply, Alex. There's a new MatrixPilotQuad branch http://code.google.com/p/gentlenav/source/browse/#svn%2Fbranches%2FMatrixPillotQuad_MarkWhitehorn which contains the 400Hz version. 

I recommend that you use a failsafe mux and be very sure that the input and output channel mappings are correct before you attempt to fly this version. Also, the options.h file currently in the repository is configured for my quad and you should start by renaming options_base.h to options.h, then modify that to match your own quad.

best of luck,
--Mark

On Wed, May 2, 2012 at 3:35 PM, ALEX <igo...@gmail.com> wrote:
HI MARK,

i am  using  UDB4  ,  I was not able to get my Quad

to be stable enough for flight.
i  get  a strange  behevier,  for  example  one  of the motor  stop
run  and  the  second  run  at full  rpm.
what may  be the problem ?
would you  like  to  send  me your  code ?

thanks.
alex.


On Apr 5, 3:39 pm, markw <kd0...@gmail.com> wrote:
> Hi All,
>
> Here's a short video of my quad flying in the back yard. UDB4 in
> AeroQuadFPV frame, 1700 grams <https://www.youtube.com/watch?v=ZrZJW8lG_2U>

>
> The air was calm for this flight, but I did input some rather large
> roll/pitch and throttle commands to test stability and look for overshoot.
> I thought it was quite informative to watch the video in slow motion at
> 720p, and would be interested in any observations you might have on
> stability and performance.
>
> I'm running 100Hz telemetry to an OpenLog, and analysis shows the response
> latency from roll/pitch command to commanded tilt angle is 120msec for this
> flight. The following plot is a cross-correlation of roll and pitch motor
> control commands with roll and pitch angles, with the x axis in units of
> 10msec samples.
Message has been deleted

Mark Whitehorn

unread,
May 12, 2012, 4:16:23 PM5/12/12
to uavde...@googlegroups.com
Igal,

Did you modify options_base.h to the correct input and output channel mappings for your radio and quad, then rename it to options.h?

regards,
--Mark

On Sat, May 12, 2012 at 1:27 PM, igor isakov <igo...@gmail.com> wrote:
Hi MARK,

thanks for your  replay,  i  download  the version  with  400 hz,  and i  have  problem:
after  calibration  all  motors  start to  run  without any  command  from me.
i use  udb4 plate.

thank you.
IGAL.

2012/5/12 Mark Whitehorn <kd0...@gmail.com>


--

Igor  Isakov

Mechanical Engineer


 








--
Mark Whitehorn
kd0...@gmail.com

Message has been deleted

Mark Whitehorn

unread,
May 12, 2012, 5:17:58 PM5/12/12
to uavde...@googlegroups.com
Hi Igal,

I'm glad it's working for you, even more so that it seems impressive. 

You don't need GPS or magnetometer, and there isn't yet any GPS functionality, though I hope to soon start on a position hold mode. A magnetometer will eventually eliminate yaw drift, but that's not fully debugged yet.

regards,
--Mark

On Sat, May 12, 2012 at 2:46 PM, igor isakov <igo...@gmail.com> wrote:
it was the problem :) .  wow ..i seems  to  be very  impressive.
i suppose  that i can  run  it  only  with gyro  and  acc ?

igal.


2012/5/12 Mark Whitehorn <kd0...@gmail.com>



--
Mark Whitehorn
kd0...@gmail.com

Message has been deleted

Mark Whitehorn

unread,
May 15, 2012, 2:05:00 PM5/15/12
to uavde...@googlegroups.com
Hi Igal,

Sorry about that; I didn't realize that the version of main.c in SVN had a very non-standard baud rate. Comment out line 75 of main.c and uncomment either line 71 or 72 to use 57.6K or 115.2K baud. The version of OpenLog I'm referring to in those comments is my own hacked version. 

HyperTerminal and a standard OpenLOg should work fine at 115.2K baud.

regards,
--Mark

On Tue, May 15, 2012 at 11:24 AM, Igal <igo...@gmail.com> wrote:
Hi Mark,

i am using  RS232  protocol with  hyper  terminal  program.
i  didnt success  to  get  tx  with  your  400  hz  version.
what is the right  baude rate?

thanks,
igal.



On May 13, 12:17 am, Mark Whitehorn <kd0...@gmail.com> wrote:
> Hi Igal,
>
> I'm glad it's working for you, even more so that it seems impressive.
>
> You don't need GPS or magnetometer, and there isn't yet any GPS
> functionality, though I hope to soon start on a position hold mode. A
> magnetometer will eventually eliminate yaw drift, but that's not fully
> debugged yet.
>
> regards,
> --Mark
>
>
>
>
>
>
>
>
>
> On Sat, May 12, 2012 at 2:46 PM, igor isakov <igor...@gmail.com> wrote:
> > it was the problem :) .  wow ..i seems  to  be very  impressive.
> > i suppose  that i can  run  it  only  with gyro  and  acc ?
>
> > igal.
>
> > 2012/5/12 Mark Whitehorn <kd0...@gmail.com>
>
> >> Igal,
>
> >> Did you modify options_base.h to the correct input and output channel
> >> mappings for your radio and quad, then rename it to options.h?
>
> >> regards,
> >> --Mark
>
> >> On Sat, May 12, 2012 at 1:27 PM, igor isakov <igor...@gmail.com> wrote:
>
> >>> Hi MARK,
>
> >>> thanks for your  replay,  i  download  the version  with  400 hz,  and i
> >>>  have  problem:
> >>> after  calibration  all  motors  start to  run  without any  command
> >>>  from me.
> >>> i use  udb4 plate.
>
> >>> thank you.
> >>> IGAL.
>
> >>> 2012/5/12 Mark Whitehorn <kd0...@gmail.com>
>
> >>>> Hi Alex and Igal,
>
> >>>> Sorry for the slow reply, Alex. There's a new MatrixPilotQuad branch

> >>>> contains the 400Hz version.
>
> >>>> I recommend that you use a failsafe mux and be very sure that the input
> >>>> and output channel mappings are correct before you attempt to fly this
> >>>> version. Also, the options.h file currently in the repository is configured
> >>>> for my quad and you should start by renaming options_base.h to options.h,
> >>>> then modify that to match your own quad.
>
> >>>> best of luck,
> >>>> --Mark
>
> >>> Mobile:+972-52-3970141begin_of_the_skype_highlighting            +972-52-3970141
> >>> EMail: igor...@gmail.com

>
> >> --
> >> Mark Whitehorn
> >> kd0...@gmail.com
>
> > --
>
> > Igor  Isakov
>
> > Mechanical Engineer
> > Mobile:+972-52-3970141begin_of_the_skype_highlighting            +972-52-3970141
> > EMail: igor...@gmail.com
>
> --
> Mark Whitehorn
> kd0...@gmail.com



--
Mark Whitehorn
kd0...@gmail.com

Message has been deleted
Message has been deleted

Mark Whitehorn

unread,
May 15, 2012, 3:14:26 PM5/15/12
to uavde...@googlegroups.com
Igal,

I set my gains by flying around and increasing them until oscillations begin to appear. So far, I haven't seen oscillations with the PID loop at 400Hz, and since I was pleased with the way it was flying with the settings in options_base.h moved on to other issues. Also, I think gain values must be strictly less than 4.0 (actually <=4-2^-14) to be valid.

Is your quad flying now, or are you still testing on the stand?

regards,
--Mark

On Tue, May 15, 2012 at 12:21 PM, igor isakov <igo...@gmail.com> wrote:
ok. i will  try.

i checked your  gain..  and i get better performance with  KDD=4.0
how did you found the gains? by experiences ? 

igal.

2012/5/15 Mark Whitehorn <kd0...@gmail.com>



--
Mark Whitehorn
kd0...@gmail.com

Mark Whitehorn

unread,
May 15, 2012, 3:19:51 PM5/15/12
to uavde...@googlegroups.com
Igal,

Thanks for that video; it's the first I've seen of this version running on another quad.

 Your test stand is much, much better than mine and it looks like the PID loop is performing well in your configuration. I haven't used my stand for a while though; it seemed that in-flight stability was a lot harder to achieve than single-axis control. I'm hoping that yours will be stable in flight now too.

regards,
--Mark

On Tue, May 15, 2012 at 1:05 PM, Igal <igo...@gmail.com> wrote:
HI Mark,

i  attached  a link  with  video that shows  the performance with
the  400  hz  version.
i changed  the  KDD  gain  from  1.86  to  2.35.

http://www.youtube.com/watch?v=RzV49FQRtEQ&feature=youtu.be

igal.



--
Mark Whitehorn
kd0...@gmail.com

Message has been deleted

Mark Whitehorn

unread,
May 15, 2012, 5:00:21 PM5/15/12
to uavde...@googlegroups.com
Igal,

Other than changing CPU clock frequency and control loop frequency, the only change from Bill Premerlani's MatrixPilotQuad branch is in the details of the control loop. 

While Bill is using a controller design based on his measured system dynamics: http://diydrones.com/profiles/blog/show?id=705844%3ABlogPost%3A799485&commentId=705844%3AComment%3A801459 

I have reverted to an ArduPilot style PID loop: http://code.google.com/p/arducopter/wiki/AC2_Tweaks

The code in main.c for adjusting PID gains uses two receiver channel to allowing changing one of three gain values without reprogramming. The gain values are stored in the UDB4's EEPROM. If you'd like to enable this, you will need to connect two additional channels from RX to UDB4. I use a three-position switch to select between TILT_KP, KD and KDD and a knob to adjust the gain up and down. I've attached a picture of how my RX is connected to the UDB4.

regards,
--Mark


On Tue, May 15, 2012 at 1:48 PM, Igal <igo...@gmail.com> wrote:
Mark,
wher may  i  find  a theoretical material of what you did at your
code ?
why your code contain part of gain changing ?
 thanks,
igal


On May 15, 10:05 pm, Igal <igor...@gmail.com> wrote:
> HI Mark,
>
> i  attached  a link  with  video that shows  the performance with
> the  400  hz  version.
> i changed  the  KDD  gain  from  1.86  to  2.35.
>
> http://www.youtube.com/watch?v=RzV49FQRtEQ&feature=youtu.be
>
> igal.



--
Mark Whitehorn
kd0...@gmail.com

AeroFPVsystem.pdf
Message has been deleted

Mark Whitehorn

unread,
May 15, 2012, 5:27:29 PM5/15/12
to uavde...@googlegroups.com
Igal,

I just noticed that the system diagram I attached above appears to say the SJ1 on the UDB4 is installed. That is not the case: SJ1 is open and VCC is separate from SVCC.

I'm looking forward to seeing video of your quad flying around.

good luck,
--Mark

On Tue, May 15, 2012 at 3:14 PM, igor isakov <igo...@gmail.com> wrote:
thank you very much, its look very interesting...  
now  i know  what  to  do  with  other  knob  on my  remote control  :))) .
because  until  now  i  used  only  the  joystics.
 igal.


2012/5/16 Mark Whitehorn <kd0...@gmail.com>



--
Mark Whitehorn
kd0...@gmail.com

Message has been deleted

Mark Whitehorn

unread,
May 18, 2012, 9:11:32 AM5/18/12
to uavde...@googlegroups.com
Hi Igal,

The UDB4 will be happy with 5V on VCC whether it comes from your ESC or a separate regulator. If you remove SJ1 (see page 4 of the attached schematic), the servo power bus (SVCC) is separated from the UDB and receiver power (VCC). If you do this, you need an extra source of power for the servos connected to the SVCC pins on the output end of the UDB4 (next to Output1). This voltage source can be just a 4 or 5 cell NiCd battery, a 2 cell LiPo if all your servos can tolerate 8.4V or a second BEC. The advantage of separating SVCC from VCC is that you reduce the current demand on the UDB4/Receiver regulator and make it less likely that a low-voltage condition (perhaps caused by a stalled servo) would cause the UDB or the RC receiver to reboot in flight.

Since a quad usually has 4 ESCs, it makes sense to use one of them for VCC and a second one for servo power. Of course many quads have no servos at all, and there's no advantage to doing this. 

regards,
--Mark

On Fri, May 18, 2012 at 6:34 AM, Igal <igo...@gmail.com> wrote:
Hi ,

what  is the  different  i if  the  udb4 get the power  (+5 v)   from
ESC or  from  external  voltage  regulator  that supply +5  volt ?

Igal.


On May 16, 12:27 am, Mark Whitehorn <kd0...@gmail.com> wrote:
> Igal,
>
> I just noticed that the system diagram I attached above appears to say the
> SJ1 on the UDB4 is installed. That is not the case: SJ1 is open and VCC is
> separate from SVCC.
>
> I'm looking forward to seeing video of your quad flying around.
>
> good luck,
> --Mark
>
>
>
>
>
>
>
>
>
> On Tue, May 15, 2012 at 3:14 PM, igor isakov <igor...@gmail.com> wrote:
> > thank you very much, its look very interesting...
> > now  i know  what  to  do  with  other  knob  on my  remote control  :))) .
> > because  until  now  i  used  only  the  joystics.
> >  igal.
>
> > 2012/5/16 Mark Whitehorn <kd0...@gmail.com>
>
> >> Igal,
>
> >> Other than changing CPU clock frequency and control loop frequency, the
> >> only change from Bill Premerlani's MatrixPilotQuad branch is in the details
> >> of the control loop.
>
> >> While Bill is using a controller design based on his measured system
> >> dynamics:

>
> >> I have reverted to an ArduPilot style PID loop:
> >>http://code.google.com/p/arducopter/wiki/AC2_Tweaks
>
> >> The code in main.c for adjusting PID gains uses two receiver channel to
> >> allowing changing one of three gain values without reprogramming. The gain
> >> values are stored in the UDB4's EEPROM. If you'd like to enable this, you
> >> will need to connect two additional channels from RX to UDB4. I use a
> >> three-position switch to select between TILT_KP, KD and KDD and a knob to
> >> adjust the gain up and down. I've attached a picture of how my RX is
> >> connected to the UDB4.
>
> >> regards,
> >> --Mark
>
> >> On Tue, May 15, 2012 at 1:48 PM, Igal <igor...@gmail.com> wrote:
>
> >>> Mark,
> >>> wher may  i  find  a theoretical material of what you did at your
> >>> code ?
> >>> why your code contain part of gain changing ?
> >>>  thanks,
> >>> igal
>
> >>> On May 15, 10:05 pm, Igal <igor...@gmail.com> wrote:
> >>> > HI Mark,
>
> >>> > i  attached  a link  with  video that shows  the performance with
> >>> > the  400  hz  version.
> >>> > i changed  the  KDD  gain  from  1.86  to  2.35.
>
> >>> >http://www.youtube.com/watch?v=RzV49FQRtEQ&feature=youtu.be
>
> >>> > igal.
>
> >> --
> >> Mark Whitehorn
> >> kd0...@gmail.com
>
> --
> Mark Whitehorn
> kd0...@gmail.com



--
Mark Whitehorn
kd0...@gmail.com

UDB4-v14.pdf
Message has been deleted

Paul Beech

unread,
May 18, 2012, 9:50:30 PM5/18/12
to uavde...@googlegroups.com
I'm just about at the stage where the Quad I'm building with friends is going through programming and testing, I'm glad the MPQuad is coming on so well about now :-)

I'm also having problems getting the serial port to talk to me, no matter what I do with quad_testing or MatrixPilotQuad_MW they just won't output anything useful.

The most I get is a '|' (quad_testing) or '~' (MPMW) on reboot (consistently) and then nothing. Although this is an improvement on there being only a blinking red light before.

The other signs of life are:
quad_testing: solid red and green lights and blinking GPS EM-406.
MPMW: solid red, green, orange light and intermittent blink on blue. Blinking GPS EM-406.

I've tried a couple of packages to monitor the serial and they show the same behaviour. Next I'm trying something else on the serial to make sure that's not the point of failure.

Otherwise, what options.h or code magic am I missing to get telemetry/serial debug playing nicely?

- Paul


On Friday, 18 May 2012 16:21:24 UTC+1, Igal wrote:
Thanks  Mark.

i  have the  same problem  with  RS232 protocl...  i  can get  on   the connection..  i set  the  baude rate to  115200 and  nothing  appear at my screen.
i  use a simple  connected wired  RS232 board.
with  other  versions   (40 hz )   its  work.
may  be  it because  of  the  400  hz   ?

regards,
igal. 

Paul Beech

unread,
May 18, 2012, 9:55:37 PM5/18/12
to uavde...@googlegroups.com

Scratch that. I think I was just compiling things incorrectly earlier and that confused me.

I swapped the TX and RX pins around and it spits out a pleasing amount of numbers with commas :)

I'm using an Arduino without the chip in as Serial<-->USB and have the TX2-->TX and RX2-->RX and that seems to make it happy.

And on a Mac no less.

- Paul.

Mark Whitehorn

unread,
May 18, 2012, 10:19:35 PM5/18/12
to uavde...@googlegroups.com
Hi Paul,

Welcome to quads. What kind of frame and motors are you using?

--Mark
--
Mark Whitehorn
kd0...@gmail.com

Paul Beech

unread,
May 18, 2012, 10:42:11 PM5/18/12
to uavde...@googlegroups.com
Hiya and thanks :)

This is a super budget quad running on generic 2212/15T 930kV motors and 25A ESCs. We're using the laminated cardboard frame from http://www.mikeestee.com/blog/2012/03/cardboard-quadcopter/ for version 1 and a 2200mAh 11.1v battery with the UDB4 at the heart.

So around 18" arm length and $300 budget so far.

- Paul.


On Saturday, May 19, 2012 3:19:35 AM UTC+1, markw wrote:
> Hi Paul,
>
> </div>
> Welcome to quads. What kind of frame and motors are you using?</div>
>
> </div>
> --Mark
>
>
> On Fri, May 18, 2012 at 7:55 PM, Paul Beech <span dir="ltr">&lt;<a href="mailto:i...@guru.gg" target="_blank">i...@guru.gg</a>&gt;</span> wrote:
>
>
> <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
>
> </div>
> Scratch that. I think I was just compiling things incorrectly earlier and that confused me.
> </div>
>
>
>
> </div>
> I swapped the TX and RX pins around and it spits out a pleasing amount of numbers with commas :)</div>
>
> </div>
> I&#39;m using an Arduino without the chip in as Serial&lt;--&gt;USB and have the TX2--&gt;TX and RX2--&gt;RX and that seems to make it happy.</div>
>
>
>
> </div>
> And on a Mac no less.</div><span><font color="#888888">
>
> </div></font></span>
> <span><font color="#888888">- Paul.</font></span>
>
>
> On Friday, 18 May 2012 16:21:24 UTC+1, Igal wrote:</div>
>
>
> <blockquote class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">
> Thanks  Mark.
>
> </div>
> i  have the  same problem  with  RS232 protocl...  i  can get  on   the connection..  i set  the  baude rate to  115200 and  nothing  appear at my screen.</div>
>
>
> i  use a simple  connected wired  RS232 board.</div>
>
> with  other  versions   (40 hz )   its  work.</div>
> may  be  it because  of  the  400  hz   ?</div>
>
> </div>
> regards,</div>
> igal. </div></div>
> </blockquote></div></div></blockquote></div>
>
>
>
> </div>--
> Mark Whitehorn
> <a href="mailto:kd0...@gmail.com" target="_blank">kd0...@gmail.com</a>
>
>
> </div>

Mark Whitehorn

unread,
May 19, 2012, 9:48:31 AM5/19/12
to uavde...@googlegroups.com
Paul,

Thank you for the link. I had never heard of a cardboard quad before, and Mike has a lot of good ideas. Your motors and ESCs are similar to my AeroQuad. Is the 18" measured from motor to motor? Mine measures about 27".

--Mark
--
Mark Whitehorn
kd0...@gmail.com

Paul Beech

unread,
May 19, 2012, 5:42:56 PM5/19/12
to uavde...@googlegroups.com
Yep. 18" motor to motor. it's the minimum size to fit the 10x4.5 props in and I'm sure it will be quite, erm, 'responsive' :-)

The good news is that if it works, we can make another one with more cardboard for a more settled frame at a more civilised girth like yours.

The AUW should be just under 800g with current setup. Conservatively that should leave a good 700g of payload.

EDIT: Just had our first flight testing. quad_testing behaved itself well. Take off achieved around 30% throttle so plenty of headroom. First crash about 5 minutes later. Outdoor testing tomorrow.

Thanks for making such a great community and piece of tech that it was this easy to get started :-)   *so excited*

- Paul

Mark Whitehorn

unread,
May 19, 2012, 6:16:38 PM5/19/12
to uavde...@googlegroups.com
Paul,

Congrat's on a successful maiden flight. I'm curious about how much more agile your quad will be with the shorter arms.  At 1500g mine's also nearly twice as heavy.

--Mark
--
Mark Whitehorn
kd0...@gmail.com

William Premerlani

unread,
May 19, 2012, 7:25:21 PM5/19/12
to uavde...@googlegroups.com
Hi Paul,
Keep in mind that right now there are two separate quad branches. quad_testing is mine, MatrixPilotQuad_MarkWhitehorn is Mark's. I think it would be fair to characterize both branches as "works in progress". Mark is farther along than I am. His version has a much higher frame rate, and I think he is working now on positional stabilization. In other words, "loiter".
Best regards,
Bill Premerlani

Paul Beech

unread,
May 20, 2012, 12:33:05 PM5/20/12
to uavde...@googlegroups.com
Thanks Bill,

I noticed that the features were cut back from full MP, and if we'd started this a couple of months earlier, we'd be in a much worse position for firmware.

We'll gives Mark's branch a go as well once we work out what the heck we are doing and can tell the difference :-)

We've got 2 or 3 coders in the group, they'll be looking into the code and tinkering I imagine.

If they get to the stage where there are fruits from their tinkering, would it be possible to contribute to the SVN branches?

- Paul.

Robby

unread,
May 21, 2012, 5:55:36 AM5/21/12
to uavdevboard
Dear Mark,

It is an interesting thread here. I have purchased a Gaui-330Ex quad
to give your code a try, which I have downloaded from the trunk.
Can I use UDB3 instead of UDB4..........?Please suggest.

Cordially,
Robby.

Mark Whitehorn

unread,
May 21, 2012, 7:54:15 AM5/21/12
to uavde...@googlegroups.com
Hi Robby,

Bill's quad_testing branch will run on the UDB3, but my branch is restricted to the UDB4, using a 40MHz clock rate. As I don't have a UDB3, it's not possible for me to reconfigure and test the code configured for it.

regards,
--Mark
--
Mark Whitehorn
kd0...@gmail.com

Wouter van Verre

unread,
May 21, 2012, 8:51:31 AM5/21/12
to uavde...@googlegroups.com
Hi Robby, 

I am not 100% sure on this, as I haven't tested it, but the UDB3 might not be able to handle the vibrations on a quad as well as the UDB4. It could well be that a quad with an UDB3 is less stable than the same quad with an UDB4. Maybe someone else can shed some more light on this.

Kind regards,
Wouter van verre

Sent from my iPad

clemens

unread,
May 21, 2012, 11:51:55 AM5/21/12
to uavdevboard
Hi Mark, Robby,

I use an UDB4 for my QuadCopter and it's working well.
Besides the UDB3 is a fine board for the quadcopter too. The the
problens due to the vibration was the red Board.
I use the UDB4 board only because I need some more inputs (pwm, ect)
to test it with other sensors.

kind regards, Clemens

On 21 Mai, 14:51, Wouter van Verre <wouter_van_ve...@hotmail.com>
wrote:
> Hi Robby,
>
> I am not 100% sure on this, as I haven't tested it, but the UDB3 might not be able to handle the vibrations on a quad as well as the UDB4. It could well be that a quad with an UDB3 is less stable than the same quad with an UDB4. Maybe someone else can shed some more light on this.
>
> Kind regards,
> Wouter van verre
>
> Sent from my iPad
>
> On 21 mei 2012, at 13:54, Mark Whitehorn <kd0...@gmail.com> wrote:
>
>
>
> > Hi Robby,
>
> > Bill's quad_testing branch will run on the UDB3, but my branch is restricted to the UDB4, using a 40MHz clock rate. As I don't have a UDB3, it's not possible for me to reconfigure and test the code configured for it.
>
> > regards,
> > --Mark
>
Message has been deleted

markw

unread,
May 27, 2012, 3:59:04 PM5/27/12
to uavde...@googlegroups.com
That looks pretty good, Igal. Good luck with the outdoors test.

Here's a spin stability test for the 400Hz code:

markw

unread,
May 27, 2012, 5:29:12 PM5/27/12
to uavde...@googlegroups.com
Hello everyone,

Here's another video of my quad not crashing while spinning at around 50rpm:

regards,
--markw

Riccardo Kuebler

unread,
May 27, 2012, 5:57:43 PM5/27/12
to uavde...@googlegroups.com
Mhmm, the dog seemed a little worried ;D

Maybe the time to bring the quad out of dust again ?

Mark, how is it managing wind gusts ?

Best regards,

Ric

2012/5/27 markw <kd0...@gmail.com>

Mark Whitehorn

unread,
May 27, 2012, 6:45:49 PM5/27/12
to uavde...@googlegroups.com
Hi Ric,

Wind isn't a big problem, but I've had it yaw about 90 degrees on me in turbulence near the corner of a building.  I may be able to increase the yaw gains at this point though.

At my club's flying field, there is often a turbulent layer somewhere between 30 and 100 feet AGL due to local topography, and I've seen my quad wobble in there in a way that made me nervous, but so far no loss of stability. 

Here's to breaking 4 props at a time,
--markw
--
Mark Whitehorn
kd0...@gmail.com

Universal Engineers

unread,
May 28, 2012, 4:49:36 AM5/28/12
to uavde...@googlegroups.com
Dear Mark,

My UDB4 arrived today and it has been loaded with your version of code from the repository. I have installed
it on my GAUI-330 X quad. I have followed all your instructions available on this tread but I want to know whether I have to make any RC settings/channel mixing extra before flying since I'm a newbie to quad flying.

Cordially,
Robby.

Mark Whitehorn

unread,
May 28, 2012, 8:28:06 AM5/28/12
to uavde...@googlegroups.com
Hi Robby,

My transmitter is set for an airplane with throttle, elevator, aileron and rudder controls. I use 30% exponential on aileron and elevator and no mixing at all. Aileron controls tilt left/right, elevator controls tilt front/rear and rudder controls yaw. First copy options_base.h to options.h and make sure all of the #defines in options.h are correct for your quad. There should be enough comments in there to help you make the correct choices.

Take the props off before you power up and make sure the correct motor responds when you move the aileron and elevator controls. Left aileron should run the right motor, up elevator should run the front motor.

Once the motors are responding correctly, try tilting the quad with a little throttle applied (enough to make all the motors spin) and check whether the correct motor speeds up to counter the tilt.

If everything looks OK at this point, it's time to put the props on and try hovering. 

good luck and thanks for being a test pilot,
--markw
--
Mark Whitehorn
kd0...@gmail.com

igor isakov

unread,
May 28, 2012, 4:15:44 PM5/28/12
to uavde...@googlegroups.com
Hii  Mark,

the  video  look's  pretty  well )  good  work !!
i  will  try  to  test  spininig  to  )  
did  you  try  to rotate  the  quad   around  pitch/roll  axis  in  360  degree at  fly  time ?

Regards,
Igal.

 

2012/5/28 Mark Whitehorn <kd0...@gmail.com>

Mark Whitehorn

unread,
May 28, 2012, 4:30:57 PM5/28/12
to uavde...@googlegroups.com
Thanks Igal,

Flying around while spinning is much more exciting than just hovering.

It will be a long time before I have the nerve to try flips. I did make a coding error which caused it to flip upside down so fast that I think it probably can do flips in roll and pitch.

I'll probably put a second UDB4 on a lighter and cheaper frame to try it one day.

regards,
--markw
Message has been deleted

gefkuz

unread,
May 30, 2012, 2:26:33 PM5/30/12
to uavdevboard
Hi all,

I would like to use your code, but I have some compilation error with
snprintf....
Anyone have some idea?

thanks

markw

unread,
May 30, 2012, 9:19:25 PM5/30/12
to uavde...@googlegroups.com
Are you using MPLAB-X or MPLABv8?

It sounds like you might need to modify your project to specify -D ADDED_C_LIB to the compiler.
In MPLAB-X, this is specified in the "additional options" field for the pic30-gcc compiler.

regards,
--Mark

gefkuz

unread,
May 31, 2012, 2:19:05 PM5/31/12
to uavdevboard
Sorry, it was a mistake from me.
No error on snprintf.

eng.kwili

unread,
Oct 30, 2012, 12:00:46 PM10/30/12
to uavde...@googlegroups.com
Hello,
Thank you for the code I download it but how can I use it or is it flyable ?
 
thank you
 

بتاريخ الثلاثاء، 14 فبراير، 2012 UTC+3 12:46:07 ص، كتب gefkuz:
As you suggest, you can find the patch file.
 
The biggest modifications are on the telemetry.c . Because my quad is controled with my PC.
As my pc is the controller, I had a function "PID Tune" on my windows application. For that I have to modify the define for the differents Til_Kx. I transform the defines in variables. Like this, I can modify the Tilt by telemetry.
 
I join to the post my windows application who is totaly managed code with a little directx implementation for Joystick input.
 
In future, I'de like to implent the telemetry of matrixpilot, for others gcs.
 
For the moment, my quad is on the ground with propelers a little broken. I test my code and don't find best pid.

markw

unread,
Oct 30, 2012, 12:26:19 PM10/30/12
to uavde...@googlegroups.com
Can you be more specific?

eng.kwili

unread,
Oct 30, 2012, 12:44:48 PM10/30/12
to uavde...@googlegroups.com
Sorry for being not clear  I was asking about the modified code that is through computer control which is done by
gefkuz
Reply all
Reply to author
Forward
0 new messages