Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

canon.hh

Go to the documentation of this file.
00001 #ifndef CANON_HH
00002 #define CANON_HH
00003 
00004 /*
00005 This is the header file that all trajectory applications that use the
00006 canonical commands for three-axis machining should include.
00007 
00008 It is assumed in these activities that the spindle tip is always at
00009 some location called the "current location," and the controller always
00010 knows where that is. It is also assumed that there is always a
00011 "selected plane" which must be the XY-plane, the YZ-plane, or the
00012 ZX-plane of the machine.
00013 */
00014 
00015 /*
00016   Modification history:
00017 
00018   23-Feb-2000  FMP added CANON_UPDATE_POSITION
00019 */
00020 
00021 typedef int CANON_PLANE;
00022 #define CANON_PLANE_XY 1
00023 #define CANON_PLANE_YZ 2
00024 #define CANON_PLANE_XZ 3
00025 
00026 typedef int CANON_UNITS;
00027 #define CANON_UNITS_INCHES 1
00028 #define CANON_UNITS_MM 2
00029 #define CANON_UNITS_CM 3
00030 
00031 typedef int CANON_MOTION_MODE;
00032 #define CANON_EXACT_STOP 1
00033 #define CANON_EXACT_PATH 2
00034 #define CANON_CONTINUOUS 3
00035 
00036 typedef int CANON_SPEED_FEED_MODE;
00037 #define CANON_SYNCHED 1
00038 #define CANON_INDEPENDENT 2
00039 
00040 typedef int CANON_DIRECTION;
00041 #define CANON_STOPPED 1
00042 #define CANON_CLOCKWISE 2
00043 #define CANON_COUNTERCLOCKWISE 3
00044 
00045 typedef int CANON_FEED_REFERENCE;
00046 #define CANON_WORKPIECE 1
00047 #define CANON_XYZ 2
00048 
00049 typedef int CANON_AXIS;
00050 #define CANON_AXIS_X 1
00051 #define CANON_AXIS_Y 2
00052 #define CANON_AXIS_Z 3
00053 #define CANON_AXIS_A 4
00054 #define CANON_AXIS_B 5
00055 #define CANON_AXIS_C 6
00056 
00057 /* Cutter comp */
00058 #define RIGHT 1
00059 #define LEFT 2
00060 
00061 /* Currently using the typedefs above rather than the enums below
00062 typedef enum {CANON_PLANE_XY, CANON_PLANE_YZ, CANON_PLANE_XZ} CANON_PLANE;
00063 typedef enum {CANON_UNITS_INCHES, CANON_UNITS_MM, CANON_UNITS_CM} CANON_UNITS;
00064 typedef enum {CANON_EXACT_STOP, CANON_EXACT_PATH, CANON_CONTINUOUS}
00065              CANON_MOTION_MODE;
00066 typedef enum {CANON_SYNCHED, CANON_INDEPENDENT} CANON_SPEED_FEED_MODE;
00067 typedef enum {CANON_STOPPED, CANON_CLOCKWISE, CANON_COUNTERCLOCKWISE}
00068              CANON_DIRECTION;
00069 typedef enum {CANON_WORKPIECE, CANON_XYZ} CANON_FEED_REFERENCE;
00070 typedef enum {CANON_AXIS_X, CANON_AXIS_Y, CANON_AXIS_Z, CANON_AXIS_A,
00071               CANON_AXIS_B, CANON_AXIS_C} CANON_AXIS;
00072 */
00073 
00074 struct CANON_VECTOR
00075 {
00076   CANON_VECTOR() {}
00077   CANON_VECTOR(double _x, double _y, double _z) {x = _x; y = _y; z = _z;}
00078   double x, y, z;
00079 };
00080 
00081 struct CANON_POSITION
00082 {
00083   CANON_POSITION() {}
00084   CANON_POSITION(double _x, double _y, double _z,
00085                  double _a, double _b, double _c)
00086   {
00087     x = _x; y = _y; z = _z;
00088     a = _a; b = _b; c = _c;
00089   }
00090   CANON_POSITION(double _x, double _y, double _z)
00091   {
00092     x = _x; y = _y; z = _z;
00093     a = 0.0; b = 0.0; c = 0.0;
00094   }
00095   double x, y, z, a, b, c;
00096 };
00097 
00098 //  7-Nov-1997 FMP added below
00099 /*
00100   Tools are numbered 1..CANON_TOOL_MAX, with tool 0 meaning no tool.
00101   */
00102 #define CANON_TOOL_MAX 32       // number of tools handled
00103 #define CANON_TOOL_ENTRY_LEN 256 // how long each file line can be
00104 
00105 struct CANON_TOOL_TABLE
00106 {
00107   int id;
00108   double length;
00109   double diameter;
00110 };
00111 //  7-Nov-1997 FMP added above
00112 
00113 /* Initialization */
00114 
00115 /* reads world model data into the canonical interface */
00116 extern void INIT_CANON();
00117 
00118 /* Representation */
00119 
00120 /* Set the program origin at the point with absolute coordinates x, y, and
00121 z. Values of x, y, and z are real numbers. The units are whatever
00122 length units are being used at the time this command is given. */
00123 
00124 extern void SET_ORIGIN_OFFSETS(double x, double y, double z,
00125                                double a=0, double b=0, double c=0);
00126 
00127 /* Offset the origin to the point with absolute coordinates x, y, and
00128 z.  Values of x, y, and z are real numbers. The units are whatever
00129 length units are being used at the time this command is given. */
00130 
00131 extern void USE_LENGTH_UNITS(CANON_UNITS u);
00132 
00133 /* Use the specified units for length. Conceptually, the units must
00134 be either inches or millimeters. */
00135 
00136 
00137 extern void SELECT_PLANE(CANON_PLANE pl);
00138 
00139 /* Use the plane designated by selected_plane as the selected plane.
00140 Conceptually, the selected_plane must be the XY-plane, the XZ-plane, or
00141 the YZ-plane. */
00142 
00143 /* Free Space Motion */
00144 
00145 extern void SET_TRAVERSE_RATE(double rate);
00146 
00147 /* Set the traverse rate that will be used when the spindle traverses. It
00148 is expected that no cutting will occur while a traverse move is being
00149 made. */
00150 
00151 extern void STRAIGHT_TRAVERSE (double x, double y, double z,
00152                                double a=0, double b=0, double c=0);
00153 
00154 /*
00155 
00156 Move at traverse rate so that at any time during the move, all axes
00157 have covered the same proportion of their required motion. The final
00158 XYZ position is given by x, y, and z.
00159 
00160 */
00161 
00162 /* Machining Attributes */
00163 
00164 extern void SET_FEED_RATE(double rate);
00165 
00166 /*
00167 
00168 SET_FEED_RATE sets the feed rate that will be used when the spindle is
00169 told to move at the currently set feed rate. The rate is either:
00170 1. the rate of motion of the tool tip in the workpiece coordinate system,
00171    which is used when the feed_reference mode is "CANON_WORKPIECE", or
00172 2. the rate of motion of the tool tip in the XYZ axis system, ignoring
00173    motion of other axes, which is used when the feed_reference mode is
00174    "CANON_XYZ".
00175 
00176 The units of the rate are length units (inches or millimeters
00177 according to the setting of CANON_UNITS) per minute along the
00178 programmed path as seen by the workpiece or the machine.
00179 
00180 */
00181 
00182 extern void SET_FEED_REFERENCE(CANON_FEED_REFERENCE reference);
00183 
00184 /*
00185 
00186 This sets the feed_reference mode to either CANON_WORKPIECE or
00187 CANON_XYZ. For three-axis motion, it makes no difference.
00188 
00189 */
00190 
00191 extern void SET_MOTION_CONTROL_MODE(CANON_MOTION_MODE mode);
00192 extern CANON_MOTION_MODE GET_MOTION_CONTROL_MODE();
00193 
00194 /*
00195 
00196 This sets the motion control mode to one of: CANON_EXACT_STOP,
00197 CANON_EXACT_PATH, or CANON_CONTINUOUS.
00198 
00199 */
00200 
00201 
00202 extern void SET_CUTTER_RADIUS_COMPENSATION(double radius);
00203 
00204 /* Set the radius to use when performing cutter radius compensation. */
00205 
00206 extern void START_CUTTER_RADIUS_COMPENSATION(int direction);
00207 
00208 /* Conceptually, the direction must be left (meaning the cutter
00209 stays to the left of the programmed path) or right. */
00210 
00211 extern void STOP_CUTTER_RADIUS_COMPENSATION();
00212 
00213 /* Do not apply cutter radius compensation when executing spindle
00214 translation commands. */
00215 
00216 extern void START_SPEED_FEED_SYNCH();
00217 extern void STOP_SPEED_FEED_SYNCH();
00218 
00219 /* Machining Functions */
00220 
00221 extern void ARC_FEED(double first_end, double second_end,
00222                      double first_axis, double second_axis, int rotation,
00223                      double axis_end_point,
00224                      double a_position=0,
00225                      double b_position=0,
00226                      double c_position=0);
00227 
00228 /* Move in a helical arc from the current location at the existing feed
00229 rate. The axis of the helix is parallel to the x, y, or z axis,
00230 according to which one is perpendicular to the selected plane. The
00231 helical arc may degenerate to a circular arc if there is no motion
00232 parallel to the axis of the helix.
00233 
00234 1. If the selected plane is the xy-plane:
00235 A. first_end is the x-coordinate of the end of the arc.
00236 B. second_end is the y-coordinate of the end of the arc.
00237 C. first_axis is the x-coordinate of the axis (center) of the arc.
00238 D. second_axis is the y-coordinate of the axis.
00239 E. axis_end_point is the z-coordinate of the end of the arc.
00240 
00241 2. If the selected plane is the yz-plane:
00242 A. first_end is the y-coordinate of the end of the arc.
00243 B. second_end is the z-coordinate of the end of the arc.
00244 C. first_axis is the y-coordinate of the axis (center) of the arc.
00245 D. second_axis is the z-coordinate of the axis.
00246 E. axis_end_point is the x-coordinate of the end of the arc.
00247 
00248 3. If the selected plane is the zx-plane:
00249 A. first_end is the z-coordinate of the end of the arc.
00250 B. second_end is the x-coordinate of the end of the arc.
00251 C. first_axis is the z-coordinate of the axis (center) of the arc.
00252 D. second_axis is the x-coordinate of the axis.
00253 E. axis_end_point is the y-coordinate of the end of the arc.
00254 
00255 If rotation is positive, the arc is traversed counterclockwise as
00256 viewed from the positive end of the coordinate axis perpendicular to
00257 the currently selected plane. If rotation is negative, the arc is
00258 traversed clockwise. If rotation is 0, first_end and second_end must
00259 be the same as the corresponding coordinates of the current point and
00260 no arc is made (but there may be translation parallel to the axis
00261 perpendicular to the selected plane and motion along the rotary axes).
00262 If rotation is 1, more than 0 but not more than 360 degrees of arc
00263 should be made. In general, if rotation is n, the amount of rotation
00264 in the arc should be more than ([n-1] x 360) but not more than (n x
00265 360).
00266 
00267 The radius of the helix is determined by the distance from the current
00268 location to the axis of helix or by the distance from the end location
00269 to the axis of the helix. It is recommended that the executing system
00270 verify that the two radii are the same (within some tolerance) at the
00271 beginning of executing this function.
00272 
00273 */
00274 
00275 extern void STRAIGHT_FEED (double x, double y, double z,
00276                            double a=0, double b=0, double c=0);
00277 
00278 /* Move at existing feed rate so that at any time during the move,
00279 all axes have covered the same proportion of their required motion.
00280 The meanings of the parameters are the same as for STRAIGHT_TRAVERSE.*/
00281 
00282 extern void STRAIGHT_PROBE (double x, double y, double z,
00283                             double a=0, double b=0, double c=0);
00284 
00285 /* Perform a probing operation. Move in a straight
00286 line at the currently programmed feed rate from the current position
00287 toward the programmed XYZ position. It is expected that a probe will
00288 be in the spindle. The probe may be a touch probe or a non-contact
00289 probe.
00290 
00291 For a touch probe, it is expected that the probe will be tripped
00292 before the programmed position is reached. It is an error condition
00293 for the probe to reach that position without being tripped;
00294 get_probe_value should return an error code if this happens. If the
00295 probe is tripped, get_probe_value should return a success code, and
00296 the position at which the probe was tripped should be returned by
00297 get_probe_position.  These functions should return the same values
00298 until after the next straight_probe function call is made. The control
00299 should move the axes back to the trip point after the probe is
00300 tripped. It is expected that the programmed position will be near
00301 enough to the expected trip point that the probe can reach that
00302 position without breaking.
00303 
00304 For a non-contact probe, it is expected that the probe will reach the
00305 programmed position. If it does not, get_probe_value should return
00306 0.0, and get_probe_position should return the position at
00307 which it stopped. If the probe does reach the progammed position,
00308 get_probe_position should return that position, and get_probe_value
00309 should return a numeric value (which may be 0.0).
00310 
00311 */
00312 
00313 extern void STOP();
00314 
00315 /* stop motion after current feed */
00316 
00317 extern void DWELL(double seconds);
00318 
00319 /* freeze x,y,z for a time */
00320 
00321 /* Spindle Functions */
00322 
00323 extern void SPINDLE_RETRACT_TRAVERSE();
00324 
00325 /* Retract the spindle at traverse rate to the fully retracted position. */
00326 
00327 extern void START_SPINDLE_CLOCKWISE();
00328 
00329 /* Turn the spindle clockwise at the currently set speed rate. If the
00330 spindle is already turning that way, this command has no effect. */
00331 
00332 extern void START_SPINDLE_COUNTERCLOCKWISE();
00333 
00334 /* Turn the spindle counterclockwise at the currently set speed rate. If
00335 the spindle is already turning that way, this command has no effect. */
00336 
00337 extern void SET_SPINDLE_SPEED(double r);
00338 
00339 /* Set the spindle speed that will be used when the spindle is turning.
00340 This is usually given in rpm and refers to the rate of spindle
00341 rotation. If the spindle is already turning and is at a different
00342 speed, change to the speed given with this command. */
00343 
00344 extern void STOP_SPINDLE_TURNING();
00345 
00346 /* Stop the spindle from turning. If the spindle is already stopped, this
00347 command may be given, but it will have no effect. */
00348 
00349 extern void SPINDLE_RETRACT();
00350 extern void ORIENT_SPINDLE(double orientation, CANON_DIRECTION direction);
00351 extern void LOCK_SPINDLE_Z();
00352 extern void USE_SPINDLE_FORCE();
00353 extern void USE_NO_SPINDLE_FORCE();
00354 
00355 /* Tool Functions */
00356 extern void USE_TOOL_LENGTH_OFFSET(double length);
00357 
00358 extern void CHANGE_TOOL(int slot); /* slot is slot number */
00359 
00360 /* It is assumed that each cutting tool in the machine is assigned to a
00361 slot (intended to correspond to a slot number in a tool carousel).
00362 This command results in the tool currently in the spindle (if any)
00363 being returned to its slot, and the tool from the slot designated by
00364 slot_number (if any) being inserted in the spindle.
00365 
00366 If there is no tool in the slot designated by the slot argument, there
00367 will be no tool in the spindle after this command is executed and no
00368 error condition will result in the controller. Similarly, if there is
00369 no tool in the spindle when this command is given, no tool will be
00370 returned to the carousel and no error condition will result in the
00371 controller, whether or not a tool was previously selected in the
00372 program.
00373 
00374 It is expected that when the machine tool controller is initialized,
00375 the designated slot for a tool already in the spindle will be
00376 established. This may be done in any manner deemed fit, including
00377 (for, example) recording that information in a persistent, crash-proof
00378 location so it is always available from the last time the machine was
00379 run, or having the operator enter it. It is expected that the machine
00380 tool controller will remember that information as long as it is
00381 not re-initialized; in particular, it will be remembered between
00382 programs.
00383 
00384 For the purposes of this command, the tool includes the tool holder.
00385 
00386 For machines which can carry out a select_tool command separately from
00387 a change_tool command, the select_tool command must have been given
00388 before the change_tool command, and the value of slot must be the slot
00389 number of the selected tool. */
00390 
00391 extern void SELECT_TOOL(int slot);
00392 
00393 /* Miscellaneous Functions */
00394 
00395 extern void CLAMP_AXIS(CANON_AXIS axis);
00396 
00397 /* Clamp the given axis. If the machining center does not have a clamp
00398 for that axis, this command should result in an error condition in the
00399 controller.
00400 
00401 An attempt to move an axis while it is clamped should result in an
00402 error condition in the controller. */
00403 
00404 extern void COMMENT(char *s);
00405 
00406 /* This function has no physical effect. If commands are being printed or
00407 logged, the comment command is printed or logged, including the string
00408 which is the value of comment_text. This serves to allow formal
00409 comments at specific locations in programs or command files. */
00410 
00411 extern void DISABLE_FEED_OVERRIDE();
00412 extern void ENABLE_FEED_OVERRIDE();
00413 extern void DISABLE_SPEED_OVERRIDE();
00414 extern void ENABLE_SPEED_OVERRIDE();
00415 extern void FLOOD_OFF();
00416 /* Turn flood coolant off. */
00417 extern void FLOOD_ON();
00418 /* Turn flood coolant on. */
00419 
00420 extern void MESSAGE(char *s);
00421 
00422 extern void MIST_OFF();
00423 /* Turn mist coolant off. */
00424 
00425 extern void MIST_ON();
00426 /* Turn mist coolant on. */
00427 
00428 extern void PALLET_SHUTTLE();
00429 
00430 /* If the machining center has a pallet shuttle mechanism (a mechanism
00431 which switches the position of two pallets), this command should cause
00432 that switch to be made. If either or both of the pallets are missing,
00433 this will not result in an error condition in the controller.
00434 
00435 If the machining center does not have a pallet shuttle, this command
00436 should result in an error condition in the controller. */
00437 
00438 extern void TURN_PROBE_OFF();
00439 extern void TURN_PROBE_ON();
00440 
00441 
00442 extern void UNCLAMP_AXIS(CANON_AXIS axis);
00443 
00444 /* Unclamp the given axis. If the machining center does not have a clamp
00445 for that axis, this command should result in an error condition in the
00446 controller. */
00447 
00448 /* NURB Functions */
00449 extern void NURB_KNOT_VECTOR(); /* double knot values, -1.0 signals done */
00450 extern void NURB_CONTROL_POINT(int i, double x, double y, double z, double w );
00451 extern void NURB_FEED(double sStart, double sEnd);
00452 
00453 /* Program Functions */
00454 extern void OPTIONAL_PROGRAM_STOP();
00455 
00456 /* If the machining center has an optional stop switch, and it is on
00457 when this command is read from a program, stop executing the program
00458 at this point, but be prepared to resume with the next line of the
00459 program. If the machining center does not have an optional stop
00460 switch, or commands are being executed with a stop after each one
00461 already (such as when the interpreter is being used with keyboard
00462 input), this command has no effect.
00463 */
00464 
00465 extern void PROGRAM_END();
00466 /* If a program is being read, stop executing the program and be prepared
00467 to accept a new program or to be shut down. */
00468 
00469 extern void PROGRAM_STOP();
00470 /* If this command is read from a program, stop executing the program at
00471 this point, but be prepared to resume with the next line of the
00472 program. If commands are being executed with a stop after each one
00473 already (such as when the interpreter is being used with keyboard
00474 input), this command has no effect. */
00475 
00476 /* returns the current x, y, z origin offsets */
00477 extern CANON_VECTOR GET_PROGRAM_ORIGIN();
00478 
00479 /* returns the current active units */
00480 extern CANON_UNITS GET_LENGTH_UNITS();
00481 
00482 extern CANON_PLANE GET_PLANE();
00483 
00484 /* returns current tool length offset */
00485 extern double GET_TOOL_LENGTH_OFFSET();
00486 
00487 /* Sends error message */
00488 extern void CANON_ERROR(const char *fmt, ...);
00489 
00490 /* Returns the current machine position. This is only valid if the
00491    calling program executes to completion any canonical output commands
00492    that may have been called for. */
00493 extern CANON_POSITION GET_EXTERNAL_POSITION();
00494 
00495 /* Returns the machine position at the probe trip. This is only valid
00496    once the probe command has executed to completion. */
00497 extern CANON_POSITION GET_EXTERNAL_PROBE_POSITION();
00498 
00499 /* Returns the value for any analog non-contact probing. */
00500 extern double GET_EXTERNAL_PROBE_VALUE();
00501 
00502 /* Returns non-zero if the queue is empty */
00503 extern int IS_EXTERNAL_QUEUE_EMPTY();
00504 
00505 /* Returns the CANON_TOOL_TABLE structure associated with the tool
00506    in the given pocket */
00507 extern CANON_TOOL_TABLE GET_EXTERNAL_TOOL_TABLE(int pocket);
00508 
00509 /* Returns the system feed and traverse rates */
00510 extern double GET_EXTERNAL_FEED_RATE();
00511 extern double GET_EXTERNAL_TRAVERSE_RATE();
00512 
00513 /* Returns the system length units, in units / mm */
00514 extern double GET_EXTERNAL_LENGTH_UNITS();
00515 
00516 /* Returns the system angular units, in units / degree */
00517 extern double GET_EXTERNAL_ANGLE_UNITS();
00518 
00519 /* Returns the system values for tool, coolant, pocket, spindle */
00520 extern int GET_EXTERNAL_TOOL();
00521 extern int GET_EXTERNAL_MIST();
00522 extern int GET_EXTERNAL_FLOOD();
00523 extern int GET_EXTERNAL_POCKET();
00524 extern double GET_EXTERNAL_SPEED();
00525 extern CANON_DIRECTION GET_EXTERNAL_SPINDLE();
00526 
00527 /* Returns maximum number of tools */
00528 extern int GET_EXTERNAL_TOOL_MAX();
00529 
00530 /* Updates the internal canonical position with real-world values */
00531 extern void CANON_UPDATE_POSITION();
00532 
00533 #ifdef NEW_INTERPRETER
00534 extern char _parameter_file_name[]; /* in canon.cc */
00535 #define PARAMETER_FILE_NAME_LENGTH 100
00536 #endif
00537 
00538 
00539 
00540 #endif

Generated on Sun Dec 2 15:27:36 2001 for EMC by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001