PID Tuning with Radio/Channel

The last Bastion to fine tune your FC matching your airframe & setup

PID Tuning with Radio/Channel

Postby aqchab » Thu May 09, 2013 8:14 am

Hi,

don´t know if already asked - is it possible to use Radio Channel for PID Tuning - so maybe it´s much easier to play around ;)
aqchab
 
Posts: 29
Joined: Thu Feb 21, 2013 12:31 pm

Re: PID Tuning with Radio/Channel

Postby Max » Thu May 09, 2013 9:04 am

There's no built-in way to do it, though it's certainly possible with a bit of custom code. You first have to decide which parameter(s) will be tuned with which knob(s). Then some code in control.c should do the trick. You'll have to also set a scale for the adjustment, ie. how much the param values change in proportion to the RC channel input.

Some way to set up a parameter->channel mapping at runtime isn't a bad idea. Obviously a dangerous function though, it would be easy to cause all sorts of havoc with it. :twisted:

-Max
Max
 
Posts: 2814
Joined: Mon Aug 13, 2012 9:45 pm
Location: Near Ithaca, NY, USA

Re: PID Tuning with Radio/Channel

Postby bn999 » Thu May 09, 2013 1:37 pm

This function already exists in the code. The last 4 arguments passed to pidInit() should contain a pointer to the radio channel assigned to P, I, D or F or set to 0. An example:

Code: Select all
    controlData.pitchAnglePID = pidInit(&p[CTRL_TLT_ANG_P], &p[CTRL_TLT_ANG_I], &p[CTRL_TLT_ANG_D], &p[CTRL_TLT_ANG_F], &p[CTRL_TLT_ANG_PM], &p[CTRL_TLT_ANG_IM], &p[CTRL_TLT_ANG_DM], &p[CTRL_TLT_ANG_OM], &RADIO_AUX4, &RADIO_AUX4, 0, 0);
    controlData.rollAnglePID = pidInit(&p[CTRL_TLT_ANG_P], &p[CTRL_TLT_ANG_I], &p[CTRL_TLT_ANG_D], &p[CTRL_TLT_ANG_F], &p[CTRL_TLT_ANG_PM], &p[CTRL_TLT_ANG_IM], &p[CTRL_TLT_ANG_DM], &p[CTRL_TLT_ANG_OM], &RADIO_AUX4, &RADIO_AUX4, 0, 0);


This sets AUX4 & AUX5 to control P & I terms of the pitch and roll angle PIDs. The scale is fixed such that the existing PID term value is added to the radio channel value * 0.08 * term value. That give you a pretty good range.
bn999
 
Posts: 1559
Joined: Thu Jun 21, 2012 11:40 pm

Re: PID Tuning with Radio/Channel

Postby aqchab » Thu May 09, 2013 2:04 pm

Hi,

that means i have to setup development environment?
As i read the most common tool used is crossworks.
Does anyone use this on Mac OSX with success?
aqchab
 
Posts: 29
Joined: Thu Feb 21, 2013 12:31 pm

Re: PID Tuning with Radio/Channel

Postby skew » Thu May 09, 2013 2:11 pm

I use parallels 8 and ubuntu linux on mac os. Look in this thread for some of my post on what needs to be setup to run.
http://forum.autoquad.org/viewtopic.php?f=31&t=44
skew
 
Posts: 181
Joined: Sun Oct 14, 2012 1:30 am
Location: Morehead, Ky

Re: PID Tuning with Radio/Channel

Postby aqchab » Thu May 09, 2013 8:06 pm

Hi,

first run on Mac OS X 10.6.8 with Crossworks - no Error - only warnings but i think that´s OK

Does anybody know how to setup the AutoQuad SVN within Crossworks?
aqchab
 
Posts: 29
Joined: Thu Feb 21, 2013 12:31 pm

Re: PID Tuning with Radio/Channel

Postby chschmid » Thu May 09, 2013 10:02 pm

Crossworks is the linker/compiler, for SVN you can use Tortoise for instants.
First use Tortoise to get the source to your computer, then use Crossworks to generate a HEX file.

I am a W7 user, so I can not comment to Mac.

Best
Christof
chschmid
 
Posts: 1800
Joined: Wed Jul 11, 2012 7:41 pm
Location: Herrliberg, Switzerland

Re: PID Tuning with Radio/Channel

Postby Max » Thu May 09, 2013 10:14 pm

A few warning is normal. Make sure you're building a Release version, like it says in the AQ dev docs.

I believe to get SVN working directly from CW, you still have to install the official SVN client for your OS. Then you tell CW where to find the SVN executable... or something like that :) But you can also just use any SVN client from outside CW, like Christof said.

And thanks Bill for pointing out that feature... learning something new every day :)

-Max
Max
 
Posts: 2814
Joined: Mon Aug 13, 2012 9:45 pm
Location: Near Ithaca, NY, USA

Re: PID Tuning with Radio/Channel

Postby aqchab » Fri May 10, 2013 9:21 am

so i can just use svn command from terminal to get the source files as i´ve done it. I just thought it would be easier to do that from CW

thanks
aqchab
 
Posts: 29
Joined: Thu Feb 21, 2013 12:31 pm


Return to PID Tuning

Who is online

Users browsing this forum: No registered users and 2 guests

cron