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

  1. /*
  2.  * RCCL Version 1.0           Author :  Vincent Hayward
  3.  *                                      School of Electrical Engineering
  4.  *                                      Purdue University
  5.  *      Dir     : src
  6.  *      File    : shared.c
  7.  *      Remarks : No code, only the global variables.
  8.  *      Usage   : part of the library
  9.  */
  10.  
  11. /*LINTLIBRARY*/
  12.  
  13. #include "../h/which.h"
  14. #include "../h/switch.h"
  15. #include "../h/rccl.h"
  16. #include "../h/manip.h"
  17. #include "../h/kine.h"
  18. #include "../h/bio.h"
  19.  
  20. #define TIMEINC 28        /* default */
  21.  
  22. #ifndef REAL
  23. /*
  24.  *      option switches
  25.  */
  26.  
  27.     OPSW    opsw_n = {
  28.             NO,             /* graphics             */
  29.             NO,             /* numerics             */
  30.             NO,             /* angles               */
  31.             NO,             /* t6butnotj6           */
  32.             NO              /* encoders             */
  33.         };
  34.  
  35.     FILE    *fpo = stderr;          /* output file option -d */
  36.  
  37. /*
  38.  *      buffered io buffers for options -g -e
  39.  */
  40.  
  41.     BIO     iobf_n[NBUF] = {
  42.             {1, NULL}, {1, NULL}, {1, NULL},
  43.             {1, NULL}, {1, NULL}, {1, NULL},
  44.             {1, NULL}, {1, NULL}, {1, NULL},
  45.             {1, NULL}, {1, NULL}, {1, NULL},
  46.             {1, NULL}, {1, NULL}, {1, NULL}
  47.         };
  48. #endif
  49.  
  50. /*
  51.  *      version independant section
  52.  */
  53.  
  54. static  JNTS    j6j = {"          "},           /* storage for j6       */
  55.         jdj = {"          "};           /* ....... ... jd       */
  56.  
  57. static  TRSF    t6t = {"T6", const},            /* ....... ... t6       */
  58.         rst = {"REST", const},          /* ....... ... rest     */
  59.         hrt = {"HERE", varb},           /* ....... ... here     */
  60.         unt = {"UNIT", const,           /* ....... ... unitr    */
  61.             1., 0., 0., 0., 1., 0., 0., 0., 1., 0., 0., 0.};
  62.  
  63. static  VECT    xun = {1., 0., 0.},             /* ....... ... xunit    */
  64.         yun = {0., 1., 0.},             /* ....... ... yunit    */
  65.         zun = {0., 0., 1.};             /* ....... ... zunit    */
  66. /*
  67.  *      global pointers
  68.  */
  69.  
  70.     JNTS_PTR j6 = &j6j,             /* joints as computed by setpoint  */
  71.          jd = &jdj;             /* difference between two points   */
  72.  
  73.     TRSF_PTR t6 = &t6t,             /* t6 as compyted by setpoint      */
  74.          here = &hrt,           /* succesive t6 before transitions */
  75.          rest = &rst,           /* park t6                         */
  76.          unitr = &unt;          /* unit transform                  */
  77.  
  78.        VECT_PTR xunit = &xun,           /* unit X vector                   */
  79.         yunit = &yun,           /* .... Y ......                   */
  80.         zunit = &zun;           /* .... Z ......                   */
  81.  
  82.     POS_PTR lastpos = NULL,         /* last evaluated position equ.    */
  83.         goalpos = NULL,         /* current ...................     */
  84.         there,
  85.         park;
  86.  
  87.     event   completed = 0;          /* queue empty                     */
  88.  
  89.     FILE    *fpi = stderr;          /* info file option -v             */
  90.  
  91.     bool    prints_out = NO,        /* prints switch                   */
  92.         force_ctl = YES;        /* force stuff switch              */
  93.  
  94.     int     fddb = -1;              /* data base file des.             */
  95.  
  96.     int     rtime = 0,              /* time in ms                      */
  97.         timeincrement = TIMEINC,        /* current sample          */
  98.         requestnb = 0;          /* number non served requests      */
  99.         nextmove = NO;          /* causes motion interrupt         */
  100.  
  101.     short   hdpos = 0;              /* shipped to the controller       */
  102.  
  103. /*
  104.  *      math constants
  105.  */
  106.  
  107.     real    pi_m = PI,
  108.         pit2_m = PIT2,
  109.         pib2_m = PIB2,
  110.         dgtord_m = DEGTORAD,
  111.         rdtodg_m = RADTODEG;
  112.  
  113.  
  114. /*
  115.  *      arm sin cos
  116.  */
  117.  
  118.     SNCS  sncs_d;
  119.  
  120. /*
  121.  *      arms constants
  122.  */
  123.  
  124. #ifdef PUMA
  125. #include "../h/pumadata.h"
  126. #endif
  127. #ifdef STAN
  128. #include "../h/standata.h"
  129. #endif
  130.  
  131. /*
  132.  * park angles
  133.  */
  134.  
  135.     JNTS    jcal_c = {"      ", JCAL1, JCAL2, JCAL3, JCAL4, JCAL5, JCAL6};
  136.  
  137.  
  138. /*
  139.  * angles -> range offsets
  140.  */
  141.     JNTS    jmin_c = {"      ", JMIN1, JMIN2, JMIN3, JMIN4, JMIN5, JMIN6};
  142.  
  143. /*
  144.  * joint ranges
  145.  */
  146.     JNTS    jrng_c = {"      ", JRNG1, JRNG2, JRNG3, JRNG4, JRNG5, JRNG6};
  147.  
  148. /*
  149.  * max joint velocities
  150.  */
  151.     JNTS    jmxv_c = {"",
  152.             JMXV1 * DEF_SAMPLE / 1000.,
  153.             JMXV2 * DEF_SAMPLE / 1000.,
  154.             JMXV3 * DEF_SAMPLE / 1000.,
  155.             JMXV4 * DEF_SAMPLE / 1000.,
  156.             JMXV5 * DEF_SAMPLE / 1000.,
  157.             JMXV6 * DEF_SAMPLE / 1000.
  158.         };
  159.  
  160. /*
  161.  * kinematics constants
  162.  */
  163.  
  164. #ifdef PUMA
  165.     KINDYN  armk_c = {
  166.             A2,             /* A2                           */
  167.             A3,             /* A3                           */
  168.             D3,             /* D3                           */
  169.             D4,             /* D4                           */
  170.             D32,            /* D3 * D3                      */
  171.             E432,           /* D4 * D4 + A3 * A3 + A2 * A2  */
  172.             AA3D4,          /* atan2(A3, -D4)               */
  173.             E4AA4AD,        /* 4. * A2 * A2 * A3 * A3 +     */
  174.                     /* 4. * A2 * A2 * D4 * D4       */
  175.  
  176.             CP21,           /* joint gravity loads          */
  177.             CP31,
  178.             CP32,
  179.             CP50
  180.         };
  181. #endif
  182.  
  183.  
  184. #ifdef STAN
  185.     KINDYN  armk_c = {
  186.             D2,
  187.             D22
  188.         };
  189. #endif
  190.