summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert W. Ellenberg <rwe24g@gmail.com>2014-04-14 23:26:29 -0400
committerChris Radek <chris@timeguy.com>2014-06-11 14:44:15 -0500
commit421282075af2dd84c4c02f4b1704de70e1c0a800 (patch)
treeb890c1f50bda9a78762f95a0da66986b00d35edd
parent23c43516bdaab12503b87db7ad048028b2c18506 (diff)
downloadlinuxcnc-421282075af2dd84c4c02f4b1704de70e1c0a800.tar.gz
linuxcnc-421282075af2dd84c4c02f4b1704de70e1c0a800.zip
Troubleshooting canon
Reverted to 1-indexing, but this didn't solve the problem. It turns out that XY rotation is to blame for choosing the wrong axis start / end points, which had butchered the axis_len calculation. This current state may not be right, but it runs on a few test programs so far.
-rw-r--r--src/emc/nml_intf/canon.hh18
-rw-r--r--src/emc/task/emccanon.cc24
2 files changed, 25 insertions, 17 deletions
diff --git a/src/emc/nml_intf/canon.hh b/src/emc/nml_intf/canon.hh
index 20d61275d..0261a7c1d 100644
--- a/src/emc/nml_intf/canon.hh
+++ b/src/emc/nml_intf/canon.hh
@@ -91,15 +91,15 @@ typedef int CANON_SIDE;
#define CANON_SIDE_OFF 3
typedef int CANON_AXIS;
-#define CANON_AXIS_X 0
-#define CANON_AXIS_Y 1
-#define CANON_AXIS_Z 2
-#define CANON_AXIS_A 3
-#define CANON_AXIS_B 4
-#define CANON_AXIS_C 5
-#define CANON_AXIS_U 6
-#define CANON_AXIS_V 7
-#define CANON_AXIS_W 8
+#define CANON_AXIS_X 1
+#define CANON_AXIS_Y 2
+#define CANON_AXIS_Z 3
+#define CANON_AXIS_A 4
+#define CANON_AXIS_B 5
+#define CANON_AXIS_C 6
+#define CANON_AXIS_U 7
+#define CANON_AXIS_V 8
+#define CANON_AXIS_W 9
/* Currently using the typedefs above rather than the enums below
typedef enum {CANON_PLANE_XY, CANON_PLANE_YZ, CANON_PLANE_XZ} CANON_PLANE;
diff --git a/src/emc/task/emccanon.cc b/src/emc/task/emccanon.cc
index 53efb0fe9..ab5710f0b 100644
--- a/src/emc/task/emccanon.cc
+++ b/src/emc/task/emccanon.cc
@@ -1387,12 +1387,12 @@ void ARC_FEED(int line_number,
first_start = canonEndPoint.x;
second_start = canonEndPoint.y;
- axis_start_point = canonEndPoint.z;
break;
case CANON_PLANE_YZ:
+ printf("case YZ\n");
// offset and align args properly
end.tran.y = first_end;
end.tran.z = second_end;
@@ -1409,12 +1409,12 @@ void ARC_FEED(int line_number,
first_start = canonEndPoint.y;
second_start = canonEndPoint.z;
- axis_start_point = canonEndPoint.x;
rotate(normal.x, normal.y, xy_rotation);
break;
case CANON_PLANE_XZ:
+ printf("case XZ\n");
// offset and align args properly
end.tran.z = first_end;
@@ -1432,7 +1432,6 @@ void ARC_FEED(int line_number,
first_start = canonEndPoint.z;
second_start = canonEndPoint.x;
- axis_start_point = canonEndPoint.y;
rotate(normal.x, normal.y, xy_rotation);
break;
@@ -1447,25 +1446,32 @@ void ARC_FEED(int line_number,
double axis_end_point_rotated;
+ // Get the appropriate axis end points to calculate length along normal axis
switch (activePlane) {
default: // to eliminate "uninitalized" warnings
case CANON_PLANE_XY:
axis_end_point_rotated = end.tran.z;
+ axis_start_point = canonEndPoint.z;
break;
case CANON_PLANE_YZ:
- axis_end_point_rotated = end.tran.x;
+ //KLUDGE: geometrically this should be X, but xy_rotation makes it Y
+ axis_end_point_rotated = end.tran.y;
+ axis_start_point = canonEndPoint.y;
break;
case CANON_PLANE_XZ:
- axis_end_point_rotated = end.tran.y;
+ //KLUDGE: geometrically this should be Y, but xy_rotation makes it X
+ axis_end_point_rotated = end.tran.x;
+ axis_start_point = canonEndPoint.x;
break;
}
axis_len = fabs(axis_end_point_rotated - axis_start_point);
printf("\naxis end point = %f, axis start point = %f\n", axis_end_point_rotated, axis_start_point);
+ printf("xy_rotation = %f\n",xy_rotation);
- // KLUDGE Get axis indices of plane
- int axis1 = (normal_axis + 1) % 3;
- int axis2 = (normal_axis + 2) % 3;
+ // KLUDGE Get axis indices (0-indexed) corresponding to normal axis (1-indexed)...
+ int axis1 = (normal_axis ) % 3;
+ int axis2 = (normal_axis + 1) % 3;
// Get planar velocity bounds
v1 = FROM_EXT_LEN(axis_max_velocity[axis1]);
@@ -1528,6 +1534,8 @@ void ARC_FEED(int line_number,
}
printf("ARC_FEED: vel = %f, tmax = %f\n",vel,tmax);
+ printf("start point %f %f %f\n",canonEndPoint.x,canonEndPoint.y,canonEndPoint.z);
+ printf("end point %f %f %f\n",end.tran.x,end.tran.y,end.tran.z);
// for arcs we always user linear move since there is no
// arc possible with only ABC motion