summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert W. Ellenberg <rwe24g@gmail.com>2013-11-08 05:18:51 -0500
committerChris Radek <chris@timeguy.com>2014-06-11 14:43:37 -0500
commit39a8f5850f854d8bf8699ba8ceb7fcea5f176b3a (patch)
tree8177437cea578e10a4389e530bb443a2555ed782
parentabe3dd4fd104bf14cdc42e9751fde50da73e23a5 (diff)
downloadlinuxcnc-39a8f5850f854d8bf8699ba8ceb7fcea5f176b3a.tar.gz
linuxcnc-39a8f5850f854d8bf8699ba8ceb7fcea5f176b3a.zip
Added extra check in blend velocity calculation
Works with simple rapid test, because we're not falling back to parabolic blends. Something is still wrong with the refactored parabolic blends, though. Next step is to force a failure every time. We should be able to fall back, but currently that may not be working.
-rw-r--r--nc_files/blend_tests/g0_corners.ngc9
-rw-r--r--src/emc/kinematics/tp.c10
2 files changed, 16 insertions, 3 deletions
diff --git a/nc_files/blend_tests/g0_corners.ngc b/nc_files/blend_tests/g0_corners.ngc
new file mode 100644
index 000000000..49184b8de
--- /dev/null
+++ b/nc_files/blend_tests/g0_corners.ngc
@@ -0,0 +1,9 @@
+G20 G90 G64
+
+G0 X0 Y0 Z0
+G1 X1 F30
+G0 Z.1
+G0 X2 Y1
+G0 Z0
+G1 X1 F30
+M2
diff --git a/src/emc/kinematics/tp.c b/src/emc/kinematics/tp.c
index 1ac793531..89ccbe6b7 100644
--- a/src/emc/kinematics/tp.c
+++ b/src/emc/kinematics/tp.c
@@ -1278,11 +1278,15 @@ STATIC void tpCheckOvershoot(TC_STRUCT * const tc, TC_STRUCT * const nexttc, Emc
*/
STATIC double tpComputeBlendVelocity(TP_STRUCT const * const tp, TC_STRUCT const * const tc, TC_STRUCT const * const nexttc) {
- //Store local blend velocity copy
- double blend_vel=tc->blend_vel;
+ double blend_vel;
+ double v_peak_this;
+ double v_peak_next;
if(nexttc && nexttc->maxaccel) {
- blend_vel = pmSqrt(nexttc->target * nexttc->maxaccel);
+ v_peak_this = pmSqrt(tc->target * tc->maxaccel);
+ v_peak_next = pmSqrt(nexttc->target * nexttc->maxaccel);
+ blend_vel=fmin(v_peak_this,v_peak_next);
+
if(blend_vel > tpGetReqVel(tp,nexttc)) {
// segment has a cruise phase so let's blend over the
// whole accel period if possible