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

📄 code_notes.lyx

📁 CNC 的开放码,EMC2 V2.2.8版
💻 LYX
📖 第 1 页 / 共 4 页
字号:
The free mode trajectory planner for the joint identified by emcmotCommand->axis is activated, the target position is incremented/decremented by emcmotCommand->offset, and the velocity limit is set to emcmotCommand->vel. The free mode trajectory planner will generate a smooth trapezoidal move from the present position to the target position. The planner can correctly handle changes in the target position that happen while the move is in progress, so multiple JOG_INCR commands can be issued in quick succession. The free mode planner accelerates at the joint accel limit at the beginning of the move, and will decelerate at the joint accel limit to stop at the target position.\layout SubsectionJOG_ABS\layout StandardThe JOG_ABS command initiates an absolute jog on a single joint. An absolute jog is a simple move to a specific location, in joint coordinates. Normally absolute jogs stop when they reach the desired location, however they also stop when they hit a limit, or on an ABORT command.\layout SubsubsectionRequirements\layout StandardThe command handler will silently reject the JOG_ABS command if machine is not in free mode, or if any joint is in motion (GET_MOTION_INPOS_FLAG() == FALSE), or if motion is not enabled. It will also silently ignore the command if the joint is already at or beyond it's limit and the commanded jog would make it worse. \layout SubsubsectionResults\layout StandardThe free mode trajectory planner for the joint identified by emcmotCommand->axis is activated, the target position is set to emcmotCommand->offset, and the velocity limit is set to emcmotCommand->vel. The free mode trajectory planner will generate a smooth trapezoidal move from the present position to the target position. The planner can correctly handle changes in the target position that happen while the move is in progress. If multiple JOG_ABS commands are issued in quick succession, each new command changes the target position and the machine goes to the final commanded position. The free mode planner accelerates at the joint accel limit at the beginning of the move, and will decelerate at the joint accel limit to stop at the target position.\layout SubsectionSET_LINE\layout StandardThe SET_LINE command adds a straight line to the trajectory planner queue.\layout Standard(More later)\layout SubsectionSET_CIRCLE\layout StandardThe SET_CIRCLE command adds a circular move to the trajectory planner queue.\layout Standard(More later)\layout SubsectionSET_TELEOP_VECTOR\layout StandardThe SET_TELEOP_VECTOR command instructs the motion controller to move along a specific vector in Cartesian space.\layout Standard(More later)\layout SubsectionPROBE\layout StandardThe PROBE command instructs the motion controller to move toward a specific point in Carte Sean space, stopping and recording it's position if the probe input is triggered.\layout Standard(More later)\layout SubsectionCLEAR_PROBE_FLAG\layout StandardThe CLEAR_PROBE_FLAG command is used to reset the probe input in preparation for a PROBE command. (Question: why shouldn't the PROBE command automatically reset the input?)\layout Standard(More later)\layout SubsectionSET_xix\layout StandardThere are approximately 15 SET_xxx commands, where xxx is the name of some configuration parameter. It is anticipated that there will be several more SET commands as more parameters are added. I would like to find a cleaner way of setting and reading configuration parameters. The existing methods require many lines of code to be added to multiple files each time a parameter is added. Much of that code is identical or nearly identical for every parameter.\layout Section\begin_inset LatexCommand \label{sec:Homing}\end_inset Homing\layout SubsectionOverview\layout StandardHoming seems simple enough - just move each joint to a known location, and set EMC's internal variables accordingly. However, different machines have different requirements, and homing is actually quite complicated.\layout StandardIn EMC2, homing is done in free mode. The core of the homing algorithm is a state machine contained in the function \begin_inset Quotes eld\end_inset do_homing()\begin_inset Quotes erd\end_inset , which in turn makes use of the free mode trajectory planner. Homing does not use kinematics or the coordinated trajectory planner.\layout SubsectionHoming Sequence\layout StandardFigure \begin_inset LatexCommand \ref{fig:motion-homing-sequence-diagram}\end_inset  shows four possible homing sequences, along with the associated configuration parameters. For a more detailed description of what each configuration parameter does, see the following section.\layout Standard\begin_inset Float figurewide falsecollapsed false\layout Standard\align center \begin_inset Graphics	filename emc2-motion-homing-diag.ps	width 7in	height 9in	keepAspectRatio\end_inset \layout Caption\begin_inset LatexCommand \label{fig:motion-homing-sequence-diagram}\end_inset Homing Sequences\end_inset \layout SubsectionConfiguration\layout StandardThere are six pieces of information that determine exactly how the home sequence behaves. They are stored in the joint structure, and each joint is configured independently.\layout Subsubsectionhome_search_vel\layout Standard'home_search_vel' is a member of the joint structure (as defined in motion.h). The default value is zero. A value of zero causes EMC to assume that there is no home switch. The search and latch stages of homing are skipped, EMC declares the current position to be \begin_inset Quotes eld\end_inset home_offset\begin_inset Quotes erd\end_inset , and does a rapid to \begin_inset Quotes eld\end_inset home\begin_inset Quotes erd\end_inset  if \begin_inset Quotes eld\end_inset home\begin_inset Quotes erd\end_inset  is not equal to \begin_inset Quotes eld\end_inset home_offset\begin_inset Quotes erd\end_inset . \layout StandardIf 'home_search_vel' is non-zero, then EMC assumes that there is a home switch. It begins searching for the home switch by moving in the direction specified by the sign of 'home_search_vel', at a speed determined by its absolute value. When the home switch is detected, the joint will stop as fast as possible, but there will always be some overshoot. The amount of overshoot depends on the speed. If it is too high, the joint might overshoot enough to hit a limit switch or crash into the end of travel. On the other hand, if 'home_search_vel' is too low, homing can take a long time.\layout Subsubsectionhome_latch_vel\layout Standard'home_latch_vel' is also a member of the joint structure. It specifies the speed and direction that EMC uses when it makes its final accurate determination of the home switch and index pulse location. It will usually be slower than the search velocity to maximise accuracy. If search_vel and latch_vel have the same sign, then the latch phase is done while moving in the same direction as the search phase. (In that case, EMC first backs off the switch, before moving towards it again at the latch velocity.) If search_vel and latch_vel have opposite signs, the latch phase is done while moving in the opposite direction from the search phase. That means EMC will latch the first pulse after it moves off the switch. If 'search_vel' is zero, the latch phase is skipped and this parameter is ignored. If 'search_vel' is non-zero and this parameter is zero, it is an error and the homing operation will fail. The default value is zero.\layout Subsubsectionhome_ignore_limits\layout Standard'home_ignore_limits' is a single bit within the joint structure member 'home_flags'. This flag determines whether EMC will ignore the limit switch inputs. Some machine configurations do not use a separate home switch, instead they route one of the limit switch signals to the home switch input as well. In this case, EMC needs to ignore that limit during homing. The default value for this parameter is OFF.\layout Subsubsectionhome_use_index\layout Standard'home_use_index' is a single bit within the joint structure member 'home_flags'. It specifies whether or not there is an index pulse. If the flag is true, EMC will latch on the rising edge of the index pulse. If false, EMC will latch on either the rising or falling edge of the home switch (depending on the signs of search_vel and latch_vel). If 'search_vel' is zero, the latch phase is skipped and this parameter is ignored. The default value is OFF.\layout Subsubsectionhome_offset\layout Standard'home_offset' is a member of the joint structure. It contains the location of the home switch or index pulse, in joint coordinates. It can also be treated as the distance between the point where the switch or index pulse is latched and the zero point of the joint. After detecting the index pulse, EMC sets the joint coordinate of that point to \begin_inset Quotes eld\end_inset home_offset\begin_inset Quotes erd\end_inset . The default value is zero.\layout Subsubsectionhome\layout Standard'home' is a member of the joint structure. It is the position that the joint will go to upon completion of the homing sequence. After detecting the index pulse, and setting the coordinate of that point to \begin_inset Quotes eld\end_inset home_offset\begin_inset Quotes erd\end_inset , EMC makes a move to "home" as the final step of the homing process. The default value is zero. Note that even if this parameter is the same as \begin_inset Quotes eld\end_inset home_offset\begin_inset Quotes erd\end_inset , the axis will slightly overshoot the latched position as it stops. Therefore there will always be a small move at this time (unless search_vel is zero, and the entire search/latch stage was skipped). This final move will be made at the joint's maximum velocity. Since the axis is now homed, there should be no risk of crashing the machine, and a rapid move is the quickest way to finish the homing sequence. \begin_inset Footcollapsed true\layout StandardThe distinction between 'home' and 'home_offset' is not as clear as I would like. I intend to make a small drawing and example to help clarify it.\end_inset \layout Standard\begin_inset ERTstatus Collapsed\layout Standard\backslash clearpage\end_inset \layout SectionBacklash and Screw Error Compensation\layout Chapterlibnml\layout SectionIntroduction\layout Standardlibnml is derived from the NIST rcslib without all the multi-platform support. Many of the wrappers around platform specific code has been removed along with much of the code that is not required by emc2. It is hoped that sufficient compatibility remains with rcslib so that applications can be implemented on non-Linux platforms and still be able to communicate with emc2.\layout StandardThis chapter is not intended to be a definitive guide to using libnml (or rcslib), instead, it will eventually provide an overview of each C++ class and their member functions. Initially, most of these notes will be random comments added as the code scrutinised and modified.\layout SectionLinkedList\layout StandardBase class to maintain a linked list. This is one of the core building blocks used in passing NML messages and assorted internal data structures.\layout SectionLinkedListNode\layout StandardBase class for producing a linked list - Purpose, to hold pointers to the previous and next nodes, pointer to the data, and the size of the data.\layout StandardNo memory for data storage is allocated.\layout SectionSharedMemory\layout StandardProvides a block of shared memory along with a semaphore (inherited from the Semaphore class). Creation and destruction of the semaphore is handled by the SharedMemory constructor and destructor.\layout SectionShmBuffer\layout StandardClass for passing NML messages between local processes using a shared memory buffer. Much of internal workings are inherited from the CMS class.\layout SectionTimer\layout StandardThe Timer class provides a periodic timer limited only by the resolution of the system clock. If, for example, a process needs to be run every 5 seconds regardless of the time taken to run the process, the following code snippet demonstrates how :\layout LyX-Codemain()\layout LyX-Code{\layout LyX-Code    timer = new Timer(5.0);    /* Initialise a timer with a 5 second loop */\layout LyX-Code    while(0) {\layout LyX-Code        /* Do some process */

⌨️ 快捷键说明

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