On 06/23/2010 07:23 PM, Andy Pugh wrote:
I finally have my kinematics module running as expected. The solution
(at least initially) seems to be to run it in SIM, where everything
works as it should.
Running it on my "real" build I get all sorts of wierd stuff, such as
numeric values coming out just plain wrong:
double fKcount = 0;
*(haldata->rKcount) = rKcount +1;
returning 0.70710678 on the HAL pin (yes, exactly sin(45).).
atan2(0,1) = 0.7586 and, most troublesomely, perfectly normal zeros
being passed to the motion controller (control.c) and becoming NaN
somewhere in one of the called functions.
My kernel is an RTAI SMP kernel I built myself. Visteurs has been
having similar trouble with his SMP Lucid EMC2. I have spent weeks
looking for problems in the kinematics code (and there are some) but
it really looks like the problem might be elsewhere.
The current code is here:
http://pastebin.com/SQJSy0f9
It works OK (ish) in SIM but not at all in my live system. Especially
the pin addressed in line 102 takes on the value 0.7071 (and counts up
in 0.7971s if changed to a ++ assignment or = (rKcount = rKcount + 1)
Stumped, I am.
Andy,
I see:
==========
static PmCartesian old;
double dx = 0, dy = 0, C = 0;
double fKcount = 0, rKcount = 0;
==========
"static" means that this variable will be visible only from this file.
The lack of the static keyword means that dx, dy, C, fKcount, and
rKcount will be visible from other files.
That probably isn't what you want since it means that some other
function might be changing those variables.
In general, you really don't want to pass variables among functions
other than explicitly in a function call.
Ken
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers