⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 canon.hh

📁 CNC 的开放码,EMC2 V2.2.8版
💻 HH
📖 第 1 页 / 共 3 页
字号:
/********************************************************************* Description: canon.hh**   Derived from a work by Thomas Kramer** Author:* License: GPL Version 2* System: Linux*    * Copyright (c) 2004 All rights reserved.** Last change:* $Revision: 1.27 $* $Author: alex_joni $* $Date: 2007/08/19 10:51:53 $********************************************************************/#ifndef CANON_HH#define CANON_HH#include <stdio.h>		// FILE/*  This is the header file that all applications that use the  canonical commands for three- to nine-axis machining should include.  Three mutually orthogonal (in a right-handed system) X, Y, and Z axes  are always present. In addition, there may be zero to three rotational  axes: A (parallel to the X-axis), B (parallel to the Y-axis), and C  (parallel to the Z-axis). Additionally there may be zero to three linear  axes: U, V and W.  In the functions that use rotational axes, the axis value is that of a  wrapped linear axis, in degrees.  It is assumed in these activities that the spindle tip is always at  some location called the 'current location,' and the controller always  knows where that is. It is also assumed that there is always a  'selected plane' which must be the XY-plane, the YZ-plane, or the  ZX-plane of the machine.*//*  The RS274NGC compiler references canon.hh, and here we switch on the  symbols AA, BB and CC to declare the position structures. The EMC  uses AA, BB and CC, and thus by default will get these. */#ifndef NO_AA#define AA#endif#ifndef NO_BB#define BB#endif#ifndef NO_CC#define CC#endif#define OFF 0#define ON 1typedef int CANON_PLANE;#define CANON_PLANE_XY 1#define CANON_PLANE_YZ 2#define CANON_PLANE_XZ 3typedef int CANON_UNITS;#define CANON_UNITS_INCHES 1#define CANON_UNITS_MM 2#define CANON_UNITS_CM 3typedef int CANON_MOTION_MODE;#define CANON_EXACT_STOP 1#define CANON_EXACT_PATH 2#define CANON_CONTINUOUS 3typedef int CANON_SPEED_FEED_MODE;#define CANON_SYNCHED 1#define CANON_INDEPENDENT 2typedef int CANON_DIRECTION;#define CANON_STOPPED 1#define CANON_CLOCKWISE 2#define CANON_COUNTERCLOCKWISE 3typedef int CANON_FEED_REFERENCE;#define CANON_WORKPIECE 1#define CANON_XYZ 2typedef int CANON_SIDE;#define CANON_SIDE_RIGHT 1#define CANON_SIDE_LEFT 2#define CANON_SIDE_OFF 3typedef int CANON_AXIS;#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/* Currently using the typedefs above rather than the enums belowtypedef enum {CANON_PLANE_XY, CANON_PLANE_YZ, CANON_PLANE_XZ} CANON_PLANE;typedef enum {CANON_UNITS_INCHES, CANON_UNITS_MM, CANON_UNITS_CM} CANON_UNITS;typedef enum {CANON_EXACT_STOP, CANON_EXACT_PATH, CANON_CONTINUOUS}             CANON_MOTION_MODE;typedef enum {CANON_SYNCHED, CANON_INDEPENDENT} CANON_SPEED_FEED_MODE;typedef enum {CANON_STOPPED, CANON_CLOCKWISE, CANON_COUNTERCLOCKWISE}             CANON_DIRECTION;typedef enum {CANON_WORKPIECE, CANON_XYZ} CANON_FEED_REFERENCE;typedef enum {CANON_SIDE_RIGHT, CANON_SIDE_LEFT, CANON_SIDE_OFF} CANON_SIDE;typedef enum {CANON_AXIS_X, CANON_AXIS_Y, CANON_AXIS_Z, CANON_AXIS_A,              CANON_AXIS_B, CANON_AXIS_C} CANON_AXIS;*/struct CANON_VECTOR {    CANON_VECTOR() {    } CANON_VECTOR(double _x, double _y, double _z) {	x = _x;	y = _y;	z = _z;    }    double x, y, z;};struct CANON_POSITION {    CANON_POSITION() {    }     CANON_POSITION(double _x, double _y, double _z,                   double _a, double _b, double _c,                   double _u, double _v, double _w) {	x = _x;	y = _y;	z = _z;	a = _a;	b = _b;	c = _c;        u = _u;        v = _v;        w = _w;    }    bool operator==(const CANON_POSITION &o) const {        return(x == o.x && y == o.y && z == o.z &&               a == o.a && b == o.b && c == o.c &&               u == o.u && v == o.v && w == o.v);    }    bool operator!=(const CANON_POSITION &o) const {        return(x != o.x || y != o.y || z != o.z ||               a != o.a || b != o.b || c != o.c ||               u != o.u || v != o.v || w != o.v);    }    double x, y, z, a, b, c, u, v, w;};/* Tools are numbered 1..CANON_TOOL_MAX, with tool 0 meaning no tool. */#define CANON_TOOL_MAX 56	// max size of carousel handled#define CANON_TOOL_ENTRY_LEN 256	// how long each file line can bestruct CANON_TOOL_TABLE {    int id;    double xoffset;    double zoffset;    double diameter;    double frontangle;    double backangle;    int orientation;};/* Initialization *//* reads world model data into the canonical interface */extern void INIT_CANON();/* Representation */extern void SET_ORIGIN_OFFSETS(double x, double y, double z,                               double a, double b, double c,                               double u, double v, double w);/* Offset the origin to the point with absolute coordinates x, y, z,a, b, and c. Values of x, y, z, a, b, and c are real numbers. The unitsare whatever length units are being used at the time this command isgiven. */extern void CANON_UPDATE_END_POINT(double x, double y, double z, 				   double a, double b, double c,				   double u, double v, double w);/* Called from emctask to update the canon position during skipping through   programs started with start-from-line > 0. */extern void USE_LENGTH_UNITS(CANON_UNITS u);/* Use the specified units for length. Conceptually, the units mustbe either inches or millimeters. */extern void SELECT_PLANE(CANON_PLANE pl);/* Use the plane designated by selected_plane as the selected plane.Conceptually, the selected_plane must be the XY-plane, the XZ-plane, orthe YZ-plane. *//* Free Space Motion */extern void SET_TRAVERSE_RATE(double rate);/* Set the traverse rate that will be used when the spindle traverses. Itis expected that no cutting will occur while a traverse move is beingmade. */extern void STRAIGHT_TRAVERSE(double x, double y, double z,			      double a, double b, double c,                              double u, double v, double w);/*Move at traverse rate so that at any time during the move, all axeshave covered the same proportion of their required motion. The finalXYZ position is given by x, y, and z. If there is an a-axis, its finalposition is given by a_position, and similarly for the b-axis and c-axis.A more positive value of a rotational axis is in the counterclockwisedirection.Clockwise or counterclockwise is from the point of view of theworkpiece. If the workpiece is fastened to a turntable, the turntablewill turn clockwise (from the point of view of the machinist or anyoneelse not moving with respect to the machining center) in order to makethe tool move counterclockwise from the point of view of theworkpiece.*//* Machining Attributes */extern void SET_FEED_RATE(double rate);/*SET_FEED_RATE sets the feed rate that will be used when the spindle istold to move at the currently set feed rate. The rate is either:1. the rate of motion of the tool tip in the workpiece coordinate system,   which is used when the feed_reference mode is "CANON_WORKPIECE", or2. the rate of motion of the tool tip in the XYZ axis system, ignoring   motion of other axes, which is used when the feed_reference mode is   "CANON_XYZ".The units of the rate are:1. If the feed_reference mode is CANON_WORKPIECE:length units (inches or millimeters according to the setting ofCANON_UNITS) per minute along the programmed path as seen by theworkpiece.2. If the feed_reference mode is CANON_XYZ:A. For motion including one rotational axis only: degrees per minute.B. For motion including two rotational axes only: degrees per minute   In this case, the rate applies to the axis with the larger angle   to cover, and the second rotational axis rotates so that it has   always completed the same proportion of its required motion as has   the rotational axis to which the feed rate applies.C. For motion involving one or more of the XYZ axes (with or without   simultaneous rotational axis motion): length units (inches or   millimeters according to the setting of CANON_UNITS) per minute   along the programmed XYZ path.*/extern void SET_FEED_REFERENCE(CANON_FEED_REFERENCE reference);/*This sets the feed_reference mode to either CANON_WORKPIECE orCANON_XYZ.The CANON_WORKPIECE mode is more natural and general, since the rateat which the tool passes through the material must be controlled forsafe and effective machining. For machines with more than the threestandard XYZ axes, however, computing the feed rate may betime-consuming because the trajectories that result from motion infour or more axes may be complex. Computation of path lengths whenonly XYZ motion is considered is quite simple for the two standardmotion types (straight lines and helical arcs).Some programming languages (rs274kt, in particular) use CANON_XYZmode. In these languages, the task of dealing with the rate at whichthe tool tip passes through material is pushed back on the NC-programgenerator, where the computation of path lengths is (almost always in1995) an off-line activity where speed of calculation is not critical.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -