- Adding first working version of new AMOR settings module

- Improved sls magnet driver
This commit is contained in:
koennecke
2005-10-05 07:36:37 +00:00
parent c7280ec25d
commit 544dd37279
21 changed files with 2521 additions and 12 deletions

175
tabledrive.tex Normal file
View File

@ -0,0 +1,175 @@
\subsection{Tabled Driving}
This object implements driving several motors along a predefined path. The definition
of the path happens through a table. Positions between tabulated positions are
interpolated by linear interpolation. Additionally, each motor may be driven a
bit from the tabulated positions for fine adjustments. Of course the limits are
variable from position to position. Thus this object also sets the software limits of the
motors accordingly. This object assumes that motors can be driven between positions
without watching for collisions. The original use of this module is to coordinate the
movements of the MARS triffids or girafs.
The table lives in a separate file. The format of the file is very simple:
Each block starts with a line containing:
\begin{verbatim}
# motorname
\end{verbatim}
This is a hash and the name of the motor.
These lines are followed by n lines of:
\begin{verbatim}
lower position upper
\end{verbatim}
These are three numbers giving the lower and upper limit for this position in the table
and, as the middle value, the target position for this entry.
In order to achieve all this, we need a data structure per table entry:
\begin{flushleft} \small
\begin{minipage}{\linewidth} \label{scrap1}
$\langle$tdentry {\footnotesize ?}$\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@typedef struct{@\\
\mbox{}\verb@ double lower, position, upper;@\\
\mbox{}\verb@ int tablePos;@\\
\mbox{}\verb@ }tdEntry, *ptdEntry;@\\
\mbox{}\verb@ @$\diamond$
\end{list}
\vspace{-1ex}
\footnotesize\addtolength{\baselineskip}{-1ex}
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item Macro referenced in scrap ?.
\end{list}
\end{minipage}\\[4ex]
\end{flushleft}
The fields are the lower and upper limits, the position for this table entry and the
number of the entry.
For each motor we need another data structure:
\begin{flushleft} \small
\begin{minipage}{\linewidth} \label{scrap2}
$\langle$tdmotor {\footnotesize ?}$\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@typedef struct {@\\
\mbox{}\verb@ char motorName[132];@\\
\mbox{}\verb@ int table;@\\
\mbox{}\verb@ pMotor pMot;@\\
\mbox{}\verb@ }tdMotor, *ptdMotor; @\\
\mbox{}\verb@@$\diamond$
\end{list}
\vspace{-1ex}
\footnotesize\addtolength{\baselineskip}{-1ex}
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item Macro referenced in scrap ?.
\end{list}
\end{minipage}\\[4ex]
\end{flushleft}
The fields:
\begin{description}
\item[motorName] The name of the motor
\item[table] A list of tabulated positions in the form of tdEntry
\item[pMot] A pointer to the motor data structure.
\end{description}
The tabledrive object itself needs a data structure too:
\begin{flushleft} \small
\begin{minipage}{\linewidth} \label{scrap3}
$\langle$tdobj {\footnotesize ?}$\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@typedef struct{@\\
\mbox{}\verb@ pObjectDescriptor pDes;@\\
\mbox{}\verb@ pIDrivable pDriv;@\\
\mbox{}\verb@ int motorTable;@\\
\mbox{}\verb@ int tableLength;@\\
\mbox{}\verb@ float targetPosition;@\\
\mbox{}\verb@ float currentPosition;@\\
\mbox{}\verb@ int state;@\\
\mbox{}\verb@ char orientMotor[80];@\\
\mbox{}\verb@ int debug;@\\
\mbox{}\verb@ }TableDrive, *pTableDrive;@\\
\mbox{}\verb@@$\diamond$
\end{list}
\vspace{-1ex}
\footnotesize\addtolength{\baselineskip}{-1ex}
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item Macro referenced in scrap ?.
\end{list}
\end{minipage}\\[4ex]
\end{flushleft}
The fields:
\begin{description}
\item[pDes] The standard SICS object descriptor
\item[pDriv] The drivable interface which encapsulates most of the magic of this module.
\item[motorTable] A list of tdMotor entries.
\item[tableLength] The length of the path of positions.
\item[targetPosition] The target position we have to drive to.
\item[currentPosition] where we are now.
\item[state] A state variable used during driving the path.
\item[orientMotor] is the name of the orienting motor, i.e. the one used to determine
the position.
\end{description}
In terms of an interface, this object implements the drivable interface which has to
deal with most of the work. There is just an interpreter interface which allows to
configure and query the object.
\begin{flushleft} \small
\begin{minipage}{\linewidth} \label{scrap4}
$\langle$tdint {\footnotesize ?}$\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@int TableDriveFactory(SConnection *pCon, SicsInterp *pSics, void *pData,@\\
\mbox{}\verb@ int argc, char *argv[]);@\\
\mbox{}\verb@int TableDriveAction(SConnection *pCon, SicsInterp *pSics, void *pData,@\\
\mbox{}\verb@ int argc, char *argv[]);@\\
\mbox{}\verb@ @\\
\mbox{}\verb@ @$\diamond$
\end{list}
\vspace{-1ex}
\footnotesize\addtolength{\baselineskip}{-1ex}
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item Macro referenced in scrap ?.
\end{list}
\end{minipage}\\[4ex]
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth} \label{scrap5}
\verb@"tabledrive.h"@ {\footnotesize ? }$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@ /*---------------------------------------------------------------------------@\\
\mbox{}\verb@ SICS object for driving a couple of motors along a tabulated given path.@\\
\mbox{}\verb@@\\
\mbox{}\verb@ copyright: see file COPYRIGHT@\\
\mbox{}\verb@@\\
\mbox{}\verb@ Mark Koennecke, July 2005@\\
\mbox{}\verb@---------------------------------------------------------------------------*/@\\
\mbox{}\verb@#ifndef SICSTABLEDRIVE@\\
\mbox{}\verb@#define SICSTABLEDRIVE@\\
\mbox{}\verb@#include <sics.h>@\\
\mbox{}\verb@#include "../motor.h"@\\
\mbox{}\verb@/*-------------------------------------------------------------------------*/@\\
\mbox{}\verb@@$\langle$tdentry {\footnotesize ?}$\rangle$\verb@@\\
\mbox{}\verb@/*-------------------------------------------------------------------------*/@\\
\mbox{}\verb@@$\langle$tdmotor {\footnotesize ?}$\rangle$\verb@@\\
\mbox{}\verb@/*-------------------------------------------------------------------------*/@\\
\mbox{}\verb@@$\langle$tdobj {\footnotesize ?}$\rangle$\verb@@\\
\mbox{}\verb@/*-------------------------------------------------------------------------*/@\\
\mbox{}\verb@@$\langle$tdint {\footnotesize ?}$\rangle$\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@#endif@\\
\mbox{}\verb@@\\
\mbox{}\verb@ @$\diamond$
\end{list}
\vspace{-2ex}
\end{minipage}\\[4ex]
\end{flushleft}