home *** CD-ROM | disk | FTP | other *** search
/ Between Heaven & Hell 2 / BetweenHeavenHell.cdr / 500 / 470 / rccl079 < prev    next >
Text File  |  1987-03-02  |  4KB  |  57 lines

  1. Dir : rtc
  2.                   The files of this directory make up the
  3.                         Real time channel interface
  4.  
  5. The central file 'pack.c'.  The 'control' function  make  a  simple  user's
  6. interface  for  specifying  interrupt  functions.  It opens the specialized
  7. device driver, perform some initializations and suspend  program  execution
  8. until  the  first  interrupt  is  received.  It  also  cause  the  function
  9. 'release' to be executed upon occurence of the  signal SIGINT.  The  user's
  10. functions  are  encapsulated  by  the  two internal functions 'onintr1' and
  11. 'onintr2', 'onintr1' gets  the  data  from  the  control  and  perform  the
  12. checkings : at exercise time, it makes sure that the channel works; then it
  13. sends the calibration data; the rest of the time, it looks at the  buffer's
  14. check-sum,  the  observed  arm velocity and the motor currents; If an error
  15. condition occurs , it will set the global flag 'terminate' to  a  code  and
  16. the function 'pack' will stop the arm.  If everything is ok, it checks that
  17. the arm power in on, if not it returns from interrupt.  Next buffer  coming
  18. with  power  on  will resume normal execution.  When all the conditions are
  19. met it calls the user's function 'fn1' and the 'pack' function.  The 'pack'
  20. function  look  into  the  'chg'  structure  that contains entries for each
  21. possible commands combination.  Command  may  have  been  requested  during
  22. 'fn1'  execution  or  during  'fn2' execution in previous sample time.  The
  23. 'pack' function then translates the requests into a  command  buffer  after
  24. having  made  sure  of  it's  validity.  At  the end of 'onintr1' execution
  25. commands are put in fifo and 'onintr2' is executed unless   the  power  was
  26. off. The  'pack' function systematically tests the flag 'terminate', if set
  27. it will send nothing but a END command.  The function 'release', called  at
  28. non  interrupt  level,  sets  the flag 'terminate', prints its argument and
  29. what is pointed to by the variable 'mess', and closes the  channel.  If  it
  30. was  called  on signal SIGINT, it prints '** Interrupted', asks the user if
  31. an automatic home return is desired, if not the process is exited.
  32.  
  33. The automatic home return uses "control -  release"  internally.  It  moves
  34. each  joint  at  constant acceleration until there are half way of the home
  35. position an then changes the sign of the acceleration.  Once the joints are
  36. next  to  the  home position, the calibration encoder values are send for a
  37. short while.  Arm monitoring checking are turned off during this  procedure
  38. since the arm may need to be taken off a limit condition.
  39.  
  40. The manual mode allows the user to move each joint individually at  startup
  41. to  bring  the  arm next to its home position and to request a calibration.
  42. The user's tty is put in cbreak mode  for  unbuffered  io.  Typing  a  char
  43. moves  a joint of one step.  The magnitude and the sign of the steps can be
  44. changed.  The manual mode also make sure to reset the  counters  when  they
  45. wrap around from (2 to 16th -1) to 0 or vice versa.
  46.  
  47. The  second  important  file  is  'cvae.c'  that  contains  all  the   unit
  48. conversions.  The  conversion functions have test programs (tcv1 tc2 tcv3).
  49. When it comes to convert currents  to  torques  and  vice  versa,  it  uses
  50. Coulomb's  linear  approximation  of  the  friction  effects.   These  last
  51. functions do not work when the  velocity  is  zero.  'Tortoadc'  returns  a
  52. average  value  of  the  velocity  positive  and  negatives  terms when the
  53. velocity is seen to be zero.  This helps to  reduce  the  hard  point  when
  54. changing  velocity  sign. 'Adctotor', after several experiments,does not do
  55. such an adjustment  because  it  was  causing  erroneous  results.  We  got
  56. arround that by ignoring the results when the velocity is small.
  57.