From: John K. <gi...@gi...> - 2013-06-23 15:33:27
|
allow for floating point in the base thread when motion creates the base and servo thread, the base thread doesn't support floating point. When using brushless DC motors, it is desireable to run the bldc component faster than the servo thread, but it needs FP. Added an module parameter to motion that tells it to create a floating point capable base thread. Default behavior is the same as before, so change is transparent. http://git.linuxcnc.org/?p=linuxcnc.git;a=commitdiff;h=02d22d6 --- docs/man/man9/motion.9 | 5 ++++- src/emc/motion/motion.c | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/man/man9/motion.9 b/docs/man/man9/motion.9 index 7dea994..11af8d4 100644 --- a/docs/man/man9/motion.9 +++ b/docs/man/man9/motion.9 @@ -8,9 +8,12 @@ .SH NAME motion \- accepts NML motion commands, interacts with HAL in realtime .SH SYNOPSIS -\fBloadrt motmod [base_period_nsec=\fIperiod\fB] [servo_period_nsec=\fIperiod\fB] [traj_period_nsec=\fIperiod\fB] [num_joints=\fI[0-9]\fB] ([num_dio=\fI[1-64]\fB] [num_aio=\fI[1-16]\fB]) +\fBloadrt motmod [base_period_nsec=\fIperiod\fB] [base_thread_fp=\fI0 or 1\fB] [servo_period_nsec=\fIperiod\fB] [traj_period_nsec=\fIperiod\fB] [num_joints=\fI[0-9]\fB] ([num_dio=\fI[1-64]\fB] [num_aio=\fI[1-16]\fB]) .SH DESCRIPTION +By default, the base thread does not support floating point. Software stepping, software encoder counting, and software pwm do not use floating point. \fBbase_thread_fp\fR can be used to enable floating point in the base thread (for example for brushless DC motor control). + +.P These pins and parameters are created by the realtime \fBmotmod\fR module. This module provides a HAL interface for LinuxCNC's motion planner. Basically \fBmotmod\fR takes in a list of waypoints and generates a nice blended and constraint-limited stream of joint positions to be fed to the motor drives. .P diff --git a/src/emc/motion/motion.c b/src/emc/motion/motion.c index f860c57..73077f1 100644 --- a/src/emc/motion/motion.c +++ b/src/emc/motion/motion.c @@ -47,6 +47,8 @@ RTAPI_MP_INT(key, "shared memory key"); static long base_period_nsec = 0; /* fastest thread period */ RTAPI_MP_LONG(base_period_nsec, "fastest thread period (nsecs)"); +int base_thread_fp = 0; /* default is no floating point in base thread */ +RTAPI_MP_INT(base_thread_fp, "floating point in base thread?"); static long servo_period_nsec = 1000000; /* servo thread period */ RTAPI_MP_LONG(servo_period_nsec, "servo thread period (nsecs)"); static long traj_period_nsec = 0; /* trajectory planner period */ @@ -1061,7 +1063,7 @@ static int init_threads(void) /* create HAL threads for each period */ /* only create base thread if it is faster than servo thread */ if (servo_base_ratio > 1) { - retval = hal_create_thread("base-thread", base_period_nsec, 0); + retval = hal_create_thread("base-thread", base_period_nsec, base_thread_fp); if (retval < 0) { rtapi_print_msg(RTAPI_MSG_ERR, "MOTION: failed to create %ld nsec base thread\n", |