Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/src/config/python-interface.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@ see <<python:reading-ini-values,ReadingINI file values>> for an example.
*paused*:: '(returns boolean)' -
`motion paused` flag.

*single_stepping*:: '(returns boolean)' -
`motion single_stepping` flag.

*pocket_prepped*:: '(returns integer)' -
A Tx command completed, and this pocket is prepared. -1 if no
prepared pocket.
Expand Down
1 change: 1 addition & 0 deletions src/emc/nml_intf/emc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1702,6 +1702,7 @@ void EMC_TRAJ_STAT::update(CMS * cms)
cms->update(queueFull);
cms->update(id);
cms->update(paused);
cms->update(single_stepping);
cms->update(scale);
cms->update(rapid_scale);
EmcPose_update(cms, &position);
Expand Down
15 changes: 8 additions & 7 deletions src/emc/nml_intf/emc_nml.hh
Original file line number Diff line number Diff line change
Expand Up @@ -794,8 +794,8 @@ class EMC_TRAJ_SET_TERM_COND:public EMC_TRAJ_CMD_MSG {
void update(CMS * cms);

int cond;
double tolerance; // used to set the precision/tolerance of path deviation
// during CONTINUOUS motion mode.
double tolerance; // used to set the precision/tolerance of path deviation
// during CONTINUOUS motion mode.
};

class EMC_TRAJ_SET_SPINDLESYNC:public EMC_TRAJ_CMD_MSG {
Expand Down Expand Up @@ -984,6 +984,7 @@ class EMC_TRAJ_STAT:public EMC_TRAJ_STAT_MSG {
bool queueFull; // non-zero means can't accept another motion
int id; // id of the currently executing motion
bool paused; // non-zero means motion paused
bool single_stepping; // non-zero means motion stepping single block
double scale; // velocity scale factor
double rapid_scale; // rapid scale factor
//double spindle_scale; // moved to EMC_SPINDLE_STAT
Expand Down Expand Up @@ -1379,7 +1380,7 @@ class EMC_TASK_PLAN_SET_OPTIONAL_STOP:public EMC_TASK_CMD_MSG {
// Sub-class update() calls base-class update()
// cppcheck-suppress duplInheritedMember
void update(CMS * cms);

bool state; //state == ON, optional stop is on (e.g. we stop on any stops)
};

Expand All @@ -1394,7 +1395,7 @@ class EMC_TASK_PLAN_SET_BLOCK_DELETE:public EMC_TASK_CMD_MSG {
// Sub-class update() calls base-class update()
// cppcheck-suppress duplInheritedMember
void update(CMS * cms);

bool state; //state == ON, block delete is on, we ignore lines starting with "/"
};

Expand All @@ -1408,7 +1409,7 @@ class EMC_TASK_PLAN_OPTIONAL_STOP:public EMC_TASK_CMD_MSG {
// Sub-class update() calls base-class update()
// cppcheck-suppress duplInheritedMember
void update(CMS * cms);

};


Expand Down Expand Up @@ -1460,7 +1461,7 @@ class EMC_TASK_STAT:public EMC_TASK_STAT_MSG {
double activeSettings[ACTIVE_SETTINGS];
CANON_UNITS programUnits; // CANON_UNITS_INCHES, MM, CM

int interpreter_errcode; // return value from rs274ngc function
int interpreter_errcode; // return value from rs274ngc function
// (only useful for new interpreter.)
int task_paused; // non-zero means task is paused
double delayLeft; // delay time left of G4, M66..
Expand Down Expand Up @@ -1747,7 +1748,7 @@ class EMC_SPINDLE_ORIENT:public EMC_SPINDLE_CMD_MSG {

int spindle;
double orientation; // desired spindle position
int mode;
int mode;
};

class EMC_SPINDLE_WAIT_ORIENT_COMPLETE:public EMC_SPINDLE_CMD_MSG {
Expand Down
53 changes: 31 additions & 22 deletions src/emc/task/emctaskmain.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Author:
* License: GPL Version 2
* System: Linux
*
*
* Copyright (c) 2004 All rights reserved.
*
********************************************************************/
Expand Down Expand Up @@ -217,7 +217,7 @@ int emcOperatorError(const char *fmt, ...)
error_msg.error[0] = 0;
// append error string
va_start(ap, fmt);
vsnprintf(&error_msg.error[strlen(error_msg.error)],
vsnprintf(&error_msg.error[strlen(error_msg.error)],
sizeof(error_msg.error) - strlen(error_msg.error), fmt, ap);
va_end(ap);

Expand Down Expand Up @@ -466,7 +466,7 @@ static int checkInterpList(NML_INTERP_LIST * il, EMC_STAT * /*stat*/)
emcOperatorError("%s", error_msg->error);
break;
}

//FIXME: there was limit checking tests below, see if they were needed
case EMC_TRAJ_LINEAR_MOVE_TYPE:
break;
Expand Down Expand Up @@ -535,7 +535,7 @@ void readahead_reading(void)
EMC_TASK_INTERP::WAITING;
interp_list.clear();
emcAbortCleanup(EMC_ABORT::INTERPRETER_ERROR,
"interpreter error");
"interpreter error");
} else if (execRetval == -1
|| execRetval == INTERP_EXIT ) {
emcStatus->task.interpState =
Expand Down Expand Up @@ -585,7 +585,7 @@ void readahead_reading(void)

if (emcStatus->task.readLine < programStartLine &&
emcTaskPlanLevel() == 0) {

//update the position with our current position, as the other positions are only skipped through
CANON_UPDATE_END_POINT(emcStatus->motion.traj.actualPosition.tran.x,
emcStatus->motion.traj.actualPosition.tran.y,
Expand Down Expand Up @@ -648,7 +648,7 @@ static void mdi_execute_hook(void)
emcTaskCommand == 0 &&
emcStatus->task.execState ==
EMC_TASK_EXEC::DONE) {
emcTaskPlanClearWait();
emcTaskPlanClearWait();
mdi_execute_wait = 0;
mdi_execute_hook();
}
Expand All @@ -670,11 +670,11 @@ static void mdi_execute_hook(void)
// determine when a MDI command actually finishes normally.
if (interp_list.len() == 0 &&
emcTaskCommand == 0 &&
emcStatus->task.execState == EMC_TASK_EXEC::DONE &&
emcStatus->task.interpState != EMC_TASK_INTERP::IDLE &&
emcStatus->task.execState == EMC_TASK_EXEC::DONE &&
emcStatus->task.interpState != EMC_TASK_INTERP::IDLE &&
emcStatus->motion.traj.queue == 0 &&
emcStatus->io.status == RCS_STATUS::DONE &&
!mdi_execute_wait &&
emcStatus->io.status == RCS_STATUS::DONE &&
!mdi_execute_wait &&
!mdi_execute_next) {

// finished. Check for dequeuing of queued MDI command is done in emcTaskPlan().
Expand Down Expand Up @@ -1076,7 +1076,7 @@ static int emcTaskPlan(void)
case EMC_TASK_PLAN_STEP_TYPE:
// handles case where first action is to step the program
taskPlanRunCmd.line = 0; // run from start
/*! \todo FIXME-- can have GUI set this; send a run instead of a
/*! \todo FIXME-- can have GUI set this; send a run instead of a
step */
retval = emcTaskIssueCommand(&taskPlanRunCmd);
if(retval != 0) break;
Expand Down Expand Up @@ -1174,6 +1174,7 @@ static int emcTaskPlan(void)
break;

case EMC_TASK_PLAN_STEP_TYPE:
emcStatus->motion.traj.single_stepping = 1;
stepping = 1; // set stepping mode in case it's not
steppingWait = 0; // clear the wait
break;
Expand All @@ -1188,7 +1189,7 @@ static int emcTaskPlan(void)

// handle interp readahead logic
readahead_reading();

break; // EMC_TASK_INTERP::READING

case EMC_TASK_INTERP::PAUSED: // ON, AUTO, PAUSED
Expand Down Expand Up @@ -1249,6 +1250,7 @@ static int emcTaskPlan(void)
break;

case EMC_TASK_PLAN_STEP_TYPE:
emcStatus->motion.traj.single_stepping = 1;
stepping = 1;
steppingWait = 0;
if (emcStatus->motion.traj.paused &&
Expand Down Expand Up @@ -1324,6 +1326,7 @@ static int emcTaskPlan(void)
break;

case EMC_TASK_PLAN_STEP_TYPE:
emcStatus->motion.traj.single_stepping = 1;
stepping = 1; // set stepping mode in case it's not
steppingWait = 0; // clear the wait
break;
Expand Down Expand Up @@ -1892,10 +1895,10 @@ static int emcTaskIssueCommand(NMLmsg * cmd)

case EMC_TRAJ_PROBE_TYPE:
retval = emcTrajProbe(
((EMC_TRAJ_PROBE *) cmd)->pos,
((EMC_TRAJ_PROBE *) cmd)->pos,
((EMC_TRAJ_PROBE *) cmd)->type,
((EMC_TRAJ_PROBE *) cmd)->vel,
((EMC_TRAJ_PROBE *) cmd)->ini_maxvel,
((EMC_TRAJ_PROBE *) cmd)->ini_maxvel,
((EMC_TRAJ_PROBE *) cmd)->acc,
((EMC_TRAJ_PROBE *) cmd)->probe_type);
break;
Expand All @@ -1907,7 +1910,7 @@ static int emcTaskIssueCommand(NMLmsg * cmd)
emcAuxInputWaitIndex = -1;
taskExecDelayTimeout = 0.0;
} else {
emcAuxInputWaitType = emcAuxInputWaitMsg->wait_type; // remember what we are waiting for
emcAuxInputWaitType = emcAuxInputWaitMsg->wait_type; // remember what we are waiting for
emcAuxInputWaitIndex = emcAuxInputWaitMsg->index; // remember the input to look at
emcStatus->task.input_timeout = 2; // set timeout flag, gets cleared if input changes before timeout happens
// set the timeout clock to expire at 'now' + delay time
Expand All @@ -1924,7 +1927,7 @@ static int emcTaskIssueCommand(NMLmsg * cmd)
emcTrajUpdateTag(((EMC_TRAJ_LINEAR_MOVE *) cmd)->tag);
retval = emcTrajRigidTap(((EMC_TRAJ_RIGID_TAP *) cmd)->pos,
((EMC_TRAJ_RIGID_TAP *) cmd)->vel,
((EMC_TRAJ_RIGID_TAP *) cmd)->ini_maxvel,
((EMC_TRAJ_RIGID_TAP *) cmd)->ini_maxvel,
((EMC_TRAJ_RIGID_TAP *) cmd)->acc,
((EMC_TRAJ_RIGID_TAP *) cmd)->scale);
break;
Expand Down Expand Up @@ -2123,6 +2126,7 @@ static int emcTaskIssueCommand(NMLmsg * cmd)
// clear out the interpreter state
emcStatus->task.interpState = EMC_TASK_INTERP::IDLE;
emcStatus->task.execState = EMC_TASK_EXEC::DONE;
emcStatus->motion.traj.single_stepping = 0;
stepping = 0;
steppingWait = 0;

Expand Down Expand Up @@ -2217,6 +2221,7 @@ static int emcTaskIssueCommand(NMLmsg * cmd)
break;

case EMC_TASK_PLAN_EXECUTE_TYPE:
emcStatus->motion.traj.single_stepping = 0;
stepping = 0;
steppingWait = 0;
execute_msg = (EMC_TASK_PLAN_EXECUTE *) cmd;
Expand Down Expand Up @@ -2312,6 +2317,7 @@ static int emcTaskIssueCommand(NMLmsg * cmd)
retval = -1;
break;
}
emcStatus->motion.traj.single_stepping = 0;
stepping = 0;
steppingWait = 0;
if (!taskplanopen && emcStatus->task.file[0] != 0) {
Expand Down Expand Up @@ -2360,6 +2366,7 @@ static int emcTaskIssueCommand(NMLmsg * cmd)
emcTrajResume();
emcStatus->task.interpState = interpResumeState;
emcStatus->task.task_paused = 0;
emcStatus->motion.traj.single_stepping = 0;
stepping = 0;
steppingWait = 0;
retval = 0;
Expand Down Expand Up @@ -2590,6 +2597,7 @@ static int emcTaskExecute(void)
// clear out the interpreter state
emcStatus->task.interpState = EMC_TASK_INTERP::IDLE;
emcStatus->task.execState = EMC_TASK_EXEC::DONE;
emcStatus->motion.traj.single_stepping = 0;
stepping = 0;
steppingWait = 0;

Expand Down Expand Up @@ -2738,7 +2746,7 @@ static int emcTaskExecute(void)
}
// delay can be also be because we wait for an input
// if the index is set (not -1)
if (emcAuxInputWaitIndex >= 0) {
if (emcAuxInputWaitIndex >= 0) {
switch (emcAuxInputWaitType) {
case WAIT_MODE_HIGH:
if (emcStatus->motion.synch_di[emcAuxInputWaitIndex] != 0) {
Expand All @@ -2749,12 +2757,12 @@ static int emcTaskExecute(void)
}
break;

case WAIT_MODE_RISE:
case WAIT_MODE_RISE:
if (emcStatus->motion.synch_di[emcAuxInputWaitIndex] == 0) {
emcAuxInputWaitType = WAIT_MODE_HIGH;
}
break;

case WAIT_MODE_LOW:
if (emcStatus->motion.synch_di[emcAuxInputWaitIndex] == 0) {
emcStatus->task.input_timeout = 0; // clear timeout flag
Expand All @@ -2776,7 +2784,7 @@ static int emcTaskExecute(void)
emcStatus->task.execState = EMC_TASK_EXEC::DONE;
emcStatus->task.delayLeft = 0;
break;

default:
emcOperatorError("Unknown Wait Mode");
}
Expand Down Expand Up @@ -3435,7 +3443,7 @@ int main(int argc, char *argv[])

// check for subordinate errors, and halt task if so
if ( emcStatus->motion.status == RCS_STATUS::ERROR
&& emcStatus->motion.on_soft_limit) {
&& emcStatus->motion.on_soft_limit) {
if (!gave_soft_limit_message) {
emcOperatorError("On Soft Limit");
// if gui does not provide a means to switch to joint mode
Expand Down Expand Up @@ -3464,7 +3472,7 @@ int main(int argc, char *argv[])
}
// motion already should have reported this condition (and set RCS_STATUS::ERROR?)
// an M19 orient failed to complete within timeout
// if ((emcStatus->motion.status == RCS_STATUS::ERROR) &&
// if ((emcStatus->motion.status == RCS_STATUS::ERROR) &&
// (emcStatus->motion.spindle.orient_state == EMCMOT_ORIENT_FAULTED) &&
// (emcStatus->motion.spindle.orient_fault != 0)) {
// emcOperatorError("wait for orient complete timed out");
Expand Down Expand Up @@ -3497,6 +3505,7 @@ int main(int argc, char *argv[])
// clear out the interpreter state
emcStatus->task.interpState = EMC_TASK_INTERP::IDLE;
emcStatus->task.execState = EMC_TASK_EXEC::DONE;
emcStatus->motion.traj.single_stepping = 0;
stepping = 0;
steppingWait = 0;

Expand Down
3 changes: 2 additions & 1 deletion src/emc/usr_intf/axis/extensions/emcmodule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ static PyMemberDef Stat_members[] = {
{(char*)"queue_full", T_BOOL, O(motion.traj.queueFull), READONLY, NULL},
{(char*)"motion_id", T_INT, O(motion.traj.id), READONLY, NULL},
{(char*)"paused", T_BOOL, O(motion.traj.paused), READONLY, NULL},
{(char*)"single_stepping", T_BOOL, O(motion.traj.single_stepping), READONLY, NULL},
{(char*)"feedrate", T_DOUBLE, O(motion.traj.scale), READONLY, NULL},
{(char*)"rapidrate", T_DOUBLE, O(motion.traj.rapid_scale), READONLY, NULL},
{(char*)"velocity", T_DOUBLE, O(motion.traj.velocity), READONLY, NULL},
Expand Down Expand Up @@ -2592,7 +2593,7 @@ static struct PyModuleDef linuxcnc_moduledef = {
PyMODINIT_FUNC PyInit_linuxcnc(void);
PyMODINIT_FUNC PyInit_linuxcnc(void)
{

verbose_nml_error_messages = 0;
clear_rcs_print_flag(~0);

Expand Down
Loading