Hi, I'm currently using the following patch to support incremental jogging through halui. Is there a better way to do this? If not, what about applying this to GIT?
Comments welcome. Index: src/emc/usr_intf/halui.cc =================================================================== --- src.orig/emc/usr_intf/halui.cc 2011-06-02 22:39:06.000000000 +0200 +++ src/emc/usr_intf/halui.cc 2011-06-03 17:10:26.737853921 +0200 @@ -159,6 +159,8 @@ DONE - jogging: halui.jog.0.minus bit halui.jog.0.plus bit halui.jog.0.analog float //pin for jogging the axis 0 + halui.jog.0.inc-counts u32 + halui.jog.0.inc-scale float .. halui.jog.7.minus bit halui.jog.7.plus bit @@ -304,6 +306,8 @@ DONE: - spindle-override ARRAY(hal_bit_t,jog_minus,EMCMOT_MAX_JOINTS+1) /* pin to jog in positive direction */ \ ARRAY(hal_bit_t,jog_plus,EMCMOT_MAX_JOINTS+1) /* pin to jog in negative direction */ \ ARRAY(hal_float_t,jog_analog,EMCMOT_MAX_JOINTS+1) /* pin for analog jogging (-1..0..1) */ \ + ARRAY(hal_u32_t,jog_inc_counts,EMCMOT_MAX_JOINTS+1) /* Incremental jogging */ \ + ARRAY(hal_float_t,jog_inc_scale,EMCMOT_MAX_JOINTS+1) /* Incremental jogging (scale) */ \ FIELD(hal_float_t,jog_deadband) /* pin for setting the jog analog deadband (where not to move) */ \ \ FIELD(hal_s32_t,mv_counts) /* pin for the Max Velocity counting */ \ @@ -950,6 +954,10 @@ int halui_hal_init(void) if (retval < 0) return retval; retval = hal_pin_float_newf(HAL_IN, &(halui_data->jog_analog[joint]), comp_id, "halui.jog.%d.analog", joint); if (retval < 0) return retval; + retval = hal_pin_u32_newf(HAL_IN, &(halui_data->jog_inc_counts[joint]), comp_id, "halui.jog.%d.inc-counts", joint); + if (retval < 0) return retval; + retval = hal_pin_float_newf(HAL_IN, &(halui_data->jog_inc_scale[joint]), comp_id, "halui.jog.%d.inc-scale", joint); + if (retval < 0) return retval; } retval = hal_pin_bit_newf(HAL_IN, &(halui_data->joint_home[num_axes]), comp_id, "halui.joint.selected.home"); @@ -1404,6 +1412,29 @@ static int sendJogCont(int axis, double } +static int sendJogInc(int axis, double speed, double inc) +{ + EMC_AXIS_INCR_JOG emc_axis_jog_msg; + + if ((emcStatus->task.state != EMC_TASK_STATE_ON) || (emcStatus->task.mode != EMC_TASK_MODE_MANUAL)) + return -1; + + if (axis < 0 || axis >= EMC_AXIS_MAX) + return -1; + + if (emcStatus->motion.traj.mode == EMC_TRAJ_MODE_TELEOP) + return -1; + + emc_axis_jog_msg.serial_number = ++emcCommandSerialNumber; + emc_axis_jog_msg.axis = axis; + emc_axis_jog_msg.vel = speed / 60.0; + emc_axis_jog_msg.incr = inc; + emcCommandBuffer->write(emc_axis_jog_msg); + + return emcCommandWaitReceived(emcCommandSerialNumber); +} + + static int sendFeedOverride(double override) { EMC_TRAJ_SET_SCALE emc_traj_set_scale_msg; @@ -1572,6 +1603,8 @@ static void hal_init_pins() *(halui_data->jog_minus[joint]) = old_halui_data.jog_minus[joint] = 0; *(halui_data->jog_plus[joint]) = old_halui_data.jog_plus[joint] = 0; *(halui_data->jog_analog[joint]) = old_halui_data.jog_analog[joint] = 0; + *(halui_data->jog_inc_counts[joint]) = old_halui_data.jog_inc_counts[joint] = 0; + *(halui_data->jog_inc_scale[joint]) = old_halui_data.jog_inc_scale[joint] = 0.0; } *(halui_data->joint_home[num_axes]) = old_halui_data.joint_home[num_axes] = 0; @@ -1610,6 +1643,7 @@ static void copy_hal_data(const halui_st static void check_hal_changes() { hal_s32_t counts; + hal_u32_t ucounts; int select_changed, joint; hal_bit_t bit, js; hal_float_t floatt; @@ -1840,7 +1874,15 @@ static void check_hal_changes() sendJogStop(joint); old_halui_data.jog_analog[joint] = floatt; } - + + ucounts = new_halui_data.jog_inc_counts[joint]; + counts = (hal_s32_t)(ucounts - old_halui_data.jog_inc_counts[joint]); + if (counts) { + sendJogInc(joint, new_halui_data.jog_speed, + (double)*new_halui_data.jog_inc_scale * counts); + old_halui_data.jog_inc_counts[joint] = ucounts; + } + // check to see if another joint has been selected bit = new_halui_data.joint_nr_select[joint]; if (bit != old_halui_data.joint_nr_select[joint]) { -- Greetings Michael. ------------------------------------------------------------------------------ Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Discover what all the cheering's about. Get your free trial download today. http://p.sf.net/sfu/quest-dev2dev2 _______________________________________________ Emc-developers mailing list Emc-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-developers