summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Radek <chris@timeguy.com>2007-11-05 20:19:05 +0000
committerChris Radek <chris@timeguy.com>2007-11-05 20:19:05 +0000
commit1c215894283c6d2f0e22b3140ccef2f75f0b475f (patch)
tree64ea2edbd2182f372b50dc33f88256b3f9edbd24
parentde1225f7abe2b9ebbf049a1e9d67a3541ace1154 (diff)
downloadlinuxcnc-1c215894283c6d2f0e22b3140ccef2f75f0b475f.tar.gz
linuxcnc-1c215894283c6d2f0e22b3140ccef2f75f0b475f.zip
setup for advanced probing: ability to move until the probe clears, and
ability to suppress the failure error and read it in a gcode variable instead. the actual brains in motion are not there yet.
-rw-r--r--src/emc/canterp/canterp.cc2
-rw-r--r--src/emc/motion/command.c1
-rw-r--r--src/emc/motion/control.c1
-rw-r--r--src/emc/motion/motion.h5
-rw-r--r--src/emc/nml_intf/canon.hh2
-rw-r--r--src/emc/nml_intf/emc.cc2
-rw-r--r--src/emc/nml_intf/emc.hh2
-rw-r--r--src/emc/nml_intf/emc_nml.hh1
-rw-r--r--src/emc/rs274ngc/gcodemodule.cc2
-rw-r--r--src/emc/rs274ngc/interp_array.cc4
-rw-r--r--src/emc/rs274ngc/interp_convert.cc21
-rw-r--r--src/emc/rs274ngc/interp_internal.hh3
-rw-r--r--src/emc/rs274ngc/rs274ngc.hh2
-rw-r--r--src/emc/sai/saicanon.cc2
-rw-r--r--src/emc/task/emccanon.cc4
-rw-r--r--src/emc/task/emctaskmain.cc3
-rw-r--r--src/emc/task/taskintf.cc3
17 files changed, 43 insertions, 17 deletions
diff --git a/src/emc/canterp/canterp.cc b/src/emc/canterp/canterp.cc
index 10570e44e..947d29b9e 100644
--- a/src/emc/canterp/canterp.cc
+++ b/src/emc/canterp/canterp.cc
@@ -519,7 +519,7 @@ int emcTaskPlanExecute(const char *command)
&d1, &d2, &d3, &d4, &d5, &d6, &d7, &d8, &d9)) {
return 1;
}
- STRAIGHT_PROBE(d1, d2, d3, d4, d5, d6, d7, d8, d9);
+ STRAIGHT_PROBE(d1, d2, d3, d4, d5, d6, d7, d8, d9, 0);
return 0;
}
diff --git a/src/emc/motion/command.c b/src/emc/motion/command.c
index 794c1da10..b749d6a7a 100644
--- a/src/emc/motion/command.c
+++ b/src/emc/motion/command.c
@@ -1257,6 +1257,7 @@ check_stuff ( "before command_handler()" );
break;
} else {
emcmotStatus->probing = 1;
+ emcmotStatus->probe_type = emcmotCommand->probe_type;
SET_MOTION_ERROR_FLAG(0);
/* set flag that indicates all axes need rehoming, if any
axis is moved in joint mode, for machines with no forward
diff --git a/src/emc/motion/control.c b/src/emc/motion/control.c
index a20250fec..680c1bed3 100644
--- a/src/emc/motion/control.c
+++ b/src/emc/motion/control.c
@@ -364,6 +364,7 @@ static void process_inputs(void)
emcmot_joint_t *joint;
unsigned char enables;
static int old_probeVal = 0;
+ unsigned char probe_type = emcmotStatus->probe_type;
/* read probe input */
emcmotStatus->probeVal = *(emcmot_hal_data->probe_input);
diff --git a/src/emc/motion/motion.h b/src/emc/motion/motion.h
index 180dda266..ff522b604 100644
--- a/src/emc/motion/motion.h
+++ b/src/emc/motion/motion.h
@@ -224,6 +224,10 @@ extern "C" {
unsigned char now, out, start, end; /* these are related to synched AOUT/DOUT. now=wether now or synched, out = which gets set, start=start value, end=end value */
unsigned char mode; /* used for turning overrides etc. on/off */
double comp_nominal, comp_forward, comp_reverse; /* compensation triplet, nominal, forward, reverse */
+ unsigned char probe_type; /* ~1 = error if probe operation is unsuccessful (ngc default)
+ |1 = suppress error, report in # instead
+ ~2 = move until probe trips (ngc default)
+ |2 = move until probe clears */
unsigned char tail; /* flag count for mutex detect */
} emcmot_command_t;
@@ -593,6 +597,7 @@ Suggestion: Split this in to an Error and a Status flag register..
int probeTripped; /* Has the probe signal changed since start
of probe command? */
int probing; /* Currently looking for a probe signal? */
+ unsigned char probe_type;
EmcPose probedPos; /* Axis positions stored as soon as possible
after last probeTripped */
int spindle_index_enable; /* hooked to a canon encoder index-enable */
diff --git a/src/emc/nml_intf/canon.hh b/src/emc/nml_intf/canon.hh
index d3a2e29e0..a8c89ffc3 100644
--- a/src/emc/nml_intf/canon.hh
+++ b/src/emc/nml_intf/canon.hh
@@ -430,7 +430,7 @@ Only linear moves are allowed, axes A,B,C are not allowed to move.*/
extern void STRAIGHT_PROBE(double x, double y, double z,
double a, double b, double c,
- double u, double v, double w);
+ double u, double v, double w, unsigned char probe_type);
/* Perform a probing operation. This is a temporary addition to the
canonical machining functions and its semantics are not defined.
diff --git a/src/emc/nml_intf/emc.cc b/src/emc/nml_intf/emc.cc
index f92f9281f..209a75d3d 100644
--- a/src/emc/nml_intf/emc.cc
+++ b/src/emc/nml_intf/emc.cc
@@ -3052,7 +3052,7 @@ void EMC_TRAJ_PROBE::update(CMS * cms)
cms->update(vel);
cms->update(ini_maxvel);
cms->update(acc);
-
+ cms->update(probe_type);
}
/*
diff --git a/src/emc/nml_intf/emc.hh b/src/emc/nml_intf/emc.hh
index da9412aba..b90cbda6d 100644
--- a/src/emc/nml_intf/emc.hh
+++ b/src/emc/nml_intf/emc.hh
@@ -462,7 +462,7 @@ extern int emcTrajSetOrigin(EmcPose origin);
extern int emcTrajSetHome(EmcPose home);
extern int emcTrajClearProbeTrippedFlag();
extern int emcTrajProbe(EmcPose pos, int type, double vel,
- double ini_maxvel, double acc);
+ double ini_maxvel, double acc, unsigned char probe_type);
extern int emcAuxInputWait(int index, int input_type, int wait_type, int timeout);
extern int emcTrajRigidTap(EmcPose pos, double vel, double ini_maxvel, double acc);
diff --git a/src/emc/nml_intf/emc_nml.hh b/src/emc/nml_intf/emc_nml.hh
index f4e6d6bd5..9009f2b11 100644
--- a/src/emc/nml_intf/emc_nml.hh
+++ b/src/emc/nml_intf/emc_nml.hh
@@ -962,6 +962,7 @@ class EMC_TRAJ_PROBE:public EMC_TRAJ_CMD_MSG {
EmcPose pos;
int type;
double vel, ini_maxvel, acc;
+ unsigned char probe_type;
};
class EMC_TRAJ_RIGID_TAP:public EMC_TRAJ_CMD_MSG {
diff --git a/src/emc/rs274ngc/gcodemodule.cc b/src/emc/rs274ngc/gcodemodule.cc
index ccd7d0e8e..ed4e12d1b 100644
--- a/src/emc/rs274ngc/gcodemodule.cc
+++ b/src/emc/rs274ngc/gcodemodule.cc
@@ -379,7 +379,7 @@ void TURN_PROBE_ON() {}
void TURN_PROBE_OFF() {}
void STRAIGHT_PROBE(double x, double y, double z,
double a, double b, double c,
- double u, double v, double w) {
+ double u, double v, double w, unsigned char probe_type) {
_pos_x=x; _pos_y=y; _pos_z=z;
_pos_a=a; _pos_b=b; _pos_c=c;
_pos_u=u; _pos_v=v; _pos_w=w;
diff --git a/src/emc/rs274ngc/interp_array.cc b/src/emc/rs274ngc/interp_array.cc
index 5b1d50ce0..476c35d86 100644
--- a/src/emc/rs274ngc/interp_array.cc
+++ b/src/emc/rs274ngc/interp_array.cc
@@ -59,7 +59,7 @@ The groups are:
group 0 = {g4,g10,g28,g30,g53,g92,g92.1,g92.2,g92.3} - NON-MODAL
dwell, setup, return to ref1, return to ref2,
motion in machine coordinates, set and unset axis offsets
-group 1 = {g0,g1,g2,g3,g33,g33.1,g38.2,g76,g80,g81,g82,g83,g84,g85,g86,g87,g88,g89} - motion
+group 1 = {g0,g1,g2,g3,g33,g33.1,g38.2,g38.3,g38.4,g38.5,g76,g80,g81,g82,g83,g84,g85,g86,g87,g88,g89} - motion
group 2 = {g17,g18,g19} - plane selection
group 3 = {g90,g91} - distance mode
group 5 = {g93,g94,g95} - feed rate mode
@@ -93,7 +93,7 @@ const int Interp::_gees[] = {
/* 320 */ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 1, 1,-1,-1,-1,-1,-1,-1,-1,-1,
/* 340 */ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
/* 360 */ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-/* 380 */ -1,-1, 1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
+/* 380 */ -1,-1, 1, 1, 1, 1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
/* 400 */ 7,-1,-1,-1,-1,-1,-1,-1,-1,-1, 7, 7,-1,-1,-1,-1,-1,-1,-1,-1,
/* 420 */ 7, 7,-1,-1,-1,-1,-1,-1,-1,-1, 8, 8,-1,-1,-1,-1,-1,-1,-1,-1,
/* 440 */ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
diff --git a/src/emc/rs274ngc/interp_convert.cc b/src/emc/rs274ngc/interp_convert.cc
index 17abbf72e..b02417fda 100644
--- a/src/emc/rs274ngc/interp_convert.cc
+++ b/src/emc/rs274ngc/interp_convert.cc
@@ -2367,8 +2367,9 @@ int Interp::convert_motion(int motion, //!< g_code for a line, arc, canned cyc
CHP(convert_straight(motion, block, settings));
} else if ((motion == G_3) || (motion == G_2)) {
CHP(convert_arc(motion, block, settings));
- } else if (motion == G_38_2) {
- CHP(convert_probe(block, settings));
+ } else if (motion == G_38_2 || motion == G_38_3 ||
+ motion == G_38_4 || motion == G_38_5) {
+ CHP(convert_probe(block, motion, settings));
} else if (motion == G_80) {
#ifdef DEBUG_EMC
COMMENT("interpreter: motion mode set to none");
@@ -2417,7 +2418,8 @@ current position by calls to get_external_position_x, etc.
*/
int Interp::convert_probe(block_pointer block, //!< pointer to a block of RS274 instructions
- setup_pointer settings) //!< pointer to machine settings
+ int g_code,
+ setup_pointer settings) //!< pointer to machine settings
{
static char name[] = "convert_probe";
double end_x;
@@ -2429,7 +2431,16 @@ int Interp::convert_probe(block_pointer block, //!< pointer to a block of RS27
double u_end;
double v_end;
double w_end;
+
+ /* probe_type:
+ ~1 = error if probe operation is unsuccessful (ngc default)
+ |1 = suppress error, report in # instead
+ ~2 = move until probe trips (ngc default)
+ |2 = move until probe clears */
+
+ unsigned char probe_type = g_code - G_38_2;
+
CHK((block->x_flag == OFF && block->y_flag == OFF &&
block->z_flag == OFF && block->a_flag == OFF &&
block->b_flag == OFF && block->c_flag == OFF &&
@@ -2455,10 +2466,10 @@ int Interp::convert_probe(block_pointer block, //!< pointer to a block of RS27
TURN_PROBE_ON();
STRAIGHT_PROBE(end_x, end_y, end_z,
AA_end, BB_end, CC_end,
- u_end, v_end, w_end);
+ u_end, v_end, w_end, probe_type);
TURN_PROBE_OFF();
- settings->motion_mode = G_38_2;
+ settings->motion_mode = g_code;
settings->probe_flag = ON;
return INTERP_OK;
}
diff --git a/src/emc/rs274ngc/interp_internal.hh b/src/emc/rs274ngc/interp_internal.hh
index 9ac0dd2ae..00e470063 100644
--- a/src/emc/rs274ngc/interp_internal.hh
+++ b/src/emc/rs274ngc/interp_internal.hh
@@ -142,6 +142,9 @@ enum SPINDLE_MODE { CONSTANT_RPM, CONSTANT_SURFACE };
#define G_33 330
#define G_33_1 331
#define G_38_2 382
+#define G_38_3 383
+#define G_38_4 384
+#define G_38_5 385
#define G_40 400
#define G_41 410
#define G_41_1 411
diff --git a/src/emc/rs274ngc/rs274ngc.hh b/src/emc/rs274ngc/rs274ngc.hh
index adafbdb14..2308c5b09 100644
--- a/src/emc/rs274ngc/rs274ngc.hh
+++ b/src/emc/rs274ngc/rs274ngc.hh
@@ -256,7 +256,7 @@ private:
setup_pointer settings);
int convert_motion(int motion, block_pointer block,
setup_pointer settings);
- int convert_probe(block_pointer block, setup_pointer settings);
+ int convert_probe(block_pointer block, int g_code, setup_pointer settings);
int convert_retract_mode(int g_code, setup_pointer settings);
int convert_setup(block_pointer block, setup_pointer settings);
int convert_set_plane(int g_code, setup_pointer settings);
diff --git a/src/emc/sai/saicanon.cc b/src/emc/sai/saicanon.cc
index b7cb14593..731278161 100644
--- a/src/emc/sai/saicanon.cc
+++ b/src/emc/sai/saicanon.cc
@@ -571,7 +571,7 @@ void STRAIGHT_PROBE(
#ifdef CC
, double c /*CC*/
#endif
- , double u, double v, double w
+ , double u, double v, double w, unsigned char probe_type
)
{
double distance;
diff --git a/src/emc/task/emccanon.cc b/src/emc/task/emccanon.cc
index f38e29bb3..cfc059936 100644
--- a/src/emc/task/emccanon.cc
+++ b/src/emc/task/emccanon.cc
@@ -838,7 +838,8 @@ void RIGID_TAP(double x, double y, double z)
void STRAIGHT_PROBE(double x, double y, double z,
double a, double b, double c,
- double u, double v, double w)
+ double u, double v, double w,
+ unsigned char probe_type)
{
double ini_maxvel, vel, acc;
EMC_TRAJ_PROBE probeMsg;
@@ -906,6 +907,7 @@ void STRAIGHT_PROBE(double x, double y, double z,
probeMsg.acc = toExtAcc(acc);
probeMsg.type = EMC_MOTION_TYPE_PROBING;
+ probeMsg.probe_type = probe_type;
interp_list.append(probeMsg);
canonUpdateEndPoint(x, y, z, a, b, c, u, v, w);
}
diff --git a/src/emc/task/emctaskmain.cc b/src/emc/task/emctaskmain.cc
index be3b0cc64..d71c1bb31 100644
--- a/src/emc/task/emctaskmain.cc
+++ b/src/emc/task/emctaskmain.cc
@@ -1655,7 +1655,8 @@ static int emcTaskIssueCommand(NMLmsg * cmd)
((EMC_TRAJ_PROBE *) cmd)->type,
((EMC_TRAJ_PROBE *) cmd)->vel,
((EMC_TRAJ_PROBE *) cmd)->ini_maxvel,
- ((EMC_TRAJ_PROBE *) cmd)->acc);
+ ((EMC_TRAJ_PROBE *) cmd)->acc,
+ ((EMC_TRAJ_PROBE *) cmd)->probe_type);
break;
case EMC_AUX_INPUT_WAIT_TYPE:
diff --git a/src/emc/task/taskintf.cc b/src/emc/task/taskintf.cc
index 9ae9a833d..a8b25fabc 100644
--- a/src/emc/task/taskintf.cc
+++ b/src/emc/task/taskintf.cc
@@ -1033,7 +1033,7 @@ int emcTrajClearProbeTrippedFlag()
return usrmotWriteEmcmotCommand(&emcmotCommand);
}
-int emcTrajProbe(EmcPose pos, int type, double vel, double ini_maxvel, double acc)
+int emcTrajProbe(EmcPose pos, int type, double vel, double ini_maxvel, double acc, unsigned char probe_type)
{
emcmotCommand.command = EMCMOT_PROBE;
emcmotCommand.pos.tran.x = pos.tran.x;
@@ -1050,6 +1050,7 @@ int emcTrajProbe(EmcPose pos, int type, double vel, double ini_maxvel, double ac
emcmotCommand.vel = vel;
emcmotCommand.ini_maxvel = ini_maxvel;
emcmotCommand.acc = acc;
+ emcmotCommand.probe_type = probe_type;
return usrmotWriteEmcmotCommand(&emcmotCommand);
}