Skip to content

Commit

Permalink
Fix for #2410
Browse files Browse the repository at this point in the history
See the issue on github for more details, but the cause seems to be a naive
attempt to handle zero-length moves at zero feed rate without considering
very short moves at a suitably small feed rate.


Signed-off-by: andypugh <andy@bodgesoc.org>
  • Loading branch information
andypugh committed May 9, 2023
1 parent de5aa5b commit b244b37
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
9 changes: 4 additions & 5 deletions src/emc/rs274ngc/interp_convert.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4750,11 +4750,10 @@ The approach to operating in incremental distance mode (g91) is to
put the the absolute position values into the block before using the
block to generate a move.
In inverse time feed mode, a lower bound of 0.1 is placed on the feed
rate so that the feed rate is never set to zero. If the destination
point is the same as the current point, the feed rate would be
calculated as zero otherwise.
If the destination point is the same as the current point, the feed rate
will be calculated as zero, so a default of 0.1 is applied in this case
(It doesn't matter how wrong the feed rate is on a zero-length move)
If cutter compensation is in use, the path's length may increase or
decrease. Also an arc may be added, to go around a corner, before the
straight move. For the purpose of calculating the feed rate when in
Expand Down
17 changes: 12 additions & 5 deletions src/emc/rs274ngc/interp_inverse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,13 @@ int Interp::inverse_time_rate_arc(double x1, //!< x coord of start point of
if (settings->feed_mode != INVERSE_TIME) return -1;

length = find_arc_length(x1, y1, z1, cx, cy, turn, x2, y2, z2);
rate = std::max(0.1, (length * block->f_number));
if (length == 0){
rate = 0.1; // See https://github.com/LinuxCNC/linuxcnc/issues/2410
} else {
rate = length * block->f_number;
}
enqueue_SET_FEED_RATE(rate);
settings->feed_rate = rate;

return INTERP_OK;
}

Expand Down Expand Up @@ -120,10 +123,14 @@ int Interp::inverse_time_rate_straight(double end_x, //!< x coordinate of en
cx, cy, cz,
settings->AA_current, settings->BB_current, settings->CC_current,
settings->u_current, settings->v_current, settings->w_current);

rate = std::max(0.1, (length * block->f_number));
if (length == 0){
rate = 0.1; // See https://github.com/LinuxCNC/linuxcnc/issues/2410
} else {
rate = length * block->f_number;
}

enqueue_SET_FEED_RATE(rate);
settings->feed_rate = rate;

printf("Length = %f, rate = %f\n", length, rate);
return INTERP_OK;
}
2 changes: 1 addition & 1 deletion src/hal/drivers/mesa-hostmot2/modbus/mesa_modbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ int send_modbus_pkt(hm2_modbus_inst_t *inst){
rtapi_u16 checksum;
rtapi_u16 fsizes[1];
rtapi_u8 frames;
int i;
int i;

checksum = RTU_CRC(ch->data, ch->ptr + 1);
ch->data[++(ch->ptr)] = checksum & 0xFF;
Expand Down

0 comments on commit b244b37

Please sign in to comment.