diff options
author | Jeff Epler <jepler@unpythonic.net> | 2013-04-18 10:44:22 -0500 |
---|---|---|
committer | Jeff Epler <jepler@unpythonic.net> | 2013-04-18 10:44:22 -0500 |
commit | c047bcbe14adcf3d29e0c82c23dfbc3aaf319456 (patch) | |
tree | c11316856e2b4e716e3dbef821789304853a3098 | |
parent | 924a0f53e3562f504a3aa1c29f6f1e6960a58a8e (diff) | |
parent | 021d4bc6e1394481736fc552ebc41e671784b7a5 (diff) | |
download | linuxcnc-c047bcbe14adcf3d29e0c82c23dfbc3aaf319456.tar.gz linuxcnc-c047bcbe14adcf3d29e0c82c23dfbc3aaf319456.zip |
Merge remote branch 'origin/v2.5_branch'
Conflicts:
src/Makefile.modinc.in
-rw-r--r-- | share/axis/tcl/axis.tcl | 2 | ||||
-rw-r--r-- | src/Makefile | 9 | ||||
-rw-r--r-- | src/Makefile.modinc.in | 7 | ||||
-rw-r--r-- | src/emc/kinematics/5axiskins.c | 127 |
4 files changed, 140 insertions, 5 deletions
diff --git a/share/axis/tcl/axis.tcl b/share/axis/tcl/axis.tcl index 3fff82846..d79354f77 100644 --- a/share/axis/tcl/axis.tcl +++ b/share/axis/tcl/axis.tcl @@ -1945,7 +1945,7 @@ proc update_state {args} { state {$interp_state == $INTERP_IDLE && $taskfile != ""} \ .toolbar.reload {.menu.file "_Reload"} state {$taskfile != ""} \ - .toolbar.reload {.menu.file "_Save gcode as..."} + {.menu.file "_Save gcode as..."} state {$interp_state == $INTERP_IDLE && $taskfile != "" && $::has_editor} \ {.menu.file "_Edit..."} state {$taskfile != ""} {.menu.file "_Properties..."} diff --git a/src/Makefile b/src/Makefile index 52048664e..f9f71a16c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -644,8 +644,10 @@ EXTRA_CFLAGS = $(filter-out -ffast-math,$(RTFLAGS)) -D__MODULE__ -I$(BASEPWD) -I -DSEQUENTIAL_SUPPORT -DHAL_SUPPORT -DDYNAMIC_PLCSIZE -DRT_SUPPORT -DOLD_TIMERS_MONOS_SUPPORT -DMODBUS_IO_MASTER \ -fno-fast-math $(call cc-option,-mieee-fp) -fno-unsafe-math-optimizations \ $(call cc-option,-Wframe-larger-than=2560) -ifeq ($(RTARCH),x86_64) -EXTRA_CFLAGS += -msse -ffast-math -fno-unsafe-math-optimizations +ifneq ($(KERNELRELEASE),) +ifeq ($(RTARCH):$(RTAI):$(filter $(RTFLAGS),-msse),x86_64:3:) +EXTRA_CFLAGS += -msse +endif endif ifeq "$(USE_STUBS)" "1" @@ -808,6 +810,9 @@ hal_lib-objs := hal/hal_lib.o $(MATHSTUB) obj-m += trivkins.o trivkins-objs := emc/kinematics/trivkins.o +obj-m += 5axiskins.o +5axiskins-objs := emc/kinematics/5axiskins.o + obj-m += maxkins.o maxkins-objs := emc/kinematics/maxkins.o diff --git a/src/Makefile.modinc.in b/src/Makefile.modinc.in index 40440e557..ee179166c 100644 --- a/src/Makefile.modinc.in +++ b/src/Makefile.modinc.in @@ -39,10 +39,13 @@ BUILDSYS = @BUILD_SYS@ KERNELDIR := @KERNELDIR@ CC := @CC@ +RTAI = @RTAI@ RTFLAGS = $(filter-out -ffast-math,@RTFLAGS@ @EXT_RTFLAGS@) -fno-fast-math $(call cc-option,-mieee-fp) -fno-unsafe-math-optimizations RTFLAGS := -Os -g -I. -I@RTDIR@/include $(RTFLAGS) -DRTAPI -D_GNU_SOURCE -Drealtime -ifeq ($(RTARCH),x86_64) -EXTRA_CFLAGS += -msse -ffast-math -fno-unsafe-math-optimizations +ifneq ($(KERNELRELEASE),) +ifeq ($(RTARCH):$(RTAI):$(filter $(RTFLAGS),-msse),x86_64:3:) +EXTRA_CFLAGS += -msse +endif endif USE_RTLIBM = @USE_RTLIBM@ EMC2_HOME=@EMC2_HOME@ diff --git a/src/emc/kinematics/5axiskins.c b/src/emc/kinematics/5axiskins.c new file mode 100644 index 000000000..74e2f348d --- /dev/null +++ b/src/emc/kinematics/5axiskins.c @@ -0,0 +1,127 @@ +/******************************************************************** +* Description: 5axiskins.c +* Trivial kinematics for 3 axis Cartesian machine +* +* Derived from a work by Fred Proctor & Will Shackleford +* +* Author: +* License: GPL Version 2 +* System: Linux +* +* Copyright (c) 2007 Chris Radek +* +* Last change: +********************************************************************/ + +#include "kinematics.h" /* these decls */ +#include "posemath.h" +#include "hal.h" +#include "rtapi_math.h" + +#define d2r(d) ((d)*PM_PI/180.0) +#define r2d(r) ((r)*180.0/PM_PI) + +struct haldata { + hal_float_t *pivot_length; +} *haldata; + +static PmCartesian s2r(double r, double t, double p) { + PmCartesian c; + t = d2r(t), p = d2r(p); + + c.x = r * sin(p) * cos(t); + c.y = r * sin(p) * sin(t); + c.z = r * cos(p); + + return c; +} + +int kinematicsForward(const double *joints, + EmcPose * pos, + const KINEMATICS_FORWARD_FLAGS * fflags, + KINEMATICS_INVERSE_FLAGS * iflags) +{ + PmCartesian r = s2r(*(haldata->pivot_length) + joints[8], joints[5], 180.0 - joints[4]); + + pos->tran.x = joints[0] + r.x; + pos->tran.y = joints[1] + r.y; + pos->tran.z = joints[2] + *(haldata->pivot_length) + r.z; + pos->a = joints[3]; + pos->b = joints[4]; + pos->c = joints[5]; + pos->u = joints[6]; + pos->v = joints[7]; + pos->w = joints[8]; + + return 0; +} + +int kinematicsInverse(const EmcPose * pos, + double *joints, + const KINEMATICS_INVERSE_FLAGS * iflags, + KINEMATICS_FORWARD_FLAGS * fflags) +{ + + PmCartesian r = s2r(*(haldata->pivot_length) + pos->w, pos->c, 180.0 - pos->b); + + joints[0] = pos->tran.x - r.x; + joints[1] = pos->tran.y - r.y; + joints[2] = pos->tran.z - *(haldata->pivot_length) - r.z; + joints[3] = pos->a; + joints[4] = pos->b; + joints[5] = pos->c; + joints[6] = pos->u; + joints[7] = pos->v; + joints[8] = pos->w; + + return 0; +} + +/* implemented for these kinematics as giving joints preference */ +int kinematicsHome(EmcPose * world, + double *joint, + KINEMATICS_FORWARD_FLAGS * fflags, + KINEMATICS_INVERSE_FLAGS * iflags) +{ + *fflags = 0; + *iflags = 0; + + return kinematicsForward(joint, world, fflags, iflags); +} + +KINEMATICS_TYPE kinematicsType() +{ + return KINEMATICS_BOTH; +} + +#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) { + int result; + comp_id = hal_init("5axiskins"); + if(comp_id < 0) return comp_id; + + haldata = hal_malloc(sizeof(struct haldata)); + + result = hal_pin_float_new("5axiskins.pivot-length", HAL_IO, &(haldata->pivot_length), comp_id); + if(result < 0) goto error; + + *(haldata->pivot_length) = 250.0; + + hal_ready(comp_id); + return 0; + +error: + hal_exit(comp_id); + return result; +} + +void rtapi_app_exit(void) { hal_exit(comp_id); } |