PID tunning

This forum is dedicated to all issues and questions related to your individual setups and configurations
Post Reply
Jlperan
Posts: 17
Joined: Mon May 21, 2012 11:02 pm

PID tunning

Post by Jlperan »

First of all, I must contratulate the team and coloaborators for the excellent piece of software Multiwii is. I'm trying with PID tunning but I can't make IT flyng. As soon as I give power to the throttle the quadcopter IT starts shaking.

You can see it in this video.

http://www.youtube.com/watch?v=vMif7Kcv5is

I've read a lot and watched a lot of video but I can't get it stable. I've modified one and all parameters.

Could you please help?

Thanks.

bill516
Posts: 334
Joined: Sun Aug 07, 2011 12:27 pm

Re: PID tunning

Post by bill516 »

Go back to default sketch and load the variables for your machine, mag gyro acc sensors etc. Ensure CofG is in the middle of your copter, move battery to get it there.

Set motors running at approx 50% if you have props on be very careful, check GUI trace for an almost flat line from gyro and acc, if trace is dancing all over the place you have vibration and it needs to be sorted before proceeding.

In gyro only mode, that is all other sensors switched off, using the GUI and set the Tx trims to give approx equal values at 50% rpm for all motors, if with props on be very careful. Test fly use and Tx trim to get hands off hover. You should not need to touch Tx trim again unless you make changes to your copter.

Once you have it hovering in gyro mode then re-connect to GUI, enable acc and calibrate, any other sensors off at this time, use stick trim function to get motor rpms approx equal if props on be very careful. Test fly and use stick trim function to get stable hover. Once you have it trimmed do not calibrate acc again as you will loose the stick trim settings, if you do calibrate you will have to re-do the stick trim sequence. If you make a note of how many stick movements and direction it requires it should be a straight forward thing to re-do.

You should now have a stable machine that hovers in gyro and acc modes. Now you can set up any other sensors you have and see about setting the PIDs. there is a link to PID tunning and theory on the FAQ page use that as your guide to setting PID's, thats' what I'm doing.

Jlperan
Posts: 17
Joined: Mon May 21, 2012 11:02 pm

Re: PID tunning

Post by Jlperan »

Thanks you very much. I'll try as soon as my baby let me sleep m

bill516
Posts: 334
Joined: Sun Aug 07, 2011 12:27 pm

Re: PID tunning

Post by bill516 »

That will be next year then.

Pyrofer
Posts: 180
Joined: Sat Apr 14, 2012 2:55 pm

Re: PID tunning

Post by Pyrofer »

next year? You don't have children do you...

Try 2020.

bill516
Posts: 334
Joined: Sun Aug 07, 2011 12:27 pm

Re: PID tunning

Post by bill516 »

I do have children, but the youngest had just turned 18, not that stops her going daaaaad.

Jlperan
Posts: 17
Joined: Mon May 21, 2012 11:02 pm

Re: PID tunning

Post by Jlperan »

I got enough time to build the quadcopter in spare time. I think in the weekend I'll wake up early and do the tests.

Jlperan
Posts: 17
Joined: Mon May 21, 2012 11:02 pm

Re: PID tunning

Post by Jlperan »

ok, I finally got some time for this.

I´ve re-ballanced the props again and isolated the motors with a soft piece of some kind of sponge or plastic protector. The vibrations dissapeared.

I moved the battery to assure the cofg is in the middle of the quadcopter.

I´ve started with the checking of the flat line in the gyro and acc but noticed that motors are crazy as I increase the throttle. Propellers are on but the quad barely moves.

Look at it on this video.

http://www.youtube.com/watch?v=Fi2L4ndFTEU

I´ve been working with PID tunning so don´t put an eye on that, the effect is the same with other values.

You may see the motors going crazy as I increase the throttle. I don´t even get to half throttle but I think there´s something wrong. Look at the gyro and acc values, quite stable for me.

My configuration as follows:
- Arduino Mega R3
- 6dof Drotek IMU
- 4 SS Hobbyking´s ESC
- 4 10x6 props.
- 4 Hextronix DT750 motors

Thanks in advance.

bill516
Posts: 334
Joined: Sun Aug 07, 2011 12:27 pm

Re: PID tunning

Post by bill516 »

Looking at your vid you have a cycle time of approx 3000 I'm sure you should be seeing a cycle time of 6000. Make sure you have the correct sensor selected in the sketch, and the correct speed. Dont know if your i2c errors are from a previous test but there should be none

I've gotta be honest here I dont have one of these boards so I cant be more specific of what could be the cause, as you say you seem to have vibration under control just the rpms are up and down, you did calibrate all the esc's didnt you, although I'm not sure thats the problem. Easiest way is one at a time to the Rx to set throttle min and max values in them. Usual way is power on Rx then throttle to max, power on Tx, wait for beeps (you need a motor connected to esc to hear beeps, no props) then move throttle to min and wait for beeps. Power off and thats esc calibrated.


I hope someone else will jump in here with a proper answer for you as I dont have one.

Jlperan
Posts: 17
Joined: Mon May 21, 2012 11:02 pm

Re: PID tunning

Post by Jlperan »

Speed:
#define I2C_SPEED 100000L //100kHz normal mode, this value must be used for a genuine WMP
//#define I2C_SPEED 400000L //400kHz fast mode, it works only with some WMP clones

Sensor:
//#define DROTEK_10DOF_MS // Drotek 10DOF with ITG3200, BMA180, HMC5883, MS5611, LLC
#define DROTEK_6DOFv2 // Drotek 6DOF v2
//#define DROTEK_6DOF_MPU // Drotek 6DOF with MPU6050

ESC are super simple so no calibration is possible. Look at the manual: http://www.hobbyking.com/hobbyking/stor ... 2091X7.doc

And errors are from this test.

User avatar
kos
Posts: 286
Joined: Thu Feb 16, 2012 4:51 am
Location: Fr

Re: PID tunning

Post by kos »

bill516 wrote:Looking at your vid you have a cycle time of approx 3000 I'm sure you should be seeing a cycle time of 6000.


that is for wmp + nunchuk .. ~3000 is normal for itg32xx+bma180


you have some aggressive pid .. please divide your P value with 2 , and start again

Roll Pitch P -> 3
level P -> 7

Jlperan
Posts: 17
Joined: Mon May 21, 2012 11:02 pm

Re: PID tunning

Post by Jlperan »

you have some aggressive pid .. please divide your P value with 2 , and start again

Roll Pitch P -> 3
level P -> 7


Tried. Motors did the same with that values. :(

I even divided values until 0.4 and got the same results.

Jlperan
Posts: 17
Joined: Mon May 21, 2012 11:02 pm

Re: PID tunning

Post by Jlperan »

I'm thinking. May it be caused by the low quality ESCs?

bill516
Posts: 334
Joined: Sun Aug 07, 2011 12:27 pm

Re: PID tunning

Post by bill516 »

You've got the i2c rate at 100 it should be 400 according to the specs. That might explain the i2c errors.

Jlperan
Posts: 17
Joined: Mon May 21, 2012 11:02 pm

Re: PID tunning

Post by Jlperan »

Changed to 400. Still getting the i2c errors :(

bill516
Posts: 334
Joined: Sun Aug 07, 2011 12:27 pm

Re: PID tunning

Post by bill516 »

Bum I was hoping that would be the problem, Did you reset the pids to the default values, it just sounds to me as though the gyro is trying to stabilise the motors but the settings are too high as Kos said. If you read about the pid tuning from the links given inn the FAQ tab it tells you to drop I and D to zero, I would do that then see what the rpms do in the GUI. Re-check the connections for the i2c lines make sure you havn't got a dry or loose joint. Does the model respond in the GUI when you tilt it

Jlperan
Posts: 17
Joined: Mon May 21, 2012 11:02 pm

Re: PID tunning

Post by Jlperan »

Thank you. I'll try to change values to defaults and give it a try ASAP.

PD: GUI always got good values about sensors.

I've already tried to test it with ESCs disconnected and motor response was fine on the gui. I'm still thinking about the low quality of the ESCs. Could it cause the erratic motor behaviour?

Thanks!

bill516
Posts: 334
Joined: Sun Aug 07, 2011 12:27 pm

Re: PID tunning

Post by bill516 »

Its as possibility if the refresh rate is the esc's is not quick enough for the mega then they might be missing a signal or two.

Jlperan
Posts: 17
Joined: Mon May 21, 2012 11:02 pm

Re: PID tunning

Post by Jlperan »

Acording to Multiwii faq:

Be sure your ESC can support PPM with 490Hz refresh rate
For the MultiWii we need a fast update rate & ESC’s which can handle that.
There are a number of standard ESCs than can handle update rates of about 490 Hz, namely Turnigy Plush, Mystery Blue, HK SS and a few others.
The 490Hz basically means that the ESC gets 490 times per second an update.
A standard servo for example works at 50hz or is updated 50 times per second.


My ESCs are HK SS.

So, in theory that should not be the problem.

I will try again with default values but the first test was with that and was not satisfactory.

:(

Jlperan
Posts: 17
Joined: Mon May 21, 2012 11:02 pm

Re: PID tunning

Post by Jlperan »

Interesting link: http://www.oddcopter.com/2012/02/21/qua ... ntrollers/

Quite sure it is caused by HK SS ESCs. Will buy turnigy ESCs and give it a try.

Looks like HK SS 18A ESCs may not be flasheable. https://docs.google.com/spreadsheet/lv? ... zdBQkZZRlE

bill516
Posts: 334
Joined: Sun Aug 07, 2011 12:27 pm

Re: PID tunning

Post by bill516 »

I used http://www.hobbyking.com/hobbyking/stor ... oduct=6548 and these are flash-able, they work without flashing but they work better after. Make sure they are the card programmable ones. Just looked on HK and they are back order.

Jlperan
Posts: 17
Joined: Mon May 21, 2012 11:02 pm

Re: PID tunning

Post by Jlperan »

Mine are http://www.hobbyking.com/hobbyking/stor ... oduct=6456

Not card programmable. Bad choice.

User avatar
kos
Posts: 286
Joined: Thu Feb 16, 2012 4:51 am
Location: Fr

Re: PID tunning

Post by kos »

hum ..

the ESC is sensing the motor rotation and is adjsuting the pulse accordingly
the MWI is not sensing the esc

What you see in the gui is the command sended to the esc . this is not the actual motor speed nor the ESC output.

Jlperan
Posts: 17
Joined: Mon May 21, 2012 11:02 pm

Re: PID tunning

Post by Jlperan »

Yeah, I also thought that but when I unplug the ESCs motors values in the GUI looks fine, even if I move the quad.

What I think is happening is the following:
- MWI sends a command to the ESC.
- The ESC does send a signal to the motor not corresponing to what has been received, i.e. a higher signal.
- The motor moves faster than expected and it lifts the quad a bit, causing a vibration detected by the MWI.
- MWI detects it and tries to compensate.

This effect increases on each cicle and in a few seconds motor are crazy.

Right?

User avatar
kos
Posts: 286
Joined: Thu Feb 16, 2012 4:51 am
Location: Fr

Re: PID tunning

Post by kos »

your are using some 10x6 props .. do they realy fit ?

Jlperan
Posts: 17
Joined: Mon May 21, 2012 11:02 pm

Re: PID tunning

Post by Jlperan »

Ummmm, fits on the motors. What do you mean?

User avatar
kos
Posts: 286
Joined: Thu Feb 16, 2012 4:51 am
Location: Fr

Re: PID tunning

Post by kos »

that "The motor moves faster" is in fact "the props create to much trust" ... worth trying with 10x4 or 11x4 or so .

Jlperan
Posts: 17
Joined: Mon May 21, 2012 11:02 pm

Re: PID tunning

Post by Jlperan »

You may be right.

I´ve read in this page this motor works well with APC 12x3.8

Would you try that or 10x4 or 11x4?

Thanks!

Jlperan
Posts: 17
Joined: Mon May 21, 2012 11:02 pm

Re: PID tunning

Post by Jlperan »

Can't be 12x3.8. Distance between motors is 12. I'll try 10x4.

Thanks!

Jlperan
Posts: 17
Joined: Mon May 21, 2012 11:02 pm

Re: PID tunning

Post by Jlperan »

Well, it's working now. I changed the props and noticed one of the motors was running slower than the others so I changed that motor and it's flying :D

Thanks for all!

riahut.com
Posts: 23
Joined: Tue Jun 26, 2012 3:46 pm

Re: PID tunning

Post by riahut.com »

bill516 wrote:In gyro only mode, that is all other sensors switched off....


How do I turn sensors on|off in GUI ?

bill516
Posts: 334
Joined: Sun Aug 07, 2011 12:27 pm

Re: PID tunning

Post by bill516 »

You leave the boxes in the GUI blank then the sensors wont be active. Or you assign them to switches and dont switch them on.

Post Reply