📄 rtcomps.lyx
字号:
\family typewriter \noun on (float)\noun default pid.<loopnum>.FF0\family default -- Zeroth order feedforward - output proportional to command (position).\layout Itemize\family typewriter \noun on (float)\noun default pid.<loopnum>.FF1\family default -- First order feedforward - output proportional to derivative of command (velocity).\layout Itemize\family typewriter \noun on (float)\noun default pid.<loopnum>.FF2\family default -- Second order feedforward - output proportional to 2nd derivative of command (acceleration)\begin_inset Footcollapsed true\layout StandardFF2 is not currently implemented, but it will be added. Consider this note a \begin_inset Quotes eld\end_inset FIXME\begin_inset Quotes erd\end_inset for the code\end_inset .\layout Itemize\family typewriter \noun on (float)\noun default pid.<loopnum>.deadband\family default -- Amount of error that will be ignored \layout Itemize\family typewriter \noun on (float)\noun default pid.<loopnum>.maxerror\family default -- Limit on error \layout Itemize\family typewriter \noun on (float)\noun default pid.<loopnum>.maxerrorI\family default -- Limit on error integrator \layout Itemize\family typewriter \noun on (float)\noun default pid.<loopnum>.maxerrorD\family default -- Limit on error derivative \layout Itemize\family typewriter \noun on (float)\noun default pid.<loopnum>.maxcmdD\family default -- Limit on command derivative \layout Itemize\family typewriter \noun on (float)\noun default pid.<loopnum>.maxcmdDD\family default -- Limit on command 2nd derivative \layout Itemize\family typewriter \noun on (float)\noun default pid.<loopnum>.maxoutput\family default -- Limit on output value\layout StandardAll of the \family typewriter max ???\family default limits are implemented such that if the parameter value is zero, there is no limit.\layout StandardIf \family typewriter debug=1\family default was specified when the component was installed, four additional parameters will be exported:\layout Itemize\family typewriter \noun on (float)\noun default pid.<loopnum>.errorI\family default -- Integral of error.\layout Itemize\family typewriter \noun on (float)\noun default pid.<loopnum>.errorD\family default -- Derivative of error.\layout Itemize\family typewriter \noun on (float)\noun default pid.<loopnum>.commandD\family default -- Derivative of the command.\layout Itemize\family typewriter \noun on (float)\noun default pid.<loopnum>.commandDD\family default -- 2nd derivative of the command. \layout SubsectionFunctions\layout StandardThe component exports one function for each PID loop. This function performs all the calculations needed for the loop. Since each loop has its own function, individual loops can be included in different threads and execute at different rates. \layout Itemize\family typewriter \noun on (funct)\noun default pid.<loopnum>.do_pid_calcs\family default -- Performs all calculations for a single PID loop.\layout StandardIf you want to understand the exact algorithm used to compute the output of the PID loop, refer to figure \begin_inset LatexCommand \ref{fig:PID-block-diag}\end_inset , the comments at the beginning of\family typewriter emc2/src/hal/components/pid.c\family default , and of course to the code itself. The loop calculations are in the C function\family typewriter calc_pid()\family default .\layout Standard\begin_inset ERTstatus Collapsed\layout Standard\backslash clearpage\end_inset \layout Section\begin_inset LatexCommand \label{sec:Simulated-Encoder}\end_inset Simulated Encoder\begin_inset LatexCommand \index{sim-encoder}\end_inset \layout StandardThe simulated encoder is exactly that. It produces quadrature pulses with an index pulse, at a speed controlled by a HAL pin. Mostly useful for testing.\layout SubsectionInstalling\layout LyX-Codeemc2$ \series bold halcmd loadrt sim-encoder num_chan=<number>\layout Standard\family typewriter <number>\family default is the number of encoders that you want to simulate. If not specified, one encoder will be installed. The maximum number is 8 (as defined by MAX_CHAN in sim_encoder.c). \layout SubsectionRemoving\layout LyX-Codeemc2$ \series bold halcmd unloadrt sim-encoder\layout SubsectionPins\layout Itemize\family typewriter \noun on (float) \noun default sim-encoder.<chan-num>.speed\family default -- The speed command for the simulated shaft.\layout Itemize\family typewriter \noun on (bit) \noun default sim-encoder.<chan-num>.phase-A\family default -- Quadrature output.\layout Itemize\family typewriter \noun on (bit) \noun default sim-encoder.<chan-num>.phase-B\family default -- Quadrature output.\layout Itemize\family typewriter \noun on (bit) \noun default sim-encoder.<chan-num>.phase-Z\family default -- Index pulse output. \layout StandardWhen \family typewriter .speed\family default is positive, \family typewriter .phase-A\family default leads \family typewriter .phase-B\family default .\layout SubsectionParameters\layout Itemize\shape smallcaps \noun on (u32)\family typewriter \shape default \noun default sim-encoder.<chan-num>.ppr\family default -- Pulses Per Revolution.\layout Itemize\shape smallcaps \noun on (float)\family typewriter \shape default \noun default sim-encoder.<chan-num>.scale\family default -- Scale Factor for \family typewriter \series bold speed\family default \series default . The default is 1.0, which means that \family typewriter \series bold speed\family default \series default is in revolutions per second. Change to 60 for RPM, to 360 for degrees per second, 6.283185 for radians per seconed, etc.\layout StandardNote that pulses per revolution is not the same as counts per revolution. A pulse is a complete quadrature cycle. Most encoder counters will count four times during one complete cycle.\layout SubsectionFunctions\layout StandardThe component exports two functions. Each function affects all simulated encoders.\layout Itemize\family typewriter \noun on (funct)\noun default sim-encoder.make-pulses\family default -- High speed function to generate quadrature pulses (no floating point).\layout Itemize\family typewriter \noun on (funct)\noun default sim-encoder.update-speed\family default -- Low speed function to read \family typewriter \series bold speed\family default \series default , do scaling, and set up \family typewriter \series bold make-pulses\family default \series default .\layout Standard\begin_inset ERTstatus Collapsed\layout Standard\backslash clearpage\end_inset \layout Section\begin_inset LatexCommand \label{sec:Debounce}\end_inset Debounce\begin_inset LatexCommand \index{debounce}\end_inset \layout StandardDebounce is a realtime component that can filter the glitches created by mechanical switch contacts. It may also be useful in other applications where short pulses are to be rejected.\layout SubsectionInstalling\layout LyX-Codeemc2$ \series bold halcmd loadrt debounce cfg=\begin_inset Quotes erd\end_inset <config-string>\begin_inset Quotes erd\end_inset \layout Standard\family typewriter <config-string>\family default is a series of space separated decimal integers. Each number installs a group of identical debounce filters, the number determines how many filters are in the group. For example:\layout LyX-Codeemc2$ \series bold halcmd loadrt debounce cfg=\begin_inset Quotes erd\end_inset 1 4 2\begin_inset Quotes erd\end_inset \layout Standardwill install three groups of filters. Group 0 contains one filter, group 1 contains four, and group 2 contains two filters. The default value for \family typewriter <config-string>\family default is \family typewriter \begin_inset Quotes eld\end_inset 1\begin_inset Quotes erd\end_inset \family default which will install a single group containing a single filter. The maximum number of groups 8 (as defined by MAX_GROUPS in debounce.c). The maximum number of filters in a group is limited only by shared memory space. Each group is completely independent. All filters in a single group are identical, and they are all updated by the same function at the same time. In the following descriptions, \family typewriter <G>\family default is the group number and \family typewriter <F>\family default is the filter number within the group. The first filter is group 0, filter 0.\layout SubsectionRemoving\layout LyX-Codeemc2$ \series bold halcmd unloadrt debounce\layout SubsectionPins\layout StandardEach individual filter has two pins.\layout Itemize\family typewriter \noun on (bit) \noun default debounce.<G>.<F>.in\family default -- Input of filter \family typewriter <F>\family default in group \family typewriter <G>\family default .\layout Itemize\family typewriter \noun on (bit) \noun default debounce.<G>.<F>.out\family default -- Output of filter \family typewriter <F>\family default in group \family typewriter <G>\family default .\layout SubsectionParameters\layout StandardEach group of filters has one parameter\begin_inset Footcollapsed true\layout StandardEach individual filter also has an internal state variable. There is a compile time switch that can export that variable as a parameter. This is intended for testing, and simply wastes shared memory under normal circumstances.\end_inset . \layout Itemize\family typewriter \noun on (s32) \noun default debounce.<G>.delay\family default -- Filter delay for all filters in group \family typewriter <G>\family default .\layout StandardThe filter delay is in units of thread periods. The minimum delay is zero. The output of a zero delay filter exactly follows its input - it doesn't filter anything. As \family typewriter delay\family default increases, longer and longer glitches are rejected. If \family typewriter delay\family default is 4, all glitches less than or equal to four thread periods will be rejected.\layout SubsectionFunctions\layout StandardEach group of filters has one function, which updates all the filters in that group \begin_inset Quotes eld\end_inset simultaneously\begin_inset Quotes erd\end_inset . Different groups of filters can be updated from different threads at different periods.\layout Itemize\family typewriter \noun on (funct)\noun default debounce.<G>\family default -- Updates all filters in group \family typewriter <G>\family default .\layout Section\begin_inset LatexCommand \label{sec:Siggen}\end_inset Siggen\begin_inset LatexCommand \index{siggen}\end_inset \layout StandardSiggen is a realtime component that generates square, triangle, and sine waves. It is primarily used for testing. \layout SubsectionInstalling\layout LyX-Codeemc2$ \series bold halcmd loadrt siggen [num_chan=<chans>]\layout LyX-Code\layout Standard\family typewriter <chans>\family default is the number of signal generators that you want to install. If \family typewriter numchan\family default is not specified, one signal generator will be installed. The maximum number of generators is 16 (as defined by MAX_CHAN in siggen.c). Each generator is completely independent. In the following descriptions, \family typewriter <chan>\family default is the number of a specific signal generator (the numbers start at 0).\layout SubsectionRemoving\layout LyX-Codeemc2$ \series bold halcmd unloadrt siggen\layout SubsectionPins\layout StandardEach generator has five output pins.\layout Itemize\family typewriter \noun on (float) \noun default siggen.<chan>.sine\family default -- Sine wave output.\layout Itemize\family typewriter \noun on (float) \noun default siggen.<chan>.cosine\family default -- Cosine output.\layout Itemize\family typewriter \noun on (float) \noun default siggen.<chan>.sawtooth\family default -- Sawtooth output.\layout Itemize\family typewriter \noun on (float) \noun default siggen.<chan>.triangle\family default -- Triangle wave output.\layout Itemize\family typewriter \noun on (float) \noun default siggen.<chan>.square\family default -- Square wave output.\layout StandardAll five outputs have the same frequency, amplitude, and offset.\layout StandardIn addition to the output pins, there are three control pins:\layout Itemize\family typewriter \noun on (float) \noun default siggen.<chan>.frequency\family default -- Sets the frequency in Hertz, default value is 1 Hz.\layout Itemize\family typewriter \noun on (float) \noun default siggen.<chan>.amplitude\family default -- Sets the peak amplitude of the output waveforms, default is 1.\layout Itemize\family typewriter \noun on (float) \noun default siggen.<chan>.offset\family default -- Sets DC offset of the output waveforms, default is 0.\layout StandardFor example, if \family typewriter siggen.0.amplitude\family default is 1.0 and \family typewriter siggen.0.offset\family default is 0.0, the outputs will swing from -1.0 to +1.0. If \family typewriter siggen.0.amplitude\family default is 2.5 and \family typewriter siggen.0.offset\family default is 10.0, then the outputs will swing from 7.5 to 12.5.\layout SubsectionParameters\layout StandardNone. \begin_inset Footcollapsed true\layout StandardPrior to version 2.1, frequency, amplitude, and offset were parameters. They were changed to pins to allow control by other components.\end_inset \layout SubsectionFunctions\layout Itemize\family typewriter \noun on (funct)\noun default siggen.<chan>.update\family default -- Calculates new values for all five outputs.\the_end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -