Delta Kinematic - Problems during compiling

More
20 Jun 2013 09:28 #35826 by DeVraN
Hi @all,

i want to try to compile a kinematic modul, but get same errors. The kinematic modul, written by Jozsef Papp and István Ábel, is about the delta kinematic.

I'm getting this error during the compiling:

sudo comp --install '/usr/realtime-2.6.32-122-rtai/modules/linuxcnc/deltakins.c'
make KBUILD_EXTRA_SYMBOLS=/usr/realtime-2.6.32-122-rtai/modules/linuxcnc/Module.symvers -C /usr/src/linux-headers-2.6.32-122-rtai SUBDIRS=`pwd` CC=gcc V=0 modules
make[1]: Betrete Verzeichnis '/usr/src/linux-headers-2.6.32-122-rtai'
CC [M] /tmp/tmpJt9ZqV/deltakins.o
/tmp/tmpJt9ZqV/deltakins.c: In function ‘delta_calcAngleYZ’:
/tmp/tmpJt9ZqV/deltakins.c:142: warning: ISO C90 forbids mixed declarations and code
/tmp/tmpJt9ZqV/deltakins.c:147: warning: ISO C90 forbids mixed declarations and code
/tmp/tmpJt9ZqV/deltakins.c: In function ‘kinematicsInverse’:
/tmp/tmpJt9ZqV/deltakins.c:170: warning: ISO C90 forbids mixed declarations and code
/tmp/tmpJt9ZqV/deltakins.c: In function ‘init_module’:
/tmp/tmpJt9ZqV/deltakins.c:221: error: ‘HAL_SUCCESS’ undeclared (first use in this function)
/tmp/tmpJt9ZqV/deltakins.c:221: error: (Each undeclared identifier is reported only once
/tmp/tmpJt9ZqV/deltakins.c:221: error: for each function it appears in.)
make[2]: *** [/tmp/tmpJt9ZqV/deltakins.o] Fehler 1
make[1]: *** [_module_/tmp/tmpJt9ZqV] Fehler 2
make[1]: Verlasse Verzeichnis '/usr/src/linux-headers-2.6.32-122-rtai'
make: *** [modules] Fehler 2


How can i fixe this? I don't know how to do it. :(
Attachments:

Please Log in or Create an account to join the conversation.

More
20 Jun 2013 16:35 #35834 by ArcEye
Hi

C90 is a very old C standard and does not allow a lot of things, including initialising with an operation.

Simply change offending lines from
double a = (x0*x0 + y0*y0 + z0*z0 +delta_rf*delta_rf - delta_re*delta_re - y1*y1)/(2*z0);
to
double a;
a = (x0*x0 + y0*y0 + z0*z0 +delta_rf*delta_rf - delta_re*delta_re - y1*y1)/(2*z0);

ie create the variable and then assign a value to it.

The whole thing is badly written, with no spacing and bracketing. The compiler doesn't need that but it certainly makes it more readable to humans.

As for
if((res = hal_pin_float_new("deltakins.e", HAL_IO, &(haldata->e), comp_id)) != HAL_SUCCESS) goto error;
if((res = hal_pin_float_new("deltakins.f", HAL_IO, &(haldata->f), comp_id)) != HAL_SUCCESS) goto error;
if((res = hal_pin_float_new("deltakins.re", HAL_IO, &(haldata->re), comp_id)) != HAL_SUCCESS) goto error;
if((res = hal_pin_float_new("deltakins.rf", HAL_IO, &(haldata->rf), comp_id)) != HAL_SUCCESS) goto error;


Again badly written, assigns the result to a variable which is not used for anything (res) and uses a goto command Yuggh :sick:

hal_pin_float_new() should return 0 if sucessful, so either #define HAL_SUCCESS 0 at the top of the file or simply substitute each instance with 0

regards
The following user(s) said Thank You: DeVraN

Please Log in or Create an account to join the conversation.

More
20 Jun 2013 20:38 #35839 by cncbasher
Here's a modified version that now should compile ok for you .
Attachments:
The following user(s) said Thank You: DeVraN

Please Log in or Create an account to join the conversation.

Time to create page: 0.112 seconds
Powered by Kunena Forum