home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Between Heaven & Hell 2
/
BetweenHeavenHell.cdr
/
500
/
470
/
rccl079
< prev
next >
Wrap
Text File
|
1987-03-02
|
4KB
|
57 lines
Dir : rtc
The files of this directory make up the
Real time channel interface
The central file 'pack.c'. The 'control' function make a simple user's
interface for specifying interrupt functions. It opens the specialized
device driver, perform some initializations and suspend program execution
until the first interrupt is received. It also cause the function
'release' to be executed upon occurence of the signal SIGINT. The user's
functions are encapsulated by the two internal functions 'onintr1' and
'onintr2', 'onintr1' gets the data from the control and perform the
checkings : at exercise time, it makes sure that the channel works; then it
sends the calibration data; the rest of the time, it looks at the buffer's
check-sum, the observed arm velocity and the motor currents; If an error
condition occurs , it will set the global flag 'terminate' to a code and
the function 'pack' will stop the arm. If everything is ok, it checks that
the arm power in on, if not it returns from interrupt. Next buffer coming
with power on will resume normal execution. When all the conditions are
met it calls the user's function 'fn1' and the 'pack' function. The 'pack'
function look into the 'chg' structure that contains entries for each
possible commands combination. Command may have been requested during
'fn1' execution or during 'fn2' execution in previous sample time. The
'pack' function then translates the requests into a command buffer after
having made sure of it's validity. At the end of 'onintr1' execution
commands are put in fifo and 'onintr2' is executed unless the power was
off. The 'pack' function systematically tests the flag 'terminate', if set
it will send nothing but a END command. The function 'release', called at
non interrupt level, sets the flag 'terminate', prints its argument and
what is pointed to by the variable 'mess', and closes the channel. If it
was called on signal SIGINT, it prints '** Interrupted', asks the user if
an automatic home return is desired, if not the process is exited.
The automatic home return uses "control - release" internally. It moves
each joint at constant acceleration until there are half way of the home
position an then changes the sign of the acceleration. Once the joints are
next to the home position, the calibration encoder values are send for a
short while. Arm monitoring checking are turned off during this procedure
since the arm may need to be taken off a limit condition.
The manual mode allows the user to move each joint individually at startup
to bring the arm next to its home position and to request a calibration.
The user's tty is put in cbreak mode for unbuffered io. Typing a char
moves a joint of one step. The magnitude and the sign of the steps can be
changed. The manual mode also make sure to reset the counters when they
wrap around from (2 to 16th -1) to 0 or vice versa.
The second important file is 'cvae.c' that contains all the unit
conversions. The conversion functions have test programs (tcv1 tc2 tcv3).
When it comes to convert currents to torques and vice versa, it uses
Coulomb's linear approximation of the friction effects. These last
functions do not work when the velocity is zero. 'Tortoadc' returns a
average value of the velocity positive and negatives terms when the
velocity is seen to be zero. This helps to reduce the hard point when
changing velocity sign. 'Adctotor', after several experiments,does not do
such an adjustment because it was causing erroneous results. We got
arround that by ignoring the results when the velocity is small.