Unhome support, partly based on a patch by Bryant. Allow unhoming one joint or all (-1) via nml message. A special unhome mode (-2) unhomes only the joints marked as VOLATILE_HOME in the ini. task could use this to unhome some joints, based on policy, at various state changes. This part is unimplemented so far.
This commit is contained in:
parent
aa987fed2b
commit
4aa4791cd1
15 changed files with 210 additions and 6 deletions
|
|
@ -28,6 +28,8 @@ menu .menu.machine \
|
|||
-tearoff 0
|
||||
menu .menu.machine.home \
|
||||
-tearoff 0
|
||||
menu .menu.machine.unhome \
|
||||
-tearoff 0
|
||||
menu .menu.view \
|
||||
-tearoff 0
|
||||
menu .menu.help \
|
||||
|
|
@ -181,6 +183,10 @@ setup_menu_accel .menu.machine end [_ "Set _Debug Level"]
|
|||
-menu .menu.machine.home
|
||||
setup_menu_accel .menu.machine end [_ "Homin_g"]
|
||||
|
||||
.menu.machine add cascade \
|
||||
-menu .menu.machine.unhome
|
||||
setup_menu_accel .menu.machine end [_ "_Unhoming"]
|
||||
|
||||
.menu.machine add cascade \
|
||||
-menu .menu.machine.clearoffset
|
||||
setup_menu_accel .menu.machine end [_ "_Zero coordinate system"]
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@ static int loadAxis(int axis, EmcIniFile *axisIniFile)
|
|||
bool ignore_limits;
|
||||
bool is_shared;
|
||||
int sequence;
|
||||
int volatile_home;
|
||||
int comp_file_type; //type for the compensation file. type==0 means nom, forw, rev.
|
||||
double maxVelocity;
|
||||
double maxAcceleration;
|
||||
|
|
@ -203,11 +204,13 @@ static int loadAxis(int axis, EmcIniFile *axisIniFile)
|
|||
axisIniFile->Find(&ignore_limits, "HOME_IGNORE_LIMITS", axisString);
|
||||
sequence = -1; // default
|
||||
axisIniFile->Find(&sequence, "HOME_SEQUENCE", axisString);
|
||||
volatile_home = 0; // default
|
||||
axisIniFile->Find(&volatile_home, "VOLATILE_HOME", axisString);
|
||||
|
||||
// issue NML message to set all params
|
||||
if (0 != emcAxisSetHomingParams(axis, home, offset, search_vel,
|
||||
latch_vel, (int)use_index, (int)ignore_limits,
|
||||
(int)is_shared, sequence)) {
|
||||
(int)is_shared, sequence, volatile_home)) {
|
||||
if (EMC_DEBUG & EMC_DEBUG_CONFIG) {
|
||||
rcs_print_error("bad return from emcAxisSetHomingParams\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -320,6 +320,7 @@ void emcmotAioWrite(int index, double value)
|
|||
void emcmotCommandHandler(void *arg, long period)
|
||||
{
|
||||
int joint_num;
|
||||
int n;
|
||||
emcmot_joint_t *joint;
|
||||
double tmp1;
|
||||
emcmot_comp_entry_t *comp_entry;
|
||||
|
|
@ -524,6 +525,7 @@ check_stuff ( "before command_handler()" );
|
|||
joint->home_latch_vel = emcmotCommand->latch_vel;
|
||||
joint->home_flags = emcmotCommand->flags;
|
||||
joint->home_sequence = emcmotCommand->home_sequence;
|
||||
joint->volatile_home = emcmotCommand->volatile_home;
|
||||
break;
|
||||
|
||||
case EMCMOT_OVERRIDE_LIMITS:
|
||||
|
|
@ -1205,6 +1207,64 @@ check_stuff ( "before command_handler()" );
|
|||
#endif
|
||||
break;
|
||||
|
||||
case EMCMOT_UNHOME:
|
||||
/* unhome the specified joint, or all joints if -1 */
|
||||
rtapi_print_msg(RTAPI_MSG_DBG, "UNHOME");
|
||||
rtapi_print_msg(RTAPI_MSG_DBG, " %d", joint_num);
|
||||
|
||||
if (emcmotStatus->motion_state != EMCMOT_MOTION_FREE) {
|
||||
reportError("must be in joint mode to unhome");
|
||||
return;
|
||||
}
|
||||
if (!GET_MOTION_ENABLE_FLAG()) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (joint_num < 0) {
|
||||
/* we want all or none, so these checks need to all be done first.
|
||||
* but, let's only report the first error. There might be several,
|
||||
* for instance if a homing sequence is running. */
|
||||
for (n = 0; n < num_joints; n++) {
|
||||
joint = &joints[n];
|
||||
if(GET_JOINT_ACTIVE_FLAG(joint)) {
|
||||
if (GET_JOINT_HOMING_FLAG(joint)) {
|
||||
reportError("Cannot unhome while homing, joint %d", n);
|
||||
return;
|
||||
}
|
||||
if (!GET_JOINT_INPOS_FLAG(joint)) {
|
||||
reportError("Cannot unhome while moving, joint %d", n);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* we made it through the checks, so unhome them all */
|
||||
for (n = 0; n < num_joints; n++) {
|
||||
joint = &joints[n];
|
||||
if(GET_JOINT_ACTIVE_FLAG(joint)) {
|
||||
/* if -2, only unhome the volatile_home joints */
|
||||
if(joint_num != -2 || joint->volatile_home) {
|
||||
SET_JOINT_HOMED_FLAG(joint, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* request was for only one joint */
|
||||
if(GET_JOINT_ACTIVE_FLAG(joint)) {
|
||||
if (GET_JOINT_HOMING_FLAG(joint)) {
|
||||
reportError("Cannot unhome while homing, joint %d", joint_num);
|
||||
return;
|
||||
}
|
||||
if (!GET_JOINT_INPOS_FLAG(joint)) {
|
||||
reportError("Cannot unhome while moving, joint %d", joint_num);
|
||||
return;
|
||||
}
|
||||
SET_JOINT_HOMED_FLAG(joint, 0);
|
||||
} else {
|
||||
reportError("Cannot unhome inactive joint %d", joint_num);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case EMCMOT_DISABLE_WATCHDOG:
|
||||
rtapi_print_msg(RTAPI_MSG_DBG, "DISABLE_WATCHDOG");
|
||||
/*! \todo Another #if 0 */
|
||||
|
|
|
|||
|
|
@ -122,7 +122,8 @@ extern "C" {
|
|||
EMCMOT_AF_ENABLE, /* enable/disable adaptive feedrate */
|
||||
EMCMOT_OVERRIDE_LIMITS, /* temporarily ignore limits until jog done */
|
||||
|
||||
EMCMOT_HOME, /* home a joint */
|
||||
EMCMOT_HOME, /* home a joint or all joints */
|
||||
EMCMOT_UNHOME, /* unhome a joint or all joints*/
|
||||
EMCMOT_JOG_CONT, /* continuous jog */
|
||||
EMCMOT_JOG_INCR, /* incremental jog */
|
||||
EMCMOT_JOG_ABS, /* absolute jog */
|
||||
|
|
@ -218,6 +219,8 @@ extern "C" {
|
|||
double latch_vel; /* home latch velocity */
|
||||
int flags; /* homing config flags, other boolean args */
|
||||
int home_sequence; /* order in homing sequence */
|
||||
int volatile_home; /* joint should get unhomed when we get unhome -2
|
||||
(generated by task upon estop, etc) */
|
||||
double minFerror; /* min following error */
|
||||
double maxFerror; /* max following error */
|
||||
int wdWait; /* cycle to wait before toggling wd */
|
||||
|
|
@ -456,6 +459,8 @@ Suggestion: Split this in to an Error and a Status flag register..
|
|||
double home_offset; /* dir/dist from switch to home point */
|
||||
double home; /* joint coordinate of home point */
|
||||
int home_flags; /* flags for various homing options */
|
||||
int volatile_home; /* joint should get unhomed when we get unhome -2
|
||||
(generated by task upon estop, etc) */
|
||||
double backlash; /* amount of backlash */
|
||||
int home_sequence; /* Order in homing sequence */
|
||||
emcmot_comp_t comp; /* leadscrew correction data */
|
||||
|
|
|
|||
|
|
@ -104,6 +104,9 @@ int emcFormat(NMLTYPE type, void *buffer, CMS * cms)
|
|||
case EMC_AXIS_HOME_TYPE:
|
||||
((EMC_AXIS_HOME *) buffer)->update(cms);
|
||||
break;
|
||||
case EMC_AXIS_UNHOME_TYPE:
|
||||
((EMC_AXIS_UNHOME *) buffer)->update(cms);
|
||||
break;
|
||||
case EMC_AXIS_INCR_JOG_TYPE:
|
||||
((EMC_AXIS_INCR_JOG *) buffer)->update(cms);
|
||||
break;
|
||||
|
|
@ -565,6 +568,8 @@ const char *emc_symbol_lookup(long type)
|
|||
return "EMC_AXIS_HALT";
|
||||
case EMC_AXIS_HOME_TYPE:
|
||||
return "EMC_AXIS_HOME";
|
||||
case EMC_AXIS_UNHOME_TYPE:
|
||||
return "EMC_AXIS_UNHOME";
|
||||
case EMC_AXIS_INCR_JOG_TYPE:
|
||||
return "EMC_AXIS_INCR_JOG";
|
||||
case EMC_AXIS_INIT_TYPE:
|
||||
|
|
@ -2590,6 +2595,13 @@ void EMC_AXIS_HOME::update(CMS * cms)
|
|||
|
||||
}
|
||||
|
||||
void EMC_AXIS_UNHOME::update(CMS * cms)
|
||||
{
|
||||
|
||||
EMC_AXIS_CMD_MSG::update(cms);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* NML/CMS Update function for EMC_AXIS_INIT
|
||||
* Automatically generated by NML CodeGen Java Applet.
|
||||
|
|
@ -2867,6 +2879,7 @@ void EMC_AXIS_SET_HOMING_PARAMS::update(CMS * cms)
|
|||
cms->update(latch_vel);
|
||||
cms->update(use_index);
|
||||
cms->update(ignore_limits);
|
||||
cms->update(volatile_home);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ class PM_CARTESIAN;
|
|||
#define EMC_AXIS_ENABLE_TYPE ((NMLTYPE) 121)
|
||||
#define EMC_AXIS_DISABLE_TYPE ((NMLTYPE) 122)
|
||||
#define EMC_AXIS_HOME_TYPE ((NMLTYPE) 123)
|
||||
#define EMC_AXIS_UNHOME_TYPE ((NMLTYPE) 135)
|
||||
#define EMC_AXIS_JOG_TYPE ((NMLTYPE) 124)
|
||||
#define EMC_AXIS_INCR_JOG_TYPE ((NMLTYPE) 125)
|
||||
#define EMC_AXIS_ABS_JOG_TYPE ((NMLTYPE) 126)
|
||||
|
|
@ -399,7 +400,7 @@ extern int emcAxisSetMinFerror(int axis, double ferror);
|
|||
extern int emcAxisSetHomingParams(int axis, double home, double offset,
|
||||
double search_vel, double latch_vel,
|
||||
int use_index, int ignore_limits,
|
||||
int is_shared, int home_sequence);
|
||||
int is_shared, int home_sequence, int volatile_home);
|
||||
extern int emcAxisSetMaxVelocity(int axis, double vel);
|
||||
extern int emcAxisSetMaxAcceleration(int axis, double acc);
|
||||
|
||||
|
|
@ -409,6 +410,7 @@ extern int emcAxisAbort(int axis);
|
|||
extern int emcAxisEnable(int axis);
|
||||
extern int emcAxisDisable(int axis);
|
||||
extern int emcAxisHome(int axis);
|
||||
extern int emcAxisUnhome(int axis);
|
||||
extern int emcAxisJog(int axis, double vel);
|
||||
extern int emcAxisIncrJog(int axis, double incr, double vel);
|
||||
extern int emcAxisAbsJog(int axis, double pos, double vel);
|
||||
|
|
|
|||
|
|
@ -277,6 +277,7 @@ class EMC_AXIS_SET_HOMING_PARAMS:public EMC_AXIS_CMD_MSG {
|
|||
int ignore_limits;
|
||||
int is_shared;
|
||||
int home_sequence;
|
||||
int volatile_home;
|
||||
};
|
||||
|
||||
class EMC_AXIS_SET_MAX_VELOCITY:public EMC_AXIS_CMD_MSG {
|
||||
|
|
@ -352,6 +353,16 @@ class EMC_AXIS_HOME:public EMC_AXIS_CMD_MSG {
|
|||
void update(CMS * cms);
|
||||
};
|
||||
|
||||
class EMC_AXIS_UNHOME:public EMC_AXIS_CMD_MSG {
|
||||
public:
|
||||
EMC_AXIS_UNHOME():EMC_AXIS_CMD_MSG(EMC_AXIS_UNHOME_TYPE,
|
||||
sizeof(EMC_AXIS_UNHOME)) {
|
||||
};
|
||||
|
||||
// For internal NML/CMS use only.
|
||||
void update(CMS * cms);
|
||||
};
|
||||
|
||||
class EMC_AXIS_JOG:public EMC_AXIS_CMD_MSG {
|
||||
public:
|
||||
EMC_AXIS_JOG():EMC_AXIS_CMD_MSG(EMC_AXIS_JOG_TYPE,
|
||||
|
|
|
|||
|
|
@ -197,6 +197,7 @@ int emcTaskSetState(int state)
|
|||
emcTrajDisable();
|
||||
emcLubeOff();
|
||||
emcTaskAbort();
|
||||
// emcAxisUnhome(-2); // only those joints which are volatile_home
|
||||
emcTaskPlanSynch();
|
||||
break;
|
||||
|
||||
|
|
@ -227,6 +228,7 @@ int emcTaskSetState(int state)
|
|||
emcTrajDisable();
|
||||
emcLubeOff();
|
||||
emcTaskAbort();
|
||||
// emcAxisUnhome(-2); // only those joints which are volatile_home
|
||||
emcTaskPlanSynch();
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -300,6 +300,7 @@ static EMC_AXIS_HALT *axis_halt_msg;
|
|||
static EMC_AXIS_DISABLE *disable_msg;
|
||||
static EMC_AXIS_ENABLE *enable_msg;
|
||||
static EMC_AXIS_HOME *home_msg;
|
||||
static EMC_AXIS_UNHOME *unhome_msg;
|
||||
static EMC_AXIS_JOG *jog_msg;
|
||||
static EMC_AXIS_ABORT *axis_abort_msg;
|
||||
static EMC_AXIS_INCR_JOG *incr_jog_msg;
|
||||
|
|
@ -531,6 +532,7 @@ static int emcTaskPlan(void)
|
|||
case EMC_AXIS_SET_OUTPUT_TYPE:
|
||||
case EMC_AXIS_LOAD_COMP_TYPE:
|
||||
case EMC_AXIS_SET_STEP_PARAMS_TYPE:
|
||||
case EMC_AXIS_UNHOME_TYPE:
|
||||
case EMC_TRAJ_SET_SCALE_TYPE:
|
||||
case EMC_TRAJ_SET_SPINDLE_SCALE_TYPE:
|
||||
case EMC_TRAJ_SET_FO_ENABLE_TYPE:
|
||||
|
|
@ -619,6 +621,7 @@ static int emcTaskPlan(void)
|
|||
case EMC_AXIS_ABORT_TYPE:
|
||||
case EMC_AXIS_HALT_TYPE:
|
||||
case EMC_AXIS_HOME_TYPE:
|
||||
case EMC_AXIS_UNHOME_TYPE:
|
||||
case EMC_AXIS_JOG_TYPE:
|
||||
case EMC_AXIS_INCR_JOG_TYPE:
|
||||
case EMC_AXIS_ABS_JOG_TYPE:
|
||||
|
|
@ -717,6 +720,7 @@ static int emcTaskPlan(void)
|
|||
case EMC_AXIS_SET_MIN_FERROR_TYPE:
|
||||
case EMC_AXIS_SET_OUTPUT_TYPE:
|
||||
case EMC_AXIS_SET_STEP_PARAMS_TYPE:
|
||||
case EMC_AXIS_UNHOME_TYPE:
|
||||
case EMC_TRAJ_PAUSE_TYPE:
|
||||
case EMC_TRAJ_RESUME_TYPE:
|
||||
case EMC_TRAJ_ABORT_TYPE:
|
||||
|
|
@ -814,6 +818,7 @@ static int emcTaskPlan(void)
|
|||
case EMC_AXIS_SET_MIN_FERROR_TYPE:
|
||||
case EMC_AXIS_SET_OUTPUT_TYPE:
|
||||
case EMC_AXIS_SET_STEP_PARAMS_TYPE:
|
||||
case EMC_AXIS_UNHOME_TYPE:
|
||||
case EMC_TRAJ_PAUSE_TYPE:
|
||||
case EMC_TRAJ_RESUME_TYPE:
|
||||
case EMC_TRAJ_ABORT_TYPE:
|
||||
|
|
@ -1019,6 +1024,7 @@ interpret_again:
|
|||
case EMC_AXIS_SET_MIN_FERROR_TYPE:
|
||||
case EMC_AXIS_SET_OUTPUT_TYPE:
|
||||
case EMC_AXIS_SET_STEP_PARAMS_TYPE:
|
||||
case EMC_AXIS_UNHOME_TYPE:
|
||||
case EMC_TRAJ_PAUSE_TYPE:
|
||||
case EMC_TRAJ_RESUME_TYPE:
|
||||
case EMC_TRAJ_ABORT_TYPE:
|
||||
|
|
@ -1101,6 +1107,7 @@ interpret_again:
|
|||
case EMC_AXIS_SET_MIN_FERROR_TYPE:
|
||||
case EMC_AXIS_SET_OUTPUT_TYPE:
|
||||
case EMC_AXIS_SET_STEP_PARAMS_TYPE:
|
||||
case EMC_AXIS_UNHOME_TYPE:
|
||||
case EMC_TRAJ_PAUSE_TYPE:
|
||||
case EMC_TRAJ_RESUME_TYPE:
|
||||
case EMC_TRAJ_ABORT_TYPE:
|
||||
|
|
@ -1200,6 +1207,7 @@ interpret_again:
|
|||
case EMC_AXIS_SET_MIN_FERROR_TYPE:
|
||||
case EMC_AXIS_SET_OUTPUT_TYPE:
|
||||
case EMC_AXIS_SET_STEP_PARAMS_TYPE:
|
||||
case EMC_AXIS_UNHOME_TYPE:
|
||||
case EMC_TRAJ_SET_SCALE_TYPE:
|
||||
case EMC_TRAJ_SET_SPINDLE_SCALE_TYPE:
|
||||
case EMC_TRAJ_SET_FO_ENABLE_TYPE:
|
||||
|
|
@ -1469,6 +1477,11 @@ static int emcTaskIssueCommand(NMLmsg * cmd)
|
|||
retval = emcAxisHome(home_msg->axis);
|
||||
break;
|
||||
|
||||
case EMC_AXIS_UNHOME_TYPE:
|
||||
unhome_msg = (EMC_AXIS_UNHOME *) cmd;
|
||||
retval = emcAxisUnhome(unhome_msg->axis);
|
||||
break;
|
||||
|
||||
case EMC_AXIS_JOG_TYPE:
|
||||
jog_msg = (EMC_AXIS_JOG *) cmd;
|
||||
retval = emcAxisJog(jog_msg->axis, jog_msg->vel);
|
||||
|
|
@ -1508,7 +1521,8 @@ static int emcTaskIssueCommand(NMLmsg * cmd)
|
|||
set_homing_params_msg->use_index,
|
||||
set_homing_params_msg->ignore_limits,
|
||||
set_homing_params_msg->is_shared,
|
||||
set_homing_params_msg->home_sequence);
|
||||
set_homing_params_msg->home_sequence,
|
||||
set_homing_params_msg->volatile_home);
|
||||
break;
|
||||
|
||||
case EMC_AXIS_SET_FERROR_TYPE:
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ int emcAxisSetMinFerror(int axis, double ferror)
|
|||
int emcAxisSetHomingParams(int axis, double home, double offset,
|
||||
double search_vel, double latch_vel,
|
||||
int use_index, int ignore_limits, int is_shared,
|
||||
int sequence)
|
||||
int sequence,int volatile_home)
|
||||
{
|
||||
if (axis < 0 || axis >= EMCMOT_MAX_JOINTS) {
|
||||
return 0;
|
||||
|
|
@ -240,6 +240,7 @@ int emcAxisSetHomingParams(int axis, double home, double offset,
|
|||
emcmotCommand.latch_vel = latch_vel;
|
||||
emcmotCommand.flags = 0;
|
||||
emcmotCommand.home_sequence = sequence;
|
||||
emcmotCommand.volatile_home = volatile_home;
|
||||
if (use_index) {
|
||||
emcmotCommand.flags |= HOME_USE_INDEX;
|
||||
}
|
||||
|
|
@ -441,6 +442,18 @@ int emcAxisHome(int axis)
|
|||
return usrmotWriteEmcmotCommand(&emcmotCommand);
|
||||
}
|
||||
|
||||
int emcAxisUnhome(int axis)
|
||||
{
|
||||
if (axis < -2 || axis >= EMCMOT_MAX_JOINTS) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
emcmotCommand.command = EMCMOT_UNHOME;
|
||||
emcmotCommand.axis = axis;
|
||||
|
||||
return usrmotWriteEmcmotCommand(&emcmotCommand);
|
||||
}
|
||||
|
||||
int emcAxisJog(int axis, double vel)
|
||||
{
|
||||
if (axis < 0 || axis >= EMCMOT_MAX_JOINTS) {
|
||||
|
|
|
|||
|
|
@ -1027,6 +1027,16 @@ static PyObject *home(pyCommandChannel *s, PyObject *o) {
|
|||
return Py_None;
|
||||
}
|
||||
|
||||
static PyObject *unhome(pyCommandChannel *s, PyObject *o) {
|
||||
EMC_AXIS_UNHOME m;
|
||||
if(!PyArg_ParseTuple(o, "i", &m.axis)) return NULL;
|
||||
m.serial_number = next_serial(s);
|
||||
s->c->write(m);
|
||||
emcWaitCommandReceived(s->serial, s->s);
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
// jog(JOG_STOP, axis)
|
||||
// jog(JOG_CONTINUOUS, axis, speed)
|
||||
// jog(JOG_INCREMENT, axis, speed, increment)
|
||||
|
|
@ -1233,6 +1243,7 @@ static PyMethodDef Command_methods[] = {
|
|||
{"abort", (PyCFunction)emcabort, METH_NOARGS},
|
||||
{"override_limits", (PyCFunction)override_limits, METH_NOARGS},
|
||||
{"home", (PyCFunction)home, METH_VARARGS},
|
||||
{"unhome", (PyCFunction)unhome, METH_VARARGS},
|
||||
{"jog", (PyCFunction)jog, METH_VARARGS},
|
||||
{"reset_interpreter", (PyCFunction)reset_interpreter, METH_NOARGS},
|
||||
{"program_open", (PyCFunction)program_open, METH_VARARGS},
|
||||
|
|
|
|||
|
|
@ -1876,7 +1876,8 @@ widgets = nf.Widgets(root_window,
|
|||
("menu_touchoff", Menu, ".menu.machine.touchoff"),
|
||||
|
||||
("homebutton", Button, tabs_manual + ".jogf.zerohome.home"),
|
||||
("homemenu", Menu, ".menu.machine.home")
|
||||
("homemenu", Menu, ".menu.machine.home"),
|
||||
("unhomemenu", Menu, ".menu.machine.unhome")
|
||||
)
|
||||
|
||||
def activate_axis(i, force=0):
|
||||
|
|
@ -2766,15 +2767,29 @@ class TclCommands(nf.TclCommands):
|
|||
ensure_mode(emc.MODE_MANUAL)
|
||||
c.home(-1)
|
||||
|
||||
def unhome_all_axes(event=None):
|
||||
if not manual_ok(): return
|
||||
ensure_mode(emc.MODE_MANUAL)
|
||||
c.unhome(-1)
|
||||
|
||||
def home_axis(event=None):
|
||||
if not manual_ok(): return
|
||||
ensure_mode(emc.MODE_MANUAL)
|
||||
c.home("xyzabcuvw".index(vars.current_axis.get()))
|
||||
|
||||
def unhome_axis(event=None):
|
||||
if not manual_ok(): return
|
||||
ensure_mode(emc.MODE_MANUAL)
|
||||
c.unhome("xyzabcuvw".index(vars.current_axis.get()))
|
||||
|
||||
def home_axis_number(num):
|
||||
ensure_mode(emc.MODE_MANUAL)
|
||||
c.home(num)
|
||||
|
||||
def unhome_axis_number(num):
|
||||
ensure_mode(emc.MODE_MANUAL)
|
||||
c.unhome(num)
|
||||
|
||||
def clear_offset(num):
|
||||
ensure_mode(emc.MODE_MDI)
|
||||
s.poll()
|
||||
|
|
@ -3301,6 +3316,9 @@ if homing_order_defined:
|
|||
root_window.tk.call("setup_menu_accel", widgets.homemenu, "end",
|
||||
_("Home All Axes"))
|
||||
|
||||
widgets.unhomemenu.add_command(command=commands.unhome_all_axes)
|
||||
root_window.tk.call("setup_menu_accel", widgets.unhomemenu, "end", _("Unhome All Axes"))
|
||||
|
||||
s = emc.stat();
|
||||
s.poll()
|
||||
while s.axes == 0:
|
||||
|
|
@ -3310,8 +3328,11 @@ while s.axes == 0:
|
|||
for i,j in enumerate("XYZABCUVW"):
|
||||
if s.axis_mask & (1<<i) == 0: continue
|
||||
widgets.homemenu.add_command(command=lambda i=i: commands.home_axis_number(i))
|
||||
widgets.unhomemenu.add_command(command=lambda i=i: commands.unhome_axis_number(i))
|
||||
root_window.tk.call("setup_menu_accel", widgets.homemenu, "end",
|
||||
_("Home Axis _%s") % j)
|
||||
root_window.tk.call("setup_menu_accel", widgets.unhomemenu, "end",
|
||||
_("Unhome Axis _%s") % j)
|
||||
|
||||
astep_size = step_size = 1
|
||||
for a in range(axiscount):
|
||||
|
|
|
|||
|
|
@ -165,6 +165,9 @@
|
|||
emc_home 0 | 1 | 2 | ...
|
||||
Homes the indicated axis.
|
||||
|
||||
emc_unhome 0 | 1 | 2 | ...
|
||||
Unhomes the indicated axis.
|
||||
|
||||
emc_jog_stop 0 | 1 | 2 | ...
|
||||
Stop the axis jog
|
||||
|
||||
|
|
@ -1766,6 +1769,26 @@ static int emc_home(ClientData clientdata,
|
|||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
static int emc_unhome(ClientData clientdata,
|
||||
Tcl_Interp * interp, int objc, Tcl_Obj * CONST objv[])
|
||||
{
|
||||
int axis;
|
||||
|
||||
if (objc != 2) {
|
||||
Tcl_SetResult(interp, "emc_home: need axis", TCL_VOLATILE);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
if (TCL_OK == Tcl_GetIntFromObj(0, objv[1], &axis)) {
|
||||
sendUnHome(axis);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
Tcl_SetResult(interp, "emc_home: need axis as integer, 0..",
|
||||
TCL_VOLATILE);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
static int emc_jog_stop(ClientData clientdata,
|
||||
Tcl_Interp * interp, int objc,
|
||||
Tcl_Obj * CONST objv[])
|
||||
|
|
@ -3584,6 +3607,9 @@ int Tcl_AppInit(Tcl_Interp * interp)
|
|||
Tcl_CreateObjCommand(interp, "emc_home", emc_home, (ClientData) NULL,
|
||||
(Tcl_CmdDeleteProc *) NULL);
|
||||
|
||||
Tcl_CreateObjCommand(interp, "emc_unhome", emc_unhome, (ClientData) NULL,
|
||||
(Tcl_CmdDeleteProc *) NULL);
|
||||
|
||||
Tcl_CreateObjCommand(interp, "emc_jog_stop", emc_jog_stop,
|
||||
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
|
||||
|
||||
|
|
|
|||
|
|
@ -978,6 +978,22 @@ int sendHome(int axis)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int sendUnHome(int axis)
|
||||
{
|
||||
EMC_AXIS_UNHOME emc_axis_home_msg;
|
||||
|
||||
emc_axis_home_msg.serial_number = ++emcCommandSerialNumber;
|
||||
emc_axis_home_msg.axis = axis;
|
||||
emcCommandBuffer->write(emc_axis_home_msg);
|
||||
if (emcWaitType == EMC_WAIT_RECEIVED) {
|
||||
return emcCommandWaitReceived(emcCommandSerialNumber);
|
||||
} else if (emcWaitType == EMC_WAIT_DONE) {
|
||||
return emcCommandWaitDone(emcCommandSerialNumber);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sendFeedOverride(double override)
|
||||
{
|
||||
EMC_TRAJ_SET_SCALE emc_traj_set_scale_msg;
|
||||
|
|
|
|||
|
|
@ -120,6 +120,7 @@ extern int sendBrakeEngage();
|
|||
extern int sendBrakeRelease();
|
||||
extern int sendAbort();
|
||||
extern int sendHome(int axis);
|
||||
extern int sendUnHome(int axis);
|
||||
extern int sendFeedOverride(double override);
|
||||
extern int sendSpindleOverride(double override);
|
||||
extern int sendTaskPlanInit();
|
||||
|
|
|
|||
Loading…
Reference in a new issue