Skip to content

Commit

Permalink
emctaskmain.cc handle on_soft_limit #96 JA
Browse files Browse the repository at this point in the history
Make 'on_soft_limit' available to task and avoid abort looping if
'on_soft_limit'.  A switch to joint mode may be needed for recovery
(as noted in error messages).

Note:

IF
      1) KINEMATICS_IDENTITY
AND
      2) System misconfigured such that joint limits are more
         restrictive than axis limits
AND
      3) User gui provides no means to switch to joint mode
THEN
      System will probably need to be restarted and configured
      correctly when a misconfigured soft limit is encountered.
      (Expert users may use halui mode pins and halui jog pins
       and/or joint-mode wheel jogging pins to recover).

Note: There may be undiscovered side effects if there are
errors in addition to the 'on_soft_limit' error

Signed-off-by: Dewey Garrett <dgarrett@panix.com>
  • Loading branch information
dngarrett committed Jul 14, 2016
1 parent 80c6adb commit d118ec4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/emc/motion/control.c
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,7 @@ static void get_pos_cmds(long period)
reportError(_("Exceeded NEGATIVE soft limit (%.5f) on joint %d\n"),
joint->min_pos_limit, joint_num);
if (emcmotConfig->kinType == KINEMATICS_IDENTITY) {
reportError(_("Check: joints vs axis LIMITS"));
reportError(_("Stop, fix joints axis LIMITS, then Restart"));
} else {
reportError(_("Hint: switch to joint mode to jog off soft limit"));
}
Expand All @@ -1364,7 +1364,7 @@ static void get_pos_cmds(long period)
reportError(_("Exceeded POSITIVE soft limit (%.5f) on joint %d\n"),
joint->max_pos_limit,joint_num);
if (emcmotConfig->kinType == KINEMATICS_IDENTITY) {
reportError(_("Check: joints vs axis LIMITS"));
reportError(_("Stop, fix joints and axis LIMITS, then Restart"));
} else {
reportError(_("Hint: switch to joint mode to jog off soft limit"));
}
Expand Down
1 change: 1 addition & 0 deletions src/emc/nml_intf/emc_nml.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1210,6 +1210,7 @@ class EMC_MOTION_STAT:public EMC_MOTION_STAT_MSG {
double analog_input[EMCMOT_MAX_AIO]; //motion analog inputs queried by interp
double analog_output[EMCMOT_MAX_AIO]; //motion analog outputs queried by interp
int debug; // copy of EMC_DEBUG global
int on_soft_limit;
};

// declarations for EMC_TASK classes
Expand Down
23 changes: 21 additions & 2 deletions src/emc/task/emctaskmain.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
#include <ctype.h> // isspace()
#include <libintl.h>
#include <locale.h>
#include "usrmotintf.h"


#if 0
Expand All @@ -83,6 +84,8 @@ fpu_control_t __fpu_control = _FPU_IEEE & ~(_FPU_MASK_IM | _FPU_MASK_ZM | _FPU_M
#include "motion.h" // EMCMOT_ORIENT_*
#include "inihal.hh"

static emcmot_config_t emcmotConfig;

/* time after which the user interface is declared dead
* because it would'nt read any more messages
*/
Expand Down Expand Up @@ -3290,7 +3293,11 @@ int main(int argc, char *argv[])
minTime = DBL_MAX; // set to value that can never be exceeded
maxTime = 0.0; // set to value that can never be underset

if (0 != usrmotReadEmcmotConfig(&emcmotConfig)) {
rcs_print("%s failed usrmotReadEmcmotconfig()\n",__FILE__);
}
while (!done) {
static int gave_soft_limit_message = 0;
check_ini_hal_items(emcStatus->motion.traj.joints);
// read command
if (0 != emcCommandBuffer->read()) {
Expand Down Expand Up @@ -3354,11 +3361,23 @@ int main(int argc, char *argv[])

}

if (!emcStatus->motion.on_soft_limit) {gave_soft_limit_message = 0;}

// check for subordinate errors, and halt task if so
if (emcStatus->motion.status == RCS_ERROR ||
if ( emcStatus->motion.status == RCS_ERROR
&& emcStatus->motion.on_soft_limit) {
if (!gave_soft_limit_message) {
emcOperatorError(0, "On Soft Limit");
// if gui does not provide a means to switch to joint mode
// the machine may be stuck (a misconfiguration)
if (emcmotConfig.kinType == KINEMATICS_IDENTITY) {
emcOperatorError(0,"Identity kinematics are MISCONFIGURED");
}
gave_soft_limit_message = 1;
}
} else if (emcStatus->motion.status == RCS_ERROR ||
((emcStatus->io.status == RCS_ERROR) &&
(emcStatus->io.reason <= 0))) {

/*! \todo FIXME-- duplicate code for abort,
also in emcTaskExecute()
and in emcTaskIssueCommand() */
Expand Down
1 change: 1 addition & 0 deletions src/emc/task/taskintf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1873,6 +1873,7 @@ int emcMotionUpdate(EMC_MOTION_STAT * stat)
stat->spindle.direction = emcmotStatus.spindle.direction;
stat->spindle.orient_state = emcmotStatus.spindle.orient_state;
stat->spindle.orient_fault = emcmotStatus.spindle.orient_fault;
stat->on_soft_limit = emcmotStatus.on_soft_limit;

for (dio = 0; dio < EMCMOT_MAX_DIO; dio++) {
stat->synch_di[dio] = emcmotStatus.synch_di[dio];
Expand Down

0 comments on commit d118ec4

Please sign in to comment.