📄 emc.hh
字号:
extern int emcTrajSetMaxVelocity(double vel);extern int emcTrajSetMaxAcceleration(double acc);extern int emcTrajSetScale(double scale);extern int emcTrajSetMotionId(int id);extern int emcTrajInit();extern int emcTrajHalt();extern int emcTrajEnable();extern int emcTrajDisable();extern int emcTrajAbort();extern int emcTrajPause();extern int emcTrajStep();extern int emcTrajResume();extern int emcTrajDelay(double delay);extern int emcTrajLinearMove(EmcPose end, int type);extern int emcTrajCircularMove(EmcPose end, PM_CARTESIAN center, PM_CARTESIAN normal, int turn, int type);extern int emcTrajSetTermCond(int cond, double tolerance);extern int emcTrajSetSpindleSync(double spindlesync);extern int emcTrajSetOffset(EmcPose offset);extern int emcTrajSetOrigin(EmcPose origin);extern int emcTrajSetHome(EmcPose home);extern int emcTrajSetProbeIndex(int index);extern int emcTrajSetProbePolarity(int polarity);extern int emcTrajClearProbeTrippedFlag();extern int emcTrajProbe(EmcPose pos);class EMC_TRAJ_STAT; // forward declextern int emcTrajUpdate(EMC_TRAJ_STAT * stat);// implementation functions for EMC_MOTION aggregate typesextern int emcMotionInit();extern int emcMotionHalt();extern int emcMotionAbort();extern int emcMotionSetDebug(int debug);extern int emcMotionSetAout(unsigned char index, double start, double end, unsigned char now);extern int emcMotionSetDout(unsigned char index, unsigned char start, unsigned char end, unsigned char now);class EMC_MOTION_STAT; // forward declextern int emcMotionUpdate(EMC_MOTION_STAT * stat);// implementation functions for EMC_TASK typesextern int emcTaskInit();extern int emcTaskHalt();extern int emcTaskAbort();extern int emcTaskSetMode(int mode);extern int emcTaskSetState(int state);extern int emcTaskPlanInit();extern int emcTaskPlanSetWait();extern int emcTaskPlanIsWait();extern int emcTaskPlanClearWait();extern int emcTaskPlanSynch();extern int emcTaskPlanExit();extern int emcTaskPlanOpen(const char *file);extern int emcTaskPlanRead();extern int emcTaskPlanRun(int line);extern int emcTaskPlanExecute(const char *command);extern int emcTaskPlanPause();extern int emcTaskPlanResume();extern int emcTaskPlanClose();extern int emcTaskPlanLine();extern int emcTaskPlanCommand(char *cmd);class EMC_TASK_STAT; // forward declextern int emcTaskUpdate(EMC_TASK_STAT * stat);// implementation functions for EMC_TOOL typesextern int emcToolInit();extern int emcToolHalt();extern int emcToolAbort();extern int emcToolPrepare(int tool);extern int emcToolLoad();extern int emcToolUnload();extern int emcToolLoadToolTable(const char *file);extern int emcToolSetOffset(int tool, double length, double diameter);extern int emcToolSetToolTableFile(const char *file);class EMC_TOOL_STAT; // forward declextern int emcToolUpdate(EMC_TOOL_STAT * stat);// implementation functions for EMC_AUX typesextern int emcAuxInit();extern int emcAuxHalt();extern int emcAuxAbort();extern int emcAuxDioWrite(int index, int value);extern int emcAuxAioWrite(int index, double value);extern int emcAuxEstopOn();extern int emcAuxEstopOff();extern int emcAuxEstopReset();extern int emcAuxEstopSetSenseIndex(int index);extern int emcAuxEstopSetWriteIndex(int index);extern int emcAuxEstopSetSensePolarity(int polarity);extern int emcAuxEstopSetWritePolarity(int polarity);class EMC_AUX_STAT; // forward declextern int emcAuxUpdate(EMC_AUX_STAT * stat);// implementation functions for EMC_SPINDLE typesextern int emcSpindleInit();extern int emcSpindleHalt();extern int emcSpindleAbort();extern int emcSpindleOn(double speed);extern int emcSpindleOff();extern int emcSpindleForward();extern int emcSpindleReverse();extern int emcSpindleStop();extern int emcSpindleIncrease();extern int emcSpindleDecrease();extern int emcSpindleConstant();extern int emcSpindleBrakeRelease();extern int emcSpindleBrakeEngage();extern int emcSpindleEnable();extern int emcSpindleDisable();extern int emcSpindleSetForwardIndex(int index);extern int emcSpindleSetReverseIndex(int index);extern int emcSpindleSetDecreaseIndex(int index);extern int emcSpindleSetIncreaseIndex(int index);extern int emcSpindleSetBrakeIndex(int index);extern int emcSpindleSetEnableIndex(int index);extern int emcSpindleSetOnIndex(int index);extern int emcMinVoltsPerRpm(double volts);extern int emcMaxVoltsPerRpm(double volts);extern int emcSpindleSetForwardPolarity(int polarity);extern int emcSpindleSetReversePolarity(int polarity);extern int emcSpindleSetDecreasePolarity(int polarity);extern int emcSpindleSetIncreasePolarity(int polarity);extern int emcSpindleSetBrakePolarity(int polarity);extern int emcSpindleSetEnablePolarity(int polarity);extern int emcSpindleSetOffWait(double wait);extern int emcSpindleSetOnWait(double wait);class EMC_SPINDLE_STAT; // forward declextern int emcSpindleUpdate(EMC_SPINDLE_STAT * stat);// implementation functions for EMC_COOLANT typesextern int emcCoolantInit();extern int emcCoolantHalt();extern int emcCoolantAbort();extern int emcCoolantMistOn();extern int emcCoolantMistOff();extern int emcCoolantFloodOn();extern int emcCoolantFloodOff();extern int emcCoolantSetMistIndex(int index);extern int emcCoolantSetFloodIndex(int index);extern int emcCoolantSetMistPolarity(int polarity);extern int emcCoolantSetFloodPolarity(int polarity);class EMC_COOLANT_STAT; // forward declextern int emcCoolantUpdate(EMC_COOLANT_STAT * stat);// implementation functions for EMC_LUBE typesextern int emcLubeInit();extern int emcLubeHalt();extern int emcLubeAbort();extern int emcLubeOn();extern int emcLubeOff();extern int emcLubeSetSenseIndex(int index);extern int emcLubeSetSensePolarity(int polarity);extern int emcLubeSetWriteIndex(int index);extern int emcLubeSetWritePolarity(int polarity);class EMC_LUBE_STAT; // forward declextern int emcLubeUpdate(EMC_LUBE_STAT * stat);// implementation functions for EMC_IO typesextern int emcIoInit();extern int emcIoHalt();extern int emcIoAbort();extern int emcIoSetCycleTime(double cycleTime);extern int emcIoSetDebug(int debug);class EMC_IO_STAT; // forward declextern int emcIoUpdate(EMC_IO_STAT * stat);// implementation functions for EMC aggregate typesextern int emcInit();extern int emcHalt();extern int emcAbort();class EMC_STAT; // forward declextern int emcUpdate(EMC_STAT * stat);// ------------------// 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;};// values for EMC_AXIS_SET_AXIS, axisType#define EMC_AXIS_LINEAR 1#define EMC_AXIS_ANGULAR 2/** * 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 PID gains. * This command sets the PID gains as well as a few other parameters used * by the PID compensator. */class EMC_AXIS_SET_GAINS:public EMC_AXIS_CMD_MSG { public: EMC_AXIS_SET_GAINS():EMC_AXIS_CMD_MSG(EMC_AXIS_SET_GAINS_TYPE, sizeof(EMC_AXIS_SET_GAINS)) { }; // For internal NML/CMS use only. void update(CMS * cms); double p; double i; double d; double ff0; double ff1; double ff2; double bias; double maxError; double deadband;};/** * 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;};/** * Set the cycle time for the servo task. * Increase this value to get more CPU time for running low-priority tasks, * decrease it to get more precise control of the motion. * There is only one cycle time that applies to all axis, so you might as well * set the axis parameter to zero. */class EMC_AXIS_SET_CYCLE_TIME:public EMC_AXIS_CMD_MSG { public: EMC_AXIS_SET_CYCLE_TIME():EMC_AXIS_CMD_MSG (EMC_AXIS_SET_CYCLE_TIME_TYPE, sizeof(EMC_AXIS_SET_CYCLE_TIME)) { }; // For internal NML/CMS use only. void update(CMS * cms); // PERIOD in seconds, between repeating the low level servo calculations. double cycleTime;};/** * Change the scale factor and offset for the position input. * This command sets the same value as the INPUT_SCALE parameter in the ".ini" * file. * These two values are the scale and offset factors for the axis input from * the raw feedback device, e.g., an incremental encoder. The second value * (offset) is subtracted from raw input (e.g., encoder counts), and * divided by the first value (scale factor), before being used as feedback. * The units on the scale value are in raw units (e.g., counts) per user units * (e.g., inch). The units on the offset value are in raw units(e.g., counts). * * Specifically, when reading inputs, the EMC first reads the raw sensor * values. The units on these values are the sensor units, typically * A/D counts, or encoder ticks. These units, and the location of their 0 * value, will not in general correspond to the quasi-SI units used in the EMC. * Hence a scaling is done immediately upon sampling: * * input = (raw - offset) / scale * * The value for scale can be obtained analytically by doing a unit analysis, * i.e., units are [sensor units]/[desired input SI units]. For example, on
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -