Hi,
I changed genhexkins for my 3 axis platform. It's pretty simple, inverse
kins only, forward to be done. It is compiled and works well on simulator.
But on realtime PC it compiles with lot of errors, and I can't identify the
source.
There's obviuosly some error in genhexkins, whish causes those errors in
other modules (with original genhexkins it compiles OK).
This is the master, I also tried earlier version - less errors, but it
won't compile too.
Lost two days fighting this... please give me a clue. All files attached.
Thanks.
Andrew
pkm@pkm-desktop:~/linuxcnc-dev/src$ make
make: Entering directory `/home/pkm/linuxcnc-dev/src'
copying shared configs
/usr/bin/python modsilent.py make 
KBUILD_EXTRA_SYMBOLS=/usr/realtime-2.6.32-122-rtai/modules/Module.symvers -C 
/usr/src/linux-headers-2.6.32-122-rtai SUBDIRS=`pwd` CC=gcc V=0 modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-122-rtai'
  CC [M]  /home/pkm/linuxcnc-dev/src/emc/kinematics/genhexkins.o
<command-line>: warning: "_FORTIFY_SOURCE" redefined
<command-line>: warning: this is the location of the previous definition
In file included from include/linux/kernel.h:15,
                 from include/linux/sched.h:54,
                 from /home/pkm/linuxcnc-dev/src/rtapi/rtapi.h:208,
                 from /home/pkm/linuxcnc-dev/src/emc/kinematics/genhexkins.c:94:
include/linux/bitops.h:108: error: expected ‘;’, ‘,’ or ‘)’ before numeric 
constant
In file included from include/linux/kernel.h:16,
                 from include/linux/sched.h:54,
                 from /home/pkm/linuxcnc-dev/src/rtapi/rtapi.h:208,
                 from /home/pkm/linuxcnc-dev/src/emc/kinematics/genhexkins.c:94:
include/linux/log2.h: In function ‘__roundup_pow_of_two’:
include/linux/log2.h:63: error: implicit declaration of function ‘fls_long’
In file included from 
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/processor.h:21,
                 from 
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/thread_info.h:22,
                 from include/linux/thread_info.h:56,
                 from include/linux/preempt.h:9,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:29,
                 from include/linux/time.h:8,
                 from include/linux/timex.h:56,
                 from include/linux/sched.h:56,
                 from /home/pkm/linuxcnc-dev/src/rtapi/rtapi.h:208,
                 from /home/pkm/linuxcnc-dev/src/emc/kinematics/genhexkins.c:94:
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/msr.h: At top level:
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/msr.h:23: error: 
expected identifier or ‘(’ before numeric constant
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/msr.h:24: error: 
expected ‘;’ before ‘u32’
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/msr.h:263: error: 
expected ‘;’, ‘,’ or ‘)’ before numeric constant
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/msr.h:264: error: 
expected ‘;’, ‘,’ or ‘)’ before numeric constant
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/msr.h:267: error: 
expected ‘;’, ‘,’ or ‘)’ before numeric constant
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/msr.h:268: error: 
expected ‘;’, ‘,’ or ‘)’ before numeric constant
In file included from 
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/processor.h:22,
                 from 
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/thread_info.h:22,
                 from include/linux/thread_info.h:56,
                 from include/linux/preempt.h:9,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:29,
                 from include/linux/time.h:8,
                 from include/linux/timex.h:56,
                 from include/linux/sched.h:56,
                 from /home/pkm/linuxcnc-dev/src/rtapi/rtapi.h:208,
                 from /home/pkm/linuxcnc-dev/src/emc/kinematics/genhexkins.c:94:
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/desc_defs.h:32: 
error: expected identifier or ‘(’ before numeric constant
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/desc_defs.h:33: 
warning: no semicolon at end of struct or union
In file included from 
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/thread_info.h:22,
                 from include/linux/thread_info.h:56,
                 from include/linux/preempt.h:9,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:29,
                 from include/linux/time.h:8,
                 from include/linux/timex.h:56,
                 from include/linux/sched.h:56,
                 from /home/pkm/linuxcnc-dev/src/rtapi/rtapi.h:208,
                 from /home/pkm/linuxcnc-dev/src/emc/kinematics/genhexkins.c:94:
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/processor.h: In 
function ‘get_debugctlmsr_on_cpu’:
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/processor.h:825: 
error: implicit declaration of function ‘rdmsr_on_cpu’
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/processor.h: In 
function ‘update_debugctlmsr_on_cpu’:
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/processor.h:847: 
error: implicit declaration of function ‘wrmsr_on_cpu’
In file included from 
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/atomic_32.h:414,
                 from 
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/atomic.h:2,
                 from 
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/thread_info.h:24,
                 from include/linux/thread_info.h:56,
                 from include/linux/preempt.h:9,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:29,
                 from include/linux/time.h:8,
                 from include/linux/timex.h:56,
                 from include/linux/sched.h:56,
                 from /home/pkm/linuxcnc-dev/src/rtapi/rtapi.h:208,
                 from /home/pkm/linuxcnc-dev/src/emc/kinematics/genhexkins.c:94:
include/asm-generic/atomic-long.h: At top level:
include/asm-generic/atomic-long.h:144: error: expected ‘;’, ‘,’ or ‘)’ before 
numeric constant
include/asm-generic/atomic-long.h:151: error: expected ‘;’, ‘,’ or ‘)’ before 
numeric constant
include/asm-generic/atomic-long.h:158: error: expected ‘;’, ‘,’ or ‘)’ before 
numeric constant
include/asm-generic/atomic-long.h:165: error: expected ‘;’, ‘,’ or ‘)’ before 
numeric constant
include/asm-generic/atomic-long.h:172: error: expected ‘;’, ‘,’ or ‘)’ before 
numeric constant
include/asm-generic/atomic-long.h:179: error: expected ‘;’, ‘,’ or ‘)’ before 
numeric constant
include/asm-generic/atomic-long.h:186: error: expected ‘;’, ‘,’ or ‘)’ before 
numeric constant
include/asm-generic/atomic-long.h:193: error: expected ‘;’, ‘,’ or ‘)’ before 
numeric constant
include/asm-generic/atomic-long.h:200: error: expected ‘;’, ‘,’ or ‘)’ before 
numeric constant
include/asm-generic/atomic-long.h:207: error: expected ‘;’, ‘,’ or ‘)’ before 
numeric constant
include/asm-generic/atomic-long.h:214: error: expected ‘;’, ‘,’ or ‘)’ before 
numeric constant
include/asm-generic/atomic-long.h:221: error: expected ‘;’, ‘,’ or ‘)’ before 
numeric constant
include/asm-generic/atomic-long.h:228: error: expected ‘;’, ‘,’ or ‘)’ before 
numeric constant
include/asm-generic/atomic-long.h:235: error: expected ‘;’, ‘,’ or ‘)’ before 
numeric constant
include/asm-generic/atomic-long.h:242: error: expected ‘;’, ‘,’ or ‘)’ before 
numeric constant
In file included from include/linux/gfp.h:4,
                 from include/linux/slab.h:12,
                 from include/linux/percpu.h:5,
                 from include/linux/ipipe.h:27,
                 from include/linux/sched.h:64,
                 from /home/pkm/linuxcnc-dev/src/rtapi/rtapi.h:208,
                 from /home/pkm/linuxcnc-dev/src/emc/kinematics/genhexkins.c:94:
include/linux/mmzone.h:143: error: expected ‘;’, ‘,’ or ‘)’ before numeric 
constant
include/linux/mmzone.h:148: error: expected ‘;’, ‘,’ or ‘)’ before numeric 
constant
include/linux/mmzone.h:153: error: expected ‘;’, ‘,’ or ‘)’ before numeric 
constant
In file included from /home/pkm/linuxcnc-dev/src/rtapi/rtapi.h:208,
                 from /home/pkm/linuxcnc-dev/src/emc/kinematics/genhexkins.c:94:
include/linux/sched.h: In function ‘get_mm_hiwater_rss’:
include/linux/sched.h:446: error: implicit declaration of function 
‘atomic_long_read’
In file included from 
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/elf.h:89,
                 from include/linux/elf.h:7,
                 from include/linux/module.h:14,
                 from /home/pkm/linuxcnc-dev/src/rtapi/rtapi_app.h:15,
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-122-rtai'
                 from /home/pkm/linuxcnc-dev/src/emc/kinematics/genhexkins.c:95:
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/desc.h: In function 
‘fill_ldt’:
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/desc.h:24: error: 
‘struct desc_struct’ has no member named ‘d’
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/desc.h:25: error: 
‘struct desc_struct’ has no member named ‘g’
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/desc.h:26: error: 
‘struct desc_struct’ has no member named ‘base2’
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/desc.h:31: error: 
expected identifier before numeric constant
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/desc.h: In function 
‘get_desc_base’:
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/desc.h:295: error: 
‘const struct desc_struct’ has no member named ‘base2’
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/desc.h: In function 
‘set_desc_base’:
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/desc.h:302: error: 
‘struct desc_struct’ has no member named ‘base2’
In file included from include/linux/module.h:20,
                 from /home/pkm/linuxcnc-dev/src/rtapi/rtapi_app.h:15,
                 from /home/pkm/linuxcnc-dev/src/emc/kinematics/genhexkins.c:95:
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/local.h: At top 
level:
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/local.h:19: error: 
expected ‘;’, ‘,’ or ‘)’ before numeric constant
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/local.h:25: error: 
expected ‘;’, ‘,’ or ‘)’ before numeric constant
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/local.h:31: error: 
expected ‘;’, ‘,’ or ‘)’ before numeric constant
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/local.h:38: error: 
expected ‘;’, ‘,’ or ‘)’ before numeric constant
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/local.h:54: error: 
expected ‘;’, ‘,’ or ‘)’ before numeric constant
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/local.h:72: error: 
expected ‘;’, ‘,’ or ‘)’ before numeric constant
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/local.h:90: error: 
expected ‘;’, ‘,’ or ‘)’ before numeric constant
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/local.h:109: error: 
expected ‘;’, ‘,’ or ‘)’ before numeric constant
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/local.h:126: error: 
expected ‘;’, ‘,’ or ‘)’ before numeric constant
/usr/src/linux-headers-2.6.32-122-rtai/arch/x86/include/asm/local.h:151: error: 
expected ‘;’, ‘,’ or ‘)’ before numeric constant
In file included from /home/pkm/linuxcnc-dev/src/rtapi/rtapi_app.h:15,
                 from /home/pkm/linuxcnc-dev/src/emc/kinematics/genhexkins.c:95:
include/linux/module.h: In function ‘__module_get’:
include/linux/module.h:470: error: implicit declaration of function ‘local_inc’
make[2]: *** [/home/pkm/linuxcnc-dev/src/emc/kinematics/genhexkins.o] Error 1
make[1]: *** [_module_/home/pkm/linuxcnc-dev/src] Error 2
make: *** [modules] Error 2
make: Leaving directory `/home/pkm/linuxcnc-dev/src'

/********************************************************************
* Description: genhexkins.c
* License: GPL Version 2
* System: Linux
*******************************************************************/

#include "rtapi_math.h"
#include "posemath.h"
#include "genhexkins.h"
#include "kinematics.h"             
/* these decls, KINEMATICS_FORWARD_FLAGS */

/* define position of base strut ends in base (world) coordinate system */
static PmCartesian b[3] = {{BASE_0_X, BASE_0_Y, BASE_0_Z},
			   {BASE_1_X, BASE_1_Y, BASE_1_Z},
			   {BASE_2_X, BASE_2_Y, BASE_2_Z}};

static PmCartesian p[3] = {{PLATFORM_0_X, PLATFORM_0_Y, PLATFORM_0_Z},
			   {PLATFORM_1_X, PLATFORM_1_Y, PLATFORM_1_Z},
			   {PLATFORM_2_X, PLATFORM_2_Y, PLATFORM_2_Z}};

const char * kinematicsGetName(void)
{
  return "genhex";
}

/************************ kinematicsInverse() ********************************/

int kinematicsInverse(const EmcPose * pos,
                      double * joints,
                      const KINEMATICS_INVERSE_FLAGS * iflags,
                      KINEMATICS_FORWARD_FLAGS * fflags)
{
  PmRpy rpy;
  PmCartesian p0;
  PmRotationMatrix RMatrix;
  double dx, dy, dz;
  int i;

  /* define Rotation Matrix */
  rpy.r = pos->tran.x * PM_PI / 180.0;
  rpy.p = pos->tran.y * PM_PI / 180.0;
  rpy.y = pos->tran.z * PM_PI / 180.0;

  /* define Rotation Matrix */
  pmRpyMatConvert(rpy, &RMatrix);

  /* enter for loop to calculate joints position */
  for (i = 0; i < NUM_STRUTS; i++) {
    /* convert location of platform joint from platform to world coordinates */
    pmMatCartMult(RMatrix, p[i], &p0);
    dx =  b[i].x - p0.x;
    dy =  b[i].y - p0.y;
    dz =  b[i].z - p0.z;
    /* define joint lenghts */
    joints[i] = dz - sqrt(l*l - dx*dx - dy*dy);
  }
  return 0;
}

int kinematicsForward(const double *joints,
		      EmcPose * pos,
		      const KINEMATICS_FORWARD_FLAGS * fflags,
		      KINEMATICS_INVERSE_FLAGS * iflags)
{
    pos->tran.x = joints[0];
    pos->tran.y = joints[1];
    pos->tran.z = joints[2];

    return 0;
}

/*
  kinematicsHome() is implemented by taking the desired world coordinates,
  which are passed as an arg, and running the inverse kinematics to get
  the resulting joints. The flags are set to zero.
*/
int kinematicsHome(EmcPose * world,
                   double * joint,
                   KINEMATICS_FORWARD_FLAGS * fflags,
                   KINEMATICS_INVERSE_FLAGS * iflags)
{
  *fflags = 0;
  *iflags = 0;

  return kinematicsInverse(world, joint, iflags, fflags);
}

KINEMATICS_TYPE kinematicsType()
{
  return KINEMATICS_INVERSE_ONLY;
}

#include "rtapi.h"		/* RTAPI realtime OS API */
#include "rtapi_app.h"		/* RTAPI realtime module decls */
#include "hal.h"

EXPORT_SYMBOL(kinematicsType);
EXPORT_SYMBOL(kinematicsForward);
EXPORT_SYMBOL(kinematicsInverse);

MODULE_LICENSE("GPL");

int comp_id;
int rtapi_app_main(void) {
    comp_id = hal_init("genhexkins");
    if(comp_id > 0) {
	hal_ready(comp_id);
	return 0;
    }
    return comp_id;
}

void rtapi_app_exit(void) { hal_exit(comp_id); }
/********************************************************************
* Description: genhexkins.h
*   Kinematics for a generalised hexapod machine
*
*   Derived from a work by R. Brian Register
*
* Author: 
* License: GPL Version 2
* System: Linux
*    
* Copyright (c) 2004 All rights reserved.
*
* Last change:
*******************************************************************

  This is the header file to accompany genhexkins.c.  This header file is used
  to configure genhexkins.c to solve the kinematics for a particular Stewart
  Platform configuration.

  Defined are the parameters necessary to configure the functions to solve
  several different Stewart Platform configurations.  To choose a particular
  configuration #define the configuration you are interested in and
  comment out any others.

  */

#include "posemath.h"		/* PmCartesian */

/* genhexSetParams lets you set the Cartesian coords of the base and platform,
   overriding the defaults set in the subsequent #defines */
extern int genhexSetParams(const PmCartesian base[], const PmCartesian platform[]);
extern int genhexGetParams(PmCartesian base[], PmCartesian platform[]);
extern int genhexKinematicsForwardIterations(void);

#define NUM_STRUTS 3

#define l 200

/* Define position of base strut ends in base (world) coordinates */

#define BASE_0_X 73.910
#define BASE_0_Y 30.615
#define BASE_0_Z 200
#define BASE_1_X -63.468
#define BASE_1_Y 48.701
#define BASE_1_Z 200
#define BASE_2_X -10.442
#define BASE_2_Y -79.316
#define BASE_2_Z 200

/* Define position of platform strut end in platform coordinate system */

#define PLATFORM_0_X 35.000
#define PLATFORM_0_Y 60.622
#define PLATFORM_0_Z 20.000
#define PLATFORM_1_X -70.000
#define PLATFORM_1_Y 0.000
#define PLATFORM_1_Z 20.000
#define PLATFORM_2_X 35.000
#define PLATFORM_2_Y -60.622
#define PLATFORM_2_Z 20.000
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to