📄 emc_nml.hh
字号:
#ifndef EMC_NML_HH#define EMC_NML_HH#include "emc.hh"#include "rcs.hh"#include "cmd_msg.hh"#include "stat_msg.hh"#include "emcpos.h"#include "canon.hh" // CANON_TOOL_TABLE, CANON_UNITS#include "rs274ngc.hh" // ACTIVE_G_CODES, etc// ------------------// CLASS DECLARATIONS// ------------------// declarations for EMC general classes/** * Send a textual error message to the operator. * The message is put in the errlog buffer to be read by the GUI. * This allows the controller a generic way to send error messages to * the operator. */class EMC_OPERATOR_ERROR:public RCS_CMD_MSG { public: EMC_OPERATOR_ERROR():RCS_CMD_MSG(EMC_OPERATOR_ERROR_TYPE, sizeof(EMC_OPERATOR_ERROR)) { }; // For internal NML/CMS use only. void update(CMS * cms); int id; char error[LINELEN];};/** * Send a textual information message to the operator. * This is similiar to EMC_OPERATOR_ERROR message except that the messages are * sent in situations not necessarily considered to be errors. */class EMC_OPERATOR_TEXT:public RCS_CMD_MSG { public: EMC_OPERATOR_TEXT():RCS_CMD_MSG(EMC_OPERATOR_TEXT_TYPE, sizeof(EMC_OPERATOR_TEXT)) { }; // For internal NML/CMS use only. void update(CMS * cms); int id; char text[LINELEN];};/** * Send the URL or filename of a document to display. * This message is placed in the errlog buffer to be read by the GUI. * If the GUI is capable of doing so it will show the operator a * previously created document, using the URL or filename provided. * This message is placed in the errlog channel to be read by the GUI. * This provides a general means of reporting an error from within the * controller without having to program the GUI to recognize each error type. */class EMC_OPERATOR_DISPLAY:public RCS_CMD_MSG { public: EMC_OPERATOR_DISPLAY():RCS_CMD_MSG(EMC_OPERATOR_DISPLAY_TYPE, sizeof(EMC_OPERATOR_DISPLAY)) { }; // For internal NML/CMS use only. void update(CMS * cms); int id; char display[LINELEN];};#define EMC_SYSTEM_CMD_LEN 256/* execute a system command*/class EMC_SYSTEM_CMD:public RCS_CMD_MSG { public: EMC_SYSTEM_CMD():RCS_CMD_MSG(EMC_SYSTEM_CMD_TYPE, sizeof(EMC_SYSTEM_CMD)) { }; // For internal NML/CMS use only. void update(CMS * cms); char string[EMC_SYSTEM_CMD_LEN];};class EMC_NULL:public RCS_CMD_MSG { public: EMC_NULL():RCS_CMD_MSG(EMC_NULL_TYPE, sizeof(EMC_NULL)) { }; // For internal NML/CMS use only. void update(CMS * cms);};class EMC_SET_DEBUG:public RCS_CMD_MSG { public: EMC_SET_DEBUG():RCS_CMD_MSG(EMC_SET_DEBUG_TYPE, sizeof(EMC_SET_DEBUG)) { }; // For internal NML/CMS use only. void update(CMS * cms); int debug;};// declarations for EMC_AXIS classes/* * AXIS command base class. * This is the base class for all commands that operate on a single axis. * The axis parameter specifies which axis the command affects. * These commands are sent to the emcCommand buffer to be read by the * TASK program that will then pass along corresponding messages to the * motion system. */class EMC_AXIS_CMD_MSG:public RCS_CMD_MSG { public: EMC_AXIS_CMD_MSG(NMLTYPE t, size_t s):RCS_CMD_MSG(t, s) { }; // For internal NML/CMS use only. void update(CMS * cms); // 0 = X, 1 = Y, 2 = Z, etc. int axis;};/** * Set the axis type to linear or angular. * Similiar to the AXIS_TYPE field in the ".ini" file. */class EMC_AXIS_SET_AXIS:public EMC_AXIS_CMD_MSG { public: EMC_AXIS_SET_AXIS():EMC_AXIS_CMD_MSG(EMC_AXIS_SET_AXIS_TYPE, sizeof(EMC_AXIS_SET_AXIS)) { }; // For internal NML/CMS use only. void update(CMS * cms); // EMC_AXIS_LINEAR, EMC_AXIS_ANGULAR unsigned char axisType;};/** * Set the units conversion factor. * @see EMC_AXIS_SET_INPUT_SCALE */class EMC_AXIS_SET_UNITS:public EMC_AXIS_CMD_MSG { public: EMC_AXIS_SET_UNITS():EMC_AXIS_CMD_MSG(EMC_AXIS_SET_UNITS_TYPE, sizeof(EMC_AXIS_SET_UNITS)) { }; // For internal NML/CMS use only. void update(CMS * cms); // units per mm, deg for linear, angular double units;};/** * Set the Axis backlash. * This command sets the backlash value. */class EMC_AXIS_SET_BACKLASH:public EMC_AXIS_CMD_MSG { public: EMC_AXIS_SET_BACKLASH():EMC_AXIS_CMD_MSG(EMC_AXIS_SET_BACKLASH_TYPE, sizeof(EMC_AXIS_SET_BACKLASH)) { }; // For internal NML/CMS use only. void update(CMS * cms); double backlash;};class EMC_AXIS_SET_MIN_POSITION_LIMIT:public EMC_AXIS_CMD_MSG { public: EMC_AXIS_SET_MIN_POSITION_LIMIT():EMC_AXIS_CMD_MSG (EMC_AXIS_SET_MIN_POSITION_LIMIT_TYPE, sizeof(EMC_AXIS_SET_MIN_POSITION_LIMIT)) { }; // For internal NML/CMS use only. void update(CMS * cms); double limit;};class EMC_AXIS_SET_MAX_POSITION_LIMIT:public EMC_AXIS_CMD_MSG { public: EMC_AXIS_SET_MAX_POSITION_LIMIT():EMC_AXIS_CMD_MSG (EMC_AXIS_SET_MAX_POSITION_LIMIT_TYPE, sizeof(EMC_AXIS_SET_MAX_POSITION_LIMIT)) { }; // For internal NML/CMS use only. void update(CMS * cms); double limit;};class EMC_AXIS_SET_MIN_OUTPUT_LIMIT:public EMC_AXIS_CMD_MSG { public: EMC_AXIS_SET_MIN_OUTPUT_LIMIT():EMC_AXIS_CMD_MSG (EMC_AXIS_SET_MIN_OUTPUT_LIMIT_TYPE, sizeof(EMC_AXIS_SET_MIN_OUTPUT_LIMIT)) { }; // For internal NML/CMS use only. void update(CMS * cms); double limit;};class EMC_AXIS_SET_MAX_OUTPUT_LIMIT:public EMC_AXIS_CMD_MSG { public: EMC_AXIS_SET_MAX_OUTPUT_LIMIT():EMC_AXIS_CMD_MSG (EMC_AXIS_SET_MAX_OUTPUT_LIMIT_TYPE, sizeof(EMC_AXIS_SET_MAX_OUTPUT_LIMIT)) { }; // For internal NML/CMS use only. void update(CMS * cms); double limit;};class EMC_AXIS_SET_FERROR:public EMC_AXIS_CMD_MSG { public: EMC_AXIS_SET_FERROR():EMC_AXIS_CMD_MSG(EMC_AXIS_SET_FERROR_TYPE, sizeof(EMC_AXIS_SET_FERROR)) { }; // For internal NML/CMS use only. void update(CMS * cms); double ferror;};class EMC_AXIS_SET_MIN_FERROR:public EMC_AXIS_CMD_MSG { public: EMC_AXIS_SET_MIN_FERROR():EMC_AXIS_CMD_MSG (EMC_AXIS_SET_MIN_FERROR_TYPE, sizeof(EMC_AXIS_SET_MIN_FERROR)) { }; // For internal NML/CMS use only. void update(CMS * cms); double ferror;};class EMC_AXIS_SET_HOMING_PARAMS:public EMC_AXIS_CMD_MSG { public: EMC_AXIS_SET_HOMING_PARAMS():EMC_AXIS_CMD_MSG (EMC_AXIS_SET_HOMING_PARAMS_TYPE, sizeof(EMC_AXIS_SET_HOMING_PARAMS)) { }; // For internal NML/CMS use only. void update(CMS * cms); double home; double offset; double search_vel; double latch_vel; int use_index; int ignore_limits; int is_shared; int home_sequence;};class EMC_AXIS_SET_MAX_VELOCITY:public EMC_AXIS_CMD_MSG { public: EMC_AXIS_SET_MAX_VELOCITY():EMC_AXIS_CMD_MSG (EMC_AXIS_SET_MAX_VELOCITY_TYPE, sizeof(EMC_AXIS_SET_MAX_VELOCITY)) { }; // For internal NML/CMS use only. void update(CMS * cms); double vel;};class EMC_AXIS_INIT:public EMC_AXIS_CMD_MSG { public: EMC_AXIS_INIT():EMC_AXIS_CMD_MSG(EMC_AXIS_INIT_TYPE, sizeof(EMC_AXIS_INIT)) { }; // For internal NML/CMS use only. void update(CMS * cms);};class EMC_AXIS_HALT:public EMC_AXIS_CMD_MSG { public: EMC_AXIS_HALT():EMC_AXIS_CMD_MSG(EMC_AXIS_HALT_TYPE, sizeof(EMC_AXIS_HALT)) { }; // For internal NML/CMS use only. void update(CMS * cms);};class EMC_AXIS_ABORT:public EMC_AXIS_CMD_MSG { public: EMC_AXIS_ABORT():EMC_AXIS_CMD_MSG(EMC_AXIS_ABORT_TYPE, sizeof(EMC_AXIS_ABORT)) { }; // For internal NML/CMS use only. void update(CMS * cms);};class EMC_AXIS_ENABLE:public EMC_AXIS_CMD_MSG { public: EMC_AXIS_ENABLE():EMC_AXIS_CMD_MSG(EMC_AXIS_ENABLE_TYPE, sizeof(EMC_AXIS_ENABLE)) { }; // For internal NML/CMS use only. void update(CMS * cms);};class EMC_AXIS_DISABLE:public EMC_AXIS_CMD_MSG { public: EMC_AXIS_DISABLE():EMC_AXIS_CMD_MSG(EMC_AXIS_DISABLE_TYPE, sizeof(EMC_AXIS_DISABLE)) { }; // For internal NML/CMS use only. void update(CMS * cms);};class EMC_AXIS_HOME:public EMC_AXIS_CMD_MSG { public: EMC_AXIS_HOME():EMC_AXIS_CMD_MSG(EMC_AXIS_HOME_TYPE, sizeof(EMC_AXIS_HOME)) { }; // For internal NML/CMS use only. void update(CMS * cms);};class EMC_AXIS_JOG:public EMC_AXIS_CMD_MSG { public: EMC_AXIS_JOG():EMC_AXIS_CMD_MSG(EMC_AXIS_JOG_TYPE, sizeof(EMC_AXIS_JOG)) { }; // For internal NML/CMS use only. void update(CMS * cms); double vel;};class EMC_AXIS_INCR_JOG:public EMC_AXIS_CMD_MSG { public: EMC_AXIS_INCR_JOG():EMC_AXIS_CMD_MSG(EMC_AXIS_INCR_JOG_TYPE, sizeof(EMC_AXIS_INCR_JOG)) { }; // For internal NML/CMS use only. void update(CMS * cms); double incr; double vel;};class EMC_AXIS_ABS_JOG:public EMC_AXIS_CMD_MSG { public: EMC_AXIS_ABS_JOG():EMC_AXIS_CMD_MSG(EMC_AXIS_ABS_JOG_TYPE, sizeof(EMC_AXIS_ABS_JOG)) { }; // For internal NML/CMS use only. void update(CMS * cms); double pos; double vel;};class EMC_AXIS_ACTIVATE:public EMC_AXIS_CMD_MSG { public: EMC_AXIS_ACTIVATE():EMC_AXIS_CMD_MSG(EMC_AXIS_ACTIVATE_TYPE, sizeof(EMC_AXIS_ACTIVATE)) { }; // For internal NML/CMS use only. void update(CMS * cms);};class EMC_AXIS_DEACTIVATE:public EMC_AXIS_CMD_MSG { public: EMC_AXIS_DEACTIVATE():EMC_AXIS_CMD_MSG(EMC_AXIS_DEACTIVATE_TYPE, sizeof(EMC_AXIS_DEACTIVATE)) { }; // For internal NML/CMS use only. void update(CMS * cms);};class EMC_AXIS_OVERRIDE_LIMITS:public EMC_AXIS_CMD_MSG { public: EMC_AXIS_OVERRIDE_LIMITS():EMC_AXIS_CMD_MSG (EMC_AXIS_OVERRIDE_LIMITS_TYPE, sizeof(EMC_AXIS_OVERRIDE_LIMITS)) { }; // For internal NML/CMS use only. void update(CMS * cms);};class EMC_AXIS_SET_OUTPUT:public EMC_AXIS_CMD_MSG { public: EMC_AXIS_SET_OUTPUT():EMC_AXIS_CMD_MSG(EMC_AXIS_SET_OUTPUT_TYPE, sizeof(EMC_AXIS_SET_OUTPUT)) { }; // For internal NML/CMS use only. void update(CMS * cms); double output; // value for output, in physical units // (volts)};class EMC_AXIS_LOAD_COMP:public EMC_AXIS_CMD_MSG { public: EMC_AXIS_LOAD_COMP():EMC_AXIS_CMD_MSG(EMC_AXIS_LOAD_COMP_TYPE, sizeof(EMC_AXIS_LOAD_COMP)) { }; // For internal NML/CMS use only. void update(CMS * cms); char file[LINELEN]; int type; // type of the comp file. type==0 means nom, forw, rev triplets // type != 0 means nom, forw_trim, rev_trim triplets};/** * Set the step parameters. * This command sets the setup time of the direction signal, * and the hold time of the step signal. */class EMC_AXIS_SET_STEP_PARAMS:public EMC_AXIS_CMD_MSG { public: EMC_AXIS_SET_STEP_PARAMS():EMC_AXIS_CMD_MSG (EMC_AXIS_SET_STEP_PARAMS_TYPE, sizeof(EMC_AXIS_SET_STEP_PARAMS)) { }; // For internal NML/CMS use only. void update(CMS * cms); double setup_time; double hold_time;};// AXIS status base classclass EMC_AXIS_STAT_MSG:public RCS_STAT_MSG { public: EMC_AXIS_STAT_MSG(NMLTYPE t, size_t s):RCS_STAT_MSG(t, s) { }; // For internal NML/CMS use only. void update(CMS * cms); int axis;};class EMC_AXIS_STAT:public EMC_AXIS_STAT_MSG { public: EMC_AXIS_STAT(); // For internal NML/CMS use only. void update(CMS * cms); // configuration parameters unsigned char axisType; // EMC_AXIS_LINEAR, EMC_AXIS_ANGULAR double units; // units per mm, deg for linear, angular double p; double i; double d; double ff0; double ff1; double ff2; double backlash; double bias; double maxError; double deadband; double cycleTime; double inputScale; double inputOffset; double outputScale; double outputOffset; double minPositionLimit; double maxPositionLimit; double minOutputLimit; double maxOutputLimit; double maxFerror; double minFerror; /*! \todo FIXME - homingVel has been superceded */ double homingVel; double setup_time; double hold_time; double homeOffset; // dynamic status /*! \todo FIXME - is this the position cmd from control to PID, or something else? */ double setpoint; // input to axis controller double ferrorCurrent; // current following error double ferrorHighMark; // magnitude of max following error /*! \todo FIXME - is this really position, or the DAC output? */ double output; // commanded output position double input; // current input position unsigned char inpos; // non-zero means in position unsigned char homing; // non-zero means homing unsigned char homed; // non-zero means has been homed unsigned char fault; // non-zero means axis amp fault unsigned char enabled; // non-zero means enabled unsigned char minSoftLimit; // non-zero means min soft limit exceeded unsigned char maxSoftLimit; // non-zero means max soft limit exceeded unsigned char minHardLimit; // non-zero means min hard limit exceeded unsigned char maxHardLimit; // non-zero means max hard limit exceeded unsigned char overrideLimits; // non-zero means limits are // overridden double scale; // velocity scale};// declarations for EMC_TRAJ classes// EMC_TRAJ command base classclass EMC_TRAJ_CMD_MSG:public RCS_CMD_MSG { public: EMC_TRAJ_CMD_MSG(NMLTYPE t, size_t s):RCS_CMD_MSG(t, s) { }; // For internal NML/CMS use only. void update(CMS * cms);};class EMC_TRAJ_SET_UNITS:public EMC_TRAJ_CMD_MSG { public: EMC_TRAJ_SET_UNITS():EMC_TRAJ_CMD_MSG(EMC_TRAJ_SET_UNITS_TYPE, sizeof(EMC_TRAJ_SET_UNITS)) { }; // For internal NML/CMS use only. void update(CMS * cms); double linearUnits; // units per mm double angularUnits; // units per degree};class EMC_TRAJ_SET_AXES:public EMC_TRAJ_CMD_MSG { public: EMC_TRAJ_SET_AXES():EMC_TRAJ_CMD_MSG(EMC_TRAJ_SET_AXES_TYPE, sizeof(EMC_TRAJ_SET_AXES)) { };
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -