home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / C / ROBOT01.ZIP / RCCL013 < prev    next >
Encoding:
Text File  |  1987-03-02  |  50.7 KB  |  2,237 lines

  1. .ND
  2. .EQ
  3. delim $$
  4. .EN
  5. .nr H1 11
  6. .NH
  7. Teaching
  8. .PP
  9. The
  10. .I teach
  11. mode is activated by a call to the
  12. .B teach
  13. function :
  14. .br
  15. .cs R 23
  16. .DS L
  17.         teach(trans, pos)
  18.         TRSF_PTR trans;
  19.         POS_PTR pos;
  20. .DE
  21. .cs R
  22. The
  23. .B teach
  24. function gives control to the user on the manipulator motions.
  25. When the teach mode begins, the following message appears on the
  26. terminal :
  27. .br
  28. .cs R 23
  29. .DS L
  30. teach mode V1.0, transform TRANS, position POS
  31. ?
  32. .DE
  33. .cs R
  34. a simple command line language allows the user to move the
  35. manipulator around.
  36. When the desired position is obtained, the transform `TRANS' can
  37. be solved for the position equation `POS' for the current value of $T6$.
  38. This is obtained on user's command by a call to
  39. .B update.
  40. Once the position is recorded, the manipulator can be moved elsewhere.
  41. Upon exit of the
  42. .I teach
  43. mode, if no position have been recorded the user is prompted as :
  44. .br
  45. .cs R 23
  46. .DS L
  47. nothing taught, exit ? (y/n)
  48. .DE
  49. .cs R
  50. If `n' is answered, the
  51. .I teach
  52. mode is not exited,
  53. if `y' is answered
  54. the
  55. .I teach
  56. mode exits and the
  57. .B teach
  58. function return the value `NO'.
  59. When a transform has been recorded, upon exit the function
  60. .B teach
  61. returns the value `YES'.
  62. Even if a transform has been recorded,
  63. .B teach
  64. can be forced to return `NO' by typing a `q!'.
  65. Applications of this have been shown in section 7.
  66. If successive records are made, only the last one is taken into account.
  67. .PP
  68. When a data base file has been specified, the
  69. .I teach
  70. mode behaves differently.
  71. The transform to be taught is searched in the data base under its name,
  72. if found, the function
  73. .B teach
  74. directly uses the value and immediately exits returning `YES',
  75. .B update
  76. is then not called.
  77. If the transform cannot be found in the data base,
  78. .B teach
  79. enter the regular manual mode.
  80. The user can record the transform value and save it on the data
  81. base.
  82. If no data base has been specified the user is informed of that fact.
  83. A data base editor (see below) can be used for off-line maintenance.
  84. .PP
  85. The interactive commands are displayed when a `?' mark is typed.
  86. By convention, the lower case `x', `y', `z' characters stand
  87. for translations or forces, and the upper case `X', `Y', `Z'
  88. stand for rotations of moments :
  89. .br
  90. .cs R 23
  91. .DS L
  92. These commands are executed one per line:
  93.         <return>        interrupt arm motion
  94.         q               quit
  95.         q!              quit, ignore not recorded
  96.         r               record transform
  97.         p               display current settings
  98.         s               save transform on data base
  99.         l               toggle force monitor
  100.     v <t r>         set velocities
  101.     m <m>           set mass of object
  102.         ?               this message
  103. These commands cumulate:
  104.         o                        open hand
  105.         c                        close hand
  106.     w <x/y/z/X/Y/Z> <k>      move world coordinates
  107.     t <x/y/z/X/Y/Z> <k>      move tool coordinates
  108.     e <x/y/z/X/Y/Z> <k>      change tool transform
  109.     f <x/y/z/X/Y/Z> <k>      set force limits
  110. .DE
  111. .cs R
  112. .PP
  113. Messages from the system can be :
  114. .br
  115. .cs R 23
  116. .DS L
  117. no data base specified
  118.  
  119. nothing recorded
  120.  
  121. stopped on force
  122.  
  123. >> stopped
  124.  
  125. next to limit(s)
  126.  
  127. not so fast
  128. .DE
  129. .cs R
  130. .PP
  131. A teach session can be obtained by running the program :
  132. .br
  133. .cs R 23
  134. .DS L
  135. #include "rccl.h"
  136. #include "umac.h"
  137.  
  138.  
  139. pumatask()
  140. {
  141.         TRSF_PTR z, e , b0;
  142.         POS_PTR  p0;
  143.  
  144.     z = gentr_trsl("Z",  0.,  0., 864.);
  145.     e = gentr_trsl("E" , 0. , 0. , 170.);
  146.         b0 = gentr_rot("B0", 600. , -200., 800., yunit, 180.);
  147.         b0->fn = varb;
  148.  
  149.         p0 = makeposition("P0" , z, t6, e, EQ, b0, TL, e);
  150.  
  151.         setmod('c');
  152.         setvel(300, 100);
  153.         move(p0);
  154.         while (teach(b0, p0))
  155.                 ;
  156.         setvel(300, 100);
  157.         move(park);
  158. }
  159. .DE
  160. .cs R
  161. .PP
  162. The session can look like :
  163. .EQ
  164. delim off
  165. .EN
  166. .br
  167. .cs R 23
  168. .DS L
  169. $ a.out -Ddata
  170. data does'nt exit, create ? (y/n) y
  171. gettr : B0 not found
  172. teach mode V1.0, transform B0, position P0
  173. ?p
  174. T6:
  175.   -1.000   -0.000   -0.000  600.001
  176.   -0.000    1.000    0.000 -200.000
  177.    0.000    0.000   -1.000  106.000
  178. E:
  179.    1.000    0.000    0.000    0.000
  180.    0.000    1.000    0.000    0.000
  181.    0.000    0.000    1.000  170.000
  182. veloc t:100 r:10
  183. ____1_______ _______2____ _________3__ ____4_______ _________5__ ____6_______
  184. no force limit
  185. mass of object : 0.000000 kg
  186. ?v 30 7
  187. ?wx200 wz -300 wY10
  188. ?
  189. >> stopped
  190. not so fast
  191. ?wz200
  192. ?l
  193. ?p
  194. T6:
  195.   -0.985    0.000   -0.171  826.436
  196.   -0.000    1.000    0.000 -200.000
  197.    0.171    0.000   -0.985    6.044
  198. E:
  199.    1.000    0.000    0.000    0.000
  200.    0.000    1.000    0.000    0.000
  201.    0.000    0.000    1.000  170.000
  202. veloc t:30 r:7
  203. ____1_______ ________2___ ______3_____ ___4________ __________5_ ____6_______
  204. force limits :fx 0.00   fy 0.00   fz 0.00    fX 0.00   fY 0.00   fZ 0.00
  205. mass of object : 0.000000 kg
  206. ?fx20 fY5
  207. ?wz-30
  208. stopped on force
  209. ?p
  210. T6:
  211.   -0.985    0.000   -0.171  826.436
  212.   -0.000    1.000    0.000 -200.000
  213.    0.171    0.000   -0.985   16.013
  214. E:
  215.    1.000    0.000    0.000    0.000
  216.    0.000    1.000    0.000    0.000
  217.    0.000    0.000    1.000  170.000
  218. veloc t:30 r:7
  219. ____1_______ ________2___ ______3_____ ___4________ __________5_ ____6_______
  220. force limits :fx 20.00  fy 0.00   fz 0.00    fX 0.00   fY 5.00   fZ 0.00
  221. mass of object : 0.000000 kg
  222. .DE
  223. .cs R
  224. .EQ
  225. delim $$
  226. .EN
  227. .PP
  228. The
  229. .I teach
  230. mode uses its own position equation to move the arm around.
  231. The tool transform is preset to a 170 mm translation in the Z direction,
  232. but can be
  233. changed.
  234. The messages  "not so fast" or "next to limit(s)" do not appear
  235. when the condition occurs, but when the next command is typed.
  236. The `p' command prints the current values of $T6$, $E$, velocities,
  237. the relative position of the joints in their range, the current
  238. force limits when toggled on, and the current mass of object.
  239. .bp
  240. .NH
  241. Summary
  242. .NH 2
  243. Error Messages
  244. .PP
  245. An RCCL internal error, causes a message to be printed and an exit
  246. of the process for the planning version.
  247. When run in real time mode, the process does not exit but the
  248. arm power is turned off and the process is put to sleep, this is
  249. to allow the user to `break' the program and take advantage of
  250. the automatic home position return [6].
  251. If the error occur at the level of the real time interface,
  252. we refer the reader to [6] for a determination of the error.
  253. If the error is a RCCL error condition, the messages can be :
  254.  
  255. .IP
  256. "position "POS" : transform not initialized - makeposition"
  257. : one of the transform pointer
  258. is `NULL'.
  259.  
  260. .IP
  261. "position "POS" : missing t6 or tool -  makeposition" :
  262. bad position equations structure.
  263.  
  264. .IP
  265. "position "POS" : missing rhs -  makeposition" :
  266. bad position equation structure.
  267.  
  268. .IP
  269. "position "POS", transform "TRANS" : pos functionally defined - makeposition" :
  270. the $POS$ part of the
  271. canonized equation cannot be a moving frame.
  272.  
  273. .IP
  274. "position "POS" : pos cannot seriously be t6 - makeposition" :
  275. the $POS$ part is equal
  276. to $T6$ due to a bad choice of the $TOOL$ part.
  277.  
  278. .IP
  279. "giveup" : The function
  280. .B giveup
  281. has been called, a message follows.
  282.  
  283. .IP
  284. "bad spec. - limit" : wrong directions specifications.
  285.  
  286. .IP
  287. "bad force spec. - comply" : wrong directions specifications.
  288.  
  289. .IP
  290. "bad force spec. - lock" : ditto.
  291.  
  292. .IP
  293. "bad distance spec. - distance" : ditto.
  294.  
  295. .IP
  296. "conf must change in joint mode" : the current motion mode is not correct
  297. for a configuration change.
  298.  
  299. .IP
  300. "invalid update transform type" : the involved transform must be of type
  301. .I varb.
  302.  
  303. .IP
  304. "could'nt find updatable transform" : a transform has been required to be
  305. updated but does not belong to the specified equation.
  306.  
  307. .IP
  308. "alloc err" : motion queue saturated.
  309.  
  310. .IP
  311. "mem. alloc error" : no more dynamic memory allocation space.
  312.  
  313. .IP
  314. "limit  `time'" : a joint limit occurred
  315. at time `time',
  316. the program does not exit and tries to recover by stopping
  317. and getting a new motion from the queue.
  318. (planning version only).
  319.  
  320. .IP
  321. "joint(s) limit" : an unrecoverable
  322. joint limit occurred.
  323. (planning version only).
  324.  
  325. .IP
  326. "glitch `time'" : a velocity discontinuity occurred at time `time'
  327. (planning version only).
  328.  
  329. .IP
  330. "jam" : unexpected behavior of the queue management, should never occur.
  331.  
  332. .IP
  333. "cannot unit vector" : the
  334. .B unit
  335. function has been required to unit a zero magnitude vector.
  336.  
  337. .IP
  338. "Write io error",
  339. "write io error",
  340. "close io error" :
  341. an i/o error occurred while writing data
  342. (planning version only).
  343.  
  344. .IP
  345. "*** could'nt queue at `time'", this message may occasionally appear, but
  346. it never did so far.
  347.  
  348. .SH
  349. Note
  350. .PP
  351. The user can use the function
  352. .B giveup
  353. to cause a task cancellation :
  354. .br
  355. .cs R 23
  356. .DS L
  357.         giveup(message, level);
  358. .DE
  359. .cs R
  360. .PP
  361. The first argument is a string, the second argument tells if the
  362. error condition occur in a background function (level 0)
  363. or in the user process (level 1), for example :
  364. .br
  365. .cs R 23
  366. .DS L
  367. pumatask()
  368. {
  369.         ...
  370.  
  371.         evalfn(monitor);
  372.         move(p);
  373.         while (goalpos == p) {
  374.                 ...
  375.                 if (big_mess) {
  376.                         giveup("cannot do that", 1);
  377.                 }
  378.         }
  379. }
  380.  
  381. monitor()
  382. {
  383.         ...
  384.         if (not_good) {
  385.                 giveup("wrong data", 0);
  386.         }
  387. }
  388. .DE
  389. .cs R
  390. .PP
  391. The error message would be :
  392. .br
  393. .cs R 23
  394. .DS L
  395. cannot do that
  396. giveup
  397.  
  398. or
  399.  
  400. wrong data
  401. giveup
  402. .DE
  403. .cs R
  404. .NH 2
  405. Functions, Global Variables, and Macros
  406. .PP
  407. Follows a brief description of the RCCL function library :
  408. .SH
  409. Dictionary of the terms
  410.  
  411. .IP "ax : "
  412. x element of `a' vector of a transform (real).
  413.  
  414. .IP "ay : "
  415. y element of `a' vector of a transform (real).
  416.  
  417. .IP "az : "
  418. z element of `a' vector of a transform (real).
  419.  
  420. .IP "bool : "
  421. an integer expression evaluating to 0 or non zero.
  422.  
  423. .IP "code : "
  424. an integer expression (OK LIMIT ONF OND predefined).
  425.  
  426. .IP "conf : "
  427. a string at most one of the `l' `r' `u' `d' `f' `n' characters and ` '.
  428.  
  429. .IP "diff : "
  430. DIFF_PTR, a pointer to a DIFF structure.
  431.  
  432. .IP "dirs : "
  433. a string of the form "fx ty",  "tz", ..., for force and distance specs.
  434.  
  435. .IP "eve : "
  436. an event count.
  437.  
  438. .IP "force : "
  439. FORCE_PTR, a pointer to a FORCE structure.
  440.  
  441. .IP "fp : "
  442. a UNIX file pointer *FILE (stdout, stderr ...).
  443.  
  444. .IP "func : "
  445. pointer to a function.
  446.  
  447. .IP "level : "
  448. an integer expression evaluating to 0 (interrupt) or 1 (user).
  449.  
  450. .IP "list : "
  451. a list of transform pointers (TRSF_PTR) separated by commas.
  452.  
  453. .IP "msg : "
  454. a string.
  455.  
  456. .IP "mode : "
  457. the character `j' or `c'.
  458.  
  459. .IP "name : "
  460. a string.
  461.  
  462. .IP "ox : "
  463. x element of `o' vector of a transform (real).
  464.  
  465. .IP "oy : "
  466. y element of `o' vector of a transform (real).
  467.  
  468. .IP "oz : "
  469. z element of `o' vector of a transform (real).
  470.  
  471. .IP "period : "
  472. an integer expression in milliseconds.
  473.  
  474. .IP "phi : "
  475. an angle in degrees (real).
  476.  
  477. .IP "pos : "
  478. a pointer to a position structure (POS_PTR).
  479.  
  480. .IP "pphi : "
  481. a pointer to a angle in degrees (*real).
  482.  
  483. .IP "ppsi : "
  484. a pointer to a angle in degrees (*real).
  485.  
  486. .IP "psi : "
  487. an angle in degrees (real).
  488.  
  489. .IP "pthe : "
  490. a pointer to a angle in degrees (*real).
  491.  
  492. .IP "px : "
  493. x element of `p' vector of a transform in millimeters (real).
  494.  
  495. .IP "py : "
  496. y element of `p' vector of a transform in millimeters (real).
  497.  
  498. .IP "pz : "
  499. z element of `p' vector of a transform in millimeters (real).
  500.  
  501. .IP "rotvel : "
  502. a rotational velocity in degrees per second (int).
  503.  
  504. .IP "tacc : "
  505. an acceleration time in milliseconds (int).
  506.  
  507. .IP "the : "
  508. an angle in degrees (real).
  509.  
  510. .IP "time : "
  511. a time in milliseconds (int).
  512.  
  513. .IP "trans : "
  514. a pointer to a transform structure (TRSF_PTR).
  515.  
  516. .IP "transvel : "
  517. a translational velocity in millimeters per second (int).
  518.  
  519. .IP "values : "
  520. a list of specifications in millimeters, degrees, Newtons, or Newton-meters.
  521.  
  522. .IP "vect : "
  523. pointer to a vector structure (VECT_PTR).
  524.  
  525. .SH
  526. Description of Functions, Variables, and Macros
  527. .PP
  528. Note : if p is pointer, *p is what is pointed to. functions names are
  529. marked `f', variables names `v', macros names `m'.
  530.  
  531. .IP f
  532. .B
  533. assigndiff(diff1, diff2) :
  534. .R
  535. copy *diff2 into *diff1, return diff1.
  536.  
  537. .IP f
  538. .B
  539. assignforce(force1, force2) :
  540. .R
  541. copy *force2 into *force1, return force1.
  542.  
  543. .IP f
  544. .B
  545. assigntr(trans1, trans2) :
  546. .R
  547. copy *trans2 into *trans1, return trans1.
  548.  
  549. .IP f
  550. .B
  551. assignvect(vect1, vect2) :
  552. .R
  553. copy *vect2 into *vect1, return vect1.
  554.  
  555. .IP v
  556. .B
  557. completed :
  558. .R
  559. signaled when motion queue goes empty and the arm is
  560. evaluating last position (event).
  561.  
  562. .IP f
  563. .B
  564. comply(dirs, values) :
  565. .R
  566. specify compliance for subsequent requests.
  567.  
  568. .IP f
  569. .B
  570. const() :
  571. .R
  572. does nothing but typifies a transform as constant (TRFN).
  573.  
  574. .IP f
  575. .B
  576. cross(vect1, vect2, vect3) :
  577. .R
  578. compute in *vect1 cross product of *vect2 and
  579. *vect3, return vect1.
  580.  
  581. .IP f
  582. .B
  583. df_to_tr(trans, diff) :
  584. .R
  585. builds differential transform *trans
  586. out of differential motion *diff, return trans.
  587.  
  588. .IP v
  589. .B
  590. dgtord_m :
  591. .R
  592. read only (real),
  593. convert from degrees to radians what is multiplied by.
  594.  
  595. .IP f
  596. .B
  597. difftr(diff1, diff2, trans) :
  598. .R
  599. transforms differential motion *diff2 into
  600. differential motion *diff1, with a frame differential relationship *trans,
  601. return diff1.
  602.  
  603. .IP f
  604. .B
  605. distance(dirs, values) :
  606. .R
  607. internally changes the position expressed in
  608. .I tool
  609. frame.
  610.  
  611. .IP f
  612. .B
  613. dot(vect1, vect2) :
  614. .R
  615. return (real) the dot product of *vect1 and *vect2.
  616.  
  617. .IP f
  618. .B
  619. eul(trans, phi, theta, psi) :
  620. .R
  621. set the rotational part of *trans from
  622. Euler angles, return trans.
  623.  
  624. .IP f
  625. .B
  626. eulm(trans, phi, the, psi) :
  627. .R
  628. multiplies *trans, by a rotation expressed
  629. with Euler angles, returns trans.
  630.  
  631. .IP f
  632. .B
  633. evalfn(func) :
  634. .R
  635. causes the function *func to be evaluated for next motion
  636. request.
  637.  
  638. .IP v
  639. .B
  640. force_ctl :
  641. .R
  642. turns on/off force control features (bool).
  643.  
  644. .IP f
  645. .B
  646. forcetr(force1, force2, trans) :
  647. .R
  648. transform generalized forces *force2 into
  649. generalized forces *force1, with a frame differential relationship *trans,
  650. return force1.
  651.  
  652. .IP v
  653. .B
  654. fpi :
  655. .R
  656. information file pointer (*FILE).
  657.  
  658. .IP f
  659. .B
  660. freepos(pos) :
  661. .R
  662. returns to the memory pool the storage allocated for
  663. building a positions equation ring structure.
  664.  
  665. .IP f
  666. .B
  667. gensym() :
  668. .R
  669. return a pointer
  670. to an always different string (_TEMP1, _TEMP2, ...).
  671.  
  672. .IP f
  673. .B
  674. gentr_eul(name, px, py, pz, phi, theta, psi) :
  675. .R
  676. make a constant transforms out of a `p' vector and Euler angles, return
  677. a trans.
  678.  
  679. .IP f
  680. .B
  681. gentr_pao(name, px, py, pz, ax, ay, az, ox, oy, oz) :
  682. .R
  683. make a constant transforms out of a `p' vector and `a', `o' vectors, return
  684. a trans.
  685.  
  686. .IP f
  687. .B
  688. gentr_rot(name, px, py, pz, vect, theta) :
  689. .R
  690. make a constant transform out of a `p' vector and a rotation of theta degrees
  691. around *vect, return a trans.
  692.  
  693. .IP f
  694. .B
  695. gentr_rpy(name, px, py, pz, phi, theta, psi) :
  696. .R
  697. make a constant transforms out of a `p' vector and roll, pitch, yaw angles.
  698. return a trans.
  699.  
  700. .IP f
  701. .B
  702. gentr_trsl(name, px, py, pz) :
  703. .R
  704. make a constant transforms out of a `p' vector and a unit rotation, return
  705. a trans.
  706.  
  707. .IP f
  708. .B
  709. giveup(msg, level) :
  710. .R
  711. cancel a task, and print msg when broken.
  712.  
  713. .IP v
  714. .B
  715. goalpos :
  716. .R
  717. a read only (POS_PTR), equal to the position pointer of the
  718. equation currently evaluated.
  719.  
  720. .IP v
  721. .B
  722. hdpos :
  723. .R
  724. a write only (short), hand position information.
  725.  
  726. .IP v
  727. .B
  728. here :
  729. .R
  730. a read only (TRSF_PTR), equal to $T6$ at segment termination.
  731.  
  732. .IP f
  733. .B
  734. hold() :
  735. .R
  736. does nothing but typifies a transform as to be held (TRFN).
  737.  
  738. .IP f
  739. .B
  740. invert(trans1, trans2) :
  741. .R
  742. store in *trans1 the inverse of *trans2,
  743. trans1 and trans2 different, return trans1.
  744.  
  745. .IP f
  746. .B
  747. invertinp(trans) :
  748. .R
  749. stores in *trans the inverse of *trans, return trans.
  750.  
  751. .IP v
  752. .B
  753. j6 :
  754. .R
  755. a read only (JNTS_PTR), the current desired joint setpoint in
  756. range coordinates.
  757.  
  758. .IP v
  759. .B
  760. jd :
  761. .R
  762. a read only (JNTS_PTR), the desired differential joint setpoint.
  763.  
  764. .IP v
  765. .B
  766. lastpos :
  767. .R
  768. a read only (POS_PTR), equal to the position pointer of the
  769. last evaluated equation.
  770.  
  771. .IP f
  772. .B
  773. limit(dirs, values) :
  774. .R
  775. trigger force or differential motion monitoring
  776. for the next motion request.
  777.  
  778. .IP f
  779. .B
  780. lock(dirs) :
  781. .R
  782. bring back the arm in position servo mode for the specified
  783. directions.
  784.  
  785. .IP f
  786. .B
  787. makeposition(name, list, EQ, list, TL, trans) :
  788. .R
  789. build a position equation ring structure, returns a pos.
  790.  
  791. .IP f
  792. .B
  793. move(pos) :
  794. .R
  795. enter a motion request toward a position described by pos
  796. in the motion queue.
  797.  
  798. .IP m
  799. .B
  800. movecart(pos, tacc, time) :
  801. .R
  802. do setmod('c'); setime(tacc, time); move(p).
  803.  
  804. .IP m
  805. .B
  806. moveconf(pos, tacc, time, conf) :
  807. .R
  808. do setconf(conf); setmod('j');
  809. setime(tacc, time); move(p).
  810.  
  811. .IP m
  812. .B
  813. movejnts(pos, tacc, time) :
  814. .R
  815. do setmod('j'); setime(tacc, time); move(p).
  816.  
  817. .IP f
  818. .B
  819. newtrans(name, func) :
  820. .R
  821. allocate storage for a *trans, attach it to function
  822. *func, return a trans.
  823.  
  824. .IP v
  825. .B
  826. nextmove :
  827. .R
  828. a write only code,
  829. when set, causes the current motion interruption and the value returned in
  830. the corresponding position structure field `code'.
  831.  
  832. .IP f
  833. .B
  834. noatoeul(pphi, pthe, ppsi, trans) :
  835. .R
  836. derive the Euler angles from *trans.
  837.  
  838. .IP f
  839. .B
  840. noatorpy(pphi, pthe, ppsi, trans) :
  841. .R
  842. derive the roll pitch yaw angles from
  843. *trans.
  844.  
  845. .IP f
  846. .B
  847. optimize(pos) :
  848. .R
  849. optimize  a position equation ring structure.
  850.  
  851. .IP v
  852. .B
  853. park :
  854. .R
  855. a read only (POS_PTR), the park position.
  856.  
  857. .IP v
  858. .B
  859. pi_m :
  860. .R
  861. a read only approximation of the number pi (real).
  862.  
  863. .IP v
  864. .B
  865. pib2_m :
  866. .R
  867. a read only approximation of the number pi/2 (real).
  868.  
  869. .IP v
  870. .B
  871. pit2_m :
  872. .R
  873. a read only an approximation of the number pi*2 (real).
  874.  
  875. .IP f
  876. .B
  877. printd(diff, fp) :
  878. .R
  879. print *diff on file *fp.
  880.  
  881. .IP f
  882. .B
  883. printe(trans, fp) :
  884. .R
  885. print *trans on file *fp (Euler angles).
  886.  
  887. .IP f
  888. .B
  889. printm(force, fp) :
  890. .R
  891. print *force on file *fp.
  892.  
  893. .IP f
  894. .B
  895. printr(trans, fp) :
  896. .R
  897. print *trans on file *fp (n o a p).
  898.  
  899. .IP f
  900. .B
  901. printrn(trans, fp) :
  902. .R
  903. printf *trans on file *fp (name, n o a p, Euler, rpy).
  904.  
  905. .IP v
  906. .B
  907. prints_out :
  908. .R
  909. causes prints when set (bool).
  910.  
  911. .IP f
  912. .B
  913. printy(trans, fp) :
  914. .R
  915. print *trans on file *fp (Euler angles).
  916.  
  917. .IP v
  918. .B
  919. rdtodg_m :
  920. .R
  921. a read only (real),
  922. convert from radians to degrees what is multiplied by.
  923.  
  924. .IP f
  925. .B
  926. release(msg) :
  927. .R
  928. closes real time channel.
  929.  
  930. .IP f
  931. .B
  932. requestnb :
  933. .R
  934. read only (int), the number of not served motion requests.
  935.  
  936. .IP v
  937. .B
  938. rest :
  939. .R
  940. a read only (TRSF_PTR), T6 at the park position.
  941.  
  942. .IP f
  943. .B
  944. rot(trans, vect, theta) :
  945. .R
  946. set the rotation part of *trans from
  947. a rotation around *vect, of angle theta, returns trans.
  948.  
  949. .IP f
  950. .B
  951. rotm(trans, vect, theta) :
  952. .R
  953. multiplies *trans by a rotations made out of
  954. a rotation around *vect, of angle theta, return trans.
  955.  
  956. .IP f
  957. .B
  958. rpy(trans, phi, the, psi) :
  959. .R
  960. set the rotation part of *trans from
  961. a rotations of roll pitch an yaw angles, return trans.
  962.  
  963. .IP f
  964. .B
  965. rpym(trans, phi, the, psi) :
  966. .R
  967. multiplies *trans by a rotation of roll pitch
  968. and yaw angles, return trans.
  969.  
  970. .IP v
  971. .B
  972. rtime :
  973. .R
  974. an (int), the time spend since the last reset, in milliseconds.
  975.  
  976. .IP f
  977. .B
  978. sample(period) :
  979. .R
  980. change the sample rate, next motion request.
  981.  
  982. .IP f
  983. .B
  984. setconf(conf) :
  985. .R
  986. change the arm configuration next motion request.
  987.  
  988. .IP f
  989. .B
  990. setime(tacc, time) :
  991. .R
  992. set the acceleration and segment time next motion
  993. request.
  994.  
  995. .IP f
  996. .B
  997. setmod(mode) :
  998. .R
  999. set the motion mode, next motion request.
  1000.  
  1001. .IP f
  1002. .B
  1003. setvel(transvel, rotvel) :
  1004. .R
  1005. set the translational an rotational velocities,
  1006. next motion request.
  1007.  
  1008. .IP f
  1009. .B
  1010. startup() :
  1011. .R
  1012. start real time channel.
  1013.  
  1014. .IP f
  1015. .B
  1016. stop(time) :
  1017. .R
  1018. repeat last motion request, during time.
  1019.  
  1020. .IP f
  1021. .B
  1022. strsave(string) :
  1023. .R
  1024. copies string in allocated storage and return pointer to it.
  1025.  
  1026. .IP f
  1027. .B
  1028. suspendfg() :
  1029. .R
  1030. put foreground process to sleep for 1/10 of a second.
  1031.  
  1032. .IP f
  1033. .B
  1034. takerot(trans1, trans2) :
  1035. .R
  1036. copy `n' `o' `a' vectors of *trans2 into *trans1,
  1037. return trans1.
  1038.  
  1039. .IP f
  1040. .B
  1041. taketrsl(trans1, trans2) :
  1042. .R
  1043. copy `p' vector of *trans2 into *trans1,
  1044. return trans1.
  1045.  
  1046. .IP v
  1047. .B
  1048. t6 :
  1049. .R
  1050. read only (TRSF_PTR), the current desired value of T6.
  1051.  
  1052. .IP f
  1053. .B
  1054. teach(trans, pos) :
  1055. .R
  1056. enters manual teach mode, may update *trans, using pos,
  1057. return user's exit style.
  1058.  
  1059. .IP v
  1060. .B
  1061. there :
  1062. .R
  1063. a (POS_PTR) such as move(there) stops the arm.
  1064.  
  1065. .IP v
  1066. .B
  1067. timeincrement :
  1068. .R
  1069. a read only (int), the current sample time.
  1070.  
  1071. .IP f
  1072. .B
  1073. tr_to_df(diff, trans) :
  1074. .R
  1075. make *diff out a differential transform *trans,
  1076. returns diff.
  1077.  
  1078. .IP f
  1079. .B
  1080. trmult(trans1, trans2, trans3) :
  1081. .R
  1082. multiply *trans2 by *trans3, and store the result in distinct *trans1,
  1083. return trans1.
  1084.  
  1085. .IP f
  1086. .B
  1087. trmultinp(trans1, trans2) :
  1088. .R
  1089. multiply *trans1 by *trans2, and store the result
  1090. in *trans1, return trans1.
  1091.  
  1092. .IP f
  1093. .B
  1094. trmultinv(trans1, trans2) :
  1095. .R
  1096. multiply *trans1 by inverse of *trans2, and
  1097. store the result in *trans1, return trans1.
  1098.  
  1099. .IP f
  1100. .B
  1101. trsl(trans, px, py, pz) :
  1102. .R
  1103. sets the translation part of *trans from p vector,
  1104. return trans.
  1105.  
  1106. .IP f
  1107. .B
  1108. trslm(trans, px, py, pz) :
  1109. .R
  1110. multiply *trans by a translation from p vector,
  1111. return trans.
  1112.  
  1113. .IP f
  1114. .B
  1115. unit(vect1, vect2) :
  1116. .R
  1117. store in *vect1, the unit magnitude vector, collinear
  1118. with vect2, return vect1.
  1119.  
  1120. .IP v
  1121. .B
  1122. unitr :
  1123. .R
  1124. a read only (TRSF_PTR), the unit transform.
  1125.  
  1126. .IP f
  1127. .B
  1128. update(trans, pos) :
  1129. .R
  1130. solve *trans in equation *pos, for the value of
  1131. T6 at the end of the execution of the subsequent motion request.
  1132.  
  1133. .IP f
  1134. .B
  1135. vao(trans, ax, ay, az, ox, oy, oz) :
  1136. .R
  1137. set rotation part of *trans from
  1138. elements of non necessarily orthogonal vectors, return trans.
  1139.  
  1140. .IP f
  1141. .B
  1142. vaom(trans, ax, ay, az, ox, oy, oz) :
  1143. .R
  1144. multiply *trans by a rotation from
  1145. elements of non necessarily orthogonal vectors, return trans.
  1146.  
  1147. .IP f
  1148. .B
  1149. varb() :
  1150. .R
  1151. does nothing but typifies a transform as to be variable (TRFN).
  1152.  
  1153. .IP m
  1154. .B
  1155. waitas(bool) :
  1156. .R
  1157. evaluates bool every 1/10 of a second and proceed if
  1158. exp is not 0.
  1159.  
  1160. .IP m
  1161. .B
  1162. waitfor(eve) :
  1163. .R
  1164. increment eve, test eve every 1/10 of a second,
  1165. proceed if eve drops to 0.
  1166.  
  1167. .IP v
  1168. .B
  1169. xunit :
  1170. .R
  1171. a read only (VECT_PTR), the X unit vector.
  1172.  
  1173. .IP v
  1174. .B
  1175. yunit :
  1176. .R
  1177. a read only (VECT_PTR), the Y unit vector.
  1178.  
  1179. .IP v
  1180. .B
  1181. zunit :
  1182. .R
  1183. a read only (VECT_PTR), the Z unit vector.
  1184.  
  1185. .NH 2
  1186. Undocumeted Library Entry Points
  1187. .PP
  1188. The following list is a set of undocumented entry points
  1189. of the basic RCCL library
  1190. that may cause
  1191. link conflicts.
  1192. The labels always end with a recognizable suffix.
  1193. The user must keep in mind that the entry points of the
  1194. .I real
  1195. time control
  1196. library are still available, but should normally be used only for reading
  1197. analog to digital conversions, for example.
  1198. .br
  1199. .cs R 23
  1200. .DS L
  1201.                 Functions :
  1202.  
  1203. assignjs_n
  1204. checkstate_n
  1205. dequeue_n
  1206. diffjnts_n
  1207. drivefn_n
  1208. enqueue_n
  1209. focpyc_n
  1210. fojnts_n
  1211. fopar_n
  1212. getobsj_n
  1213. getobst_n
  1214. gravload_n
  1215. jacobD_n
  1216. jacobI_n
  1217. jacobT_n
  1218. jns_to_tr_n
  1219. jnsend_n
  1220. newposition_n
  1221. newterm_n
  1222. polycpyc_n
  1223. polyjnts_n
  1224. polypar_n
  1225. select_n
  1226. setpar_n
  1227. setpoint_n
  1228. shifttr_n
  1229. solveconf_n
  1230. solved_n
  1231. solvedo_n
  1232. solvei_n
  1233. solveio_n
  1234. t2jnts_n
  1235. t2par_n
  1236. tr_to_jns_n
  1237.  
  1238.                 Variables :
  1239.  
  1240. armk_c
  1241. iobf_n
  1242. motionreq_n
  1243. mqueue_n
  1244. opsw_n
  1245. sncs_d
  1246. .DE
  1247. .cs R
  1248. .NH 2
  1249. Include Files
  1250. .SH
  1251. rccl.h
  1252. .PP
  1253. This file includes all the necessary ingredients for writing programs
  1254. that will link with the RCCL library :
  1255. .br
  1256. .cs R 23
  1257. .DS L
  1258. .B "                            rccl.h"
  1259.  
  1260. #include <stdio.h>              /* included here for safety             */
  1261. #include <math.h>               /* .................................... */
  1262.  
  1263. #define YES     1
  1264. #define NO      0
  1265. #define UNDEF   2
  1266.  
  1267. #define OK      -1              /* normal path segment termination code */
  1268. #define LIMIT   -2              /* ran into a limit, arm stopped        */
  1269. #define ONF     -3              /* terminated on force                  */
  1270. #define OND     -4              /* terminated on differential motion    */
  1271.  
  1272. #define PIB2            1.57079632679489660     /* pi / 2               */
  1273. #define PI              3.14159265358979320     /* pi                   */
  1274. #define PIT2            6.28318530717958650     /* pi * 2               */
  1275. #define RADTODEG        57.29577951308232100    /* 180 / pi             */
  1276. #define DEGTORAD        0.01745329251994330     /* pi / 180             */
  1277. #define SMALL           (1.e-5)                 /* considered as small  */
  1278. #define EQ              1                       /* lhs = rhs            */
  1279. #define TL              2                       /* tool =               */
  1280.  
  1281. #define malloc  malloc_l        /* .................................... */
  1282. #define free    free_l
  1283. #define realloc realloc_l       /* replace dynamic allocation entries   */
  1284. #define calloc  calloc_l
  1285. #define cfree   cfree_l         /* .................................... */
  1286.  
  1287. .DE
  1288. .cs R
  1289. .br
  1290. .cs R 23
  1291. .DS L
  1292. .B "                            rccl.h"
  1293. /*
  1294.  * RCCL typedefs
  1295.  */
  1296.  
  1297. typedef int bool;
  1298.  
  1299. typedef float real;
  1300.  
  1301. typedef int event;
  1302.  
  1303. typedef struct vector {
  1304.                 real x, y, z;
  1305. } VECT, *VECT_PTR;
  1306.  
  1307. typedef int(* TRFN)();
  1308.  
  1309. typedef struct transform {
  1310.                 char *name;
  1311.                 TRFN fn;
  1312.                 VECT n, o, a, p;
  1313.                 int timeval;
  1314. } TRSF, *TRSF_PTR;
  1315.  
  1316. typedef struct jns {
  1317.                 char *conf;
  1318.                 real th1, th2, th3, th4, th5, th6;
  1319. } JNTS, *JNTS_PTR;
  1320.  
  1321. typedef struct posit {
  1322.                 char *name;
  1323.                 int code;
  1324.                 real scal;
  1325.                 event end;
  1326. } POS, *POS_PTR;
  1327.  
  1328. typedef struct force {
  1329.                 VECT f, m;
  1330. } FORCE, *FORCE_PTR;
  1331.  
  1332. typedef struct diff {
  1333.                 VECT t, r;
  1334. } DIFF, *DIFF_PTR;
  1335.  
  1336. .DE
  1337. .cs R
  1338. .br
  1339. .cs R 23
  1340. .DS L
  1341. .B "                            rccl.h"
  1342. /*
  1343.  * RCCL functions
  1344.  */
  1345.  
  1346. extern POS_PTR  makeposition();
  1347.  
  1348. extern TRSF_PTR newtrans(),
  1349.                 gentr_rot(),
  1350.                 gentr_eul(),
  1351.                 gentr_rpy(),
  1352.                 gentr_pao(),
  1353.                 gentr_trsl(),
  1354.                 assigntr(),
  1355.                 taketrsl(),
  1356.                 takerot(),
  1357.                 trmult(),
  1358.                 trmultinp(),
  1359.                 trmultinv(),
  1360.                 invert(),
  1361.                 invertinp(),
  1362.                 trsl(),
  1363.                 vao(),
  1364.                 rot(),
  1365.                 eul(),
  1366.                 rpy(),
  1367.                 trslm(),
  1368.                 vaom(),
  1369.                 rotm(),
  1370.                 eulm(),
  1371.                 rpym(),
  1372.                 df_to_tr();
  1373.  
  1374. extern DIFF_PTR assigndiff(),
  1375.                 tr_to_df(),
  1376.                 difftr();
  1377.  
  1378. extern FORCE_PTR assignforce(),
  1379.                  forcetr();
  1380.  
  1381. extern VECT_PTR assignvect(),
  1382.                 cross(),
  1383.                 unit();
  1384.  
  1385. extern real     dot();
  1386.  
  1387. .DE
  1388. .cs R
  1389. .br
  1390. .cs R 23
  1391. .DS L
  1392. .B "                            rccl.h"
  1393.  
  1394. extern int      const(),
  1395.                 hold(),
  1396.                 varb(),
  1397.                 optimize(),
  1398.                 printd(),
  1399.                 printm(),
  1400.                 freepos(),
  1401.                 startup(),
  1402.                 suspendfg(),
  1403.                 giveup(),
  1404.                 release(),
  1405.                 setmod(),
  1406.                 setime(),
  1407.                 setvel(),
  1408.                 evalfn(),
  1409.                 setconf(),
  1410.                 update(),
  1411.                 sample(),
  1412.                 massis(),
  1413.                 limit(),
  1414.                 comply(),
  1415.                 lock(),
  1416.                 distance(),
  1417.                 move(),
  1418.                 stop(),
  1419.                 noatoeul(),
  1420.                 noatorpy(),
  1421.                 printr(),
  1422.                 printrn(),
  1423.                 printe(),
  1424.                 printy(),
  1425.                 teach();
  1426.  
  1427. .DE
  1428. .cs R
  1429. .br
  1430. .cs R 23
  1431. .DS L
  1432. .B "                            rccl.h"
  1433. /*
  1434.  * variables
  1435.  */
  1436.  
  1437. extern JNTS_PTR j6,                     /* current joint range values   */
  1438.                 jd;                     /* current joint increments     */
  1439.  
  1440. extern TRSF_PTR t6,                     /* current T6                   */
  1441.                 here,                   /* equals T6 each end of segment*/
  1442.                 rest,                   /* T6 park position             */
  1443.                 unitr;                  /* unit transform               */
  1444.  
  1445. extern VECT_PTR xunit,                  /* X unit vector                */
  1446.                 yunit,                  /* Y unit vector                */
  1447.                 zunit;                  /* Z unit vector                */
  1448.  
  1449. extern  POS_PTR lastpos,                /* last evaluated position      */
  1450.                 goalpos,                /* current evaluated position   */
  1451.                 there,                  /* such as t6 = here            */
  1452.                 park;                   /* such as t6 = rest            */
  1453.  
  1454. extern event    completed;              /* queue empty                  */
  1455.  
  1456. extern  FILE    *fpi;                   /* info file pointer            */
  1457.  
  1458. extern  bool    prints_out,             /* info prints switch           */
  1459.                 force_ctl;              /* force control switch         */
  1460.  
  1461. extern  int     fddb;                   /* data base file descriptor    */
  1462.  
  1463. extern  int     rtime,                  /* current time since reset     */
  1464.                 timeincrement,          /* current sample period        */
  1465.                 requestnb,              /* number of requests in queue  */
  1466.                 nextmove,               /* motion interruption flag     */
  1467.                 terminate;              /* in rtc                       */
  1468.  
  1469. extern real     pi_m,                   /* math constants               */
  1470.                 pib2_m,
  1471.                 pit2_m,
  1472.                 dgtord_m,
  1473.                 rdtodg_m;
  1474.  
  1475. extern short    hdpos;          /* hand control information             */
  1476.  
  1477. #define waitas(predicate)       {while(!(predicate)) suspendfg();}
  1478.  
  1479. #define waitfor(event)          {++(event);\\\\
  1480.                                 while(event > 0) suspendfg();}
  1481.  
  1482. .DE
  1483. .cs R
  1484. .br
  1485. .cs R 23
  1486. .DS L
  1487. .B "                            rccl.h"
  1488.  
  1489. #define Assigntr        (void)assigntr
  1490. #define Taketrsl        (void)taketrsl
  1491. #define Takerot         (void)takerot
  1492. #define Trmult          (void)trmult
  1493. #define Trmultinp       (void)trmultinp
  1494. #define Trmultinv       (void)trmultinv
  1495. #define Invert          (void)invert
  1496. #define Invertinp       (void)invertinp
  1497. #define Trsl            (void)trsl
  1498. #define Vao             (void)vao
  1499. #define Rot             (void)rot
  1500. #define Eul             (void)eul
  1501. #define Rpy             (void)rpy
  1502. #define Trslm           (void)trslm
  1503. #define Vaom            (void)vaom
  1504. #define Rotm            (void)rotm
  1505. #define Eulm            (void)eulm
  1506. #define Rpym            (void)rpym
  1507.  
  1508. #define Assigndiff      (void)assigndiff
  1509. #define Df_to_tr        (void)df_to_tr
  1510. #define Tr_to_df        (void)tr_to_df
  1511. #define Assignforce     (void)assignforce
  1512. #define Forcetr         (void)forcetr
  1513. #define Difftr          (void)difftr
  1514.  
  1515. #define Assignvect      (void)assignvect
  1516. #define Cross           (void)cross
  1517. #define Unit            (void)unit
  1518.  
  1519. #define movecart(p, ta, ts)     {setmod('c'); setime(ta, ts); move(p);}
  1520. #define movejnts(p, ta, ts)     {setmod('j'); setime(ta, ts); move(p);}
  1521. #define moveconf(p, ta, ts, cf)  {setconf(cf); setmod('j'); setime(ta, ts); move
  1522.  
  1523. #define freetrans(t)            {free((char *)t); t = NULL;}
  1524. #define freeposition(p)         {freepos(p); p = NULL;}
  1525. .DE
  1526. .cs R
  1527. .SH
  1528. kine.h
  1529. .PP
  1530. This file describes the items related to the kinematics of the considered
  1531. manipulator.
  1532. That is why, if you are using the Puma 600, the name 'PUMA' must
  1533. be #defined somehow.
  1534. The macros updates the jacobian coefficients, they
  1535. can be ignored and are listed here for completeness only.
  1536. The external entries may be of some importance.
  1537. .br
  1538. .cs R 23
  1539. .DS L
  1540. .B "                            kine.h"
  1541.  
  1542. #ifdef PUMA
  1543.  
  1544. #define ELBOW_DEG       01              /* elbow degeneracy             */
  1545. #define ALIGN_DEG       02              /* T6 in X Z Jt 1 plan          */
  1546. #define WRIST_DEG       03              /* wrist degeneracy             */
  1547.  
  1548. typedef struct kindyn {
  1549.                real a2, a3, d3, d4, d32, e432, aa3d4, e4aa4ad;
  1550.                real cp21, cp31, cp32, cp50;
  1551. } KINDYN, *KINDYN_PTR;
  1552.  
  1553. typedef struct sincos {
  1554.         real c1, s1, c2, s2, c23, s23, c3, s3, c4, s4, c5, s5, c6, s6;
  1555.         real d1x, d1y, d1z, r1x, r1z, d2x, d2y, d2z, d3x, d3y, d3z;
  1556.         real h;
  1557.         TRSF u5;
  1558. } SNCS, *SNCS_PTR;
  1559.  
  1560. .DE
  1561. .cs R
  1562. .br
  1563. .cs R 23
  1564. .DS L
  1565. .B "                            kine.h"
  1566. /*
  1567.  * Macro updates coef of Jacob from the sin cos
  1568.  */
  1569.  
  1570. #define GETH\\\\
  1571. {\\\\
  1572.         sncs_d.h = sncs_d.c2 * armk_c.a2 +\\\\
  1573.                    sncs_d.s23 * armk_c.d4 +\\\\
  1574.                    sncs_d.c23 * armk_c.a3;\\\\
  1575. }
  1576. #define UPDJ\\\\
  1577. {\\\\
  1578.         sncs_d.d1x = sncs_d.h * sncs_d.s4 -\\\\
  1579.                      armk_c.d3 * sncs_d.c23 * sncs_d.c4;\\\\
  1580.         sncs_d.d1y = sncs_d.s23 * armk_c.d3;\\\\
  1581.         sncs_d.d1z = sncs_d.h * sncs_d.c4 + armk_c.d3 * sncs_d.c23 * sncs_d.s4;\
  1582.         sncs_d.r1x = -sncs_d.s23 * sncs_d.c4;\\\\
  1583.         sncs_d.r1z = sncs_d.s23 * sncs_d.s4;\\\\
  1584.         sncs_d.d2x = armk_c.a2 * sncs_d.s3 * sncs_d.c4;\\\\
  1585.         sncs_d.d2y = armk_c.a2 * sncs_d.c3;\\\\
  1586.         sncs_d.d2z = -armk_c.a2 * sncs_d.s3 * sncs_d.s4;\\\\
  1587.         sncs_d.d3x = sncs_d.c4 * armk_c.d4;\\\\
  1588.         sncs_d.d3y = armk_c.a3;\\\\
  1589.         sncs_d.d3z = -sncs_d.s4 * armk_c.d4;\\\\
  1590. }
  1591. #define GETU5\\\\
  1592. {\\\\
  1593.         sncs_d.u5.n.x = sncs_d.c5 * sncs_d.c6;\\\\
  1594.         sncs_d.u5.n.y = sncs_d.s5 * sncs_d.c6;\\\\
  1595.         sncs_d.u5.n.z = sncs_d.s6;\\\\
  1596.         sncs_d.u5.o.x= -sncs_d.c5 * sncs_d.s6;\\\\
  1597.         sncs_d.u5.o.y= -sncs_d.s5 * sncs_d.s6;\\\\
  1598.         sncs_d.u5.o.z = sncs_d.c6;\\\\
  1599.         sncs_d.u5.a.x = sncs_d.s5;\\\\
  1600.         sncs_d.u5.a.y= -sncs_d.c5;\\\\
  1601.         sncs_d.u5.a.z = 0.;\\\\
  1602. }
  1603. #endif
  1604.  
  1605. #ifdef STAN
  1606. typedef struct kindyn {
  1607.         real d2, d22;
  1608. } KINDYN, *KINDYN_PTR;
  1609.  
  1610. typedef struct sincos {
  1611.         real c1, s1, c2, s2, d3, c4, s4, c5, s5, c6, s6;
  1612.         real d1x, d1y, d1z, r1x, r1y, r1z, d2x, d2y, d2z, r2x, r2y, r2z,
  1613.                 d3x, d3y, d3z, r4x, r4y;
  1614. } SNCS, *SNCS_PTR;
  1615.  
  1616. .DE
  1617. .cs R
  1618. .br
  1619. .cs R 23
  1620. .DS L
  1621. .B "                             kine.h"
  1622. #define UPDJ\\\\
  1623. {\\\\
  1624.         real\\\\
  1625.         k1 = sncs_d.c4 * sncs_d.c5,\\\\
  1626.         k2 = sncs_d.s4 * sncs_d.c5,\\\\
  1627.         k3 = sncs_d.c4 * sncs_d.s5,\\\\
  1628.         k4 = sncs_d.s2 * sncs_d.d3,\\\\
  1629.         k5 = k1      * sncs_d.c6,\\\\
  1630.         k6 = sncs_d.s4 * sncs_d.c6,\\\\
  1631.         k7 = k5 - sncs_d.s4 * sncs_d.s6,\\\\
  1632.         k8 = k2 * sncs_d.c6 + sncs_d.c4 * sncs_d.s6,\\\\
  1633.         k9 = k1 * sncs_d.s6 + k6,\\\\
  1634.         k10= - k2 * sncs_d.s6 + sncs_d.c4 * sncs_d.c6,\\\\
  1635.         k11= k5 + k6,\\\\
  1636.         k12= sncs_d.s4 * sncs_d.s5,\\\\
  1637.         k13= sncs_d.s5 * sncs_d.c6,\\\\
  1638.         k14= sncs_d.s5 * sncs_d.s6;\\\\
  1639.         sncs_d.d1x = (-armk_c.d2 * (sncs_d.c2 * k7 - sncs_d.s2 * k13) +\\\\
  1640.                       k4 * k8);\\\\
  1641.         sncs_d.d2x = sncs_d.d3 * k7;\\\\
  1642.         sncs_d.d3x = -k13;\\\\
  1643.         sncs_d.d1y = (-armk_c.d2 * (- sncs_d.c2 * k9 + sncs_d.s2 * k14) +\\\\
  1644.                       k4 * k10);\\\\
  1645.         sncs_d.d2y = -sncs_d.d3 * k11;\\\\
  1646.         sncs_d.d3y = k14;\\\\
  1647.         sncs_d.d1z = (-armk_c.d2 * (sncs_d.c2 * k3 + sncs_d.s2 * sncs_d.c5) +\\\
  1648.                       k4 * k12);\\\\
  1649.         sncs_d.d2z = sncs_d.d3 * k3;\\\\
  1650.         sncs_d.d3z = sncs_d.c5;\\\\
  1651.         sncs_d.r1x = (-sncs_d.s2 * k7 - sncs_d.c2 * k13);\\\\
  1652.         sncs_d.r2x = k8;\\\\
  1653.         sncs_d.r4x = -k13;\\\\
  1654.         sncs_d.r1y = (sncs_d.s2 * k9 + sncs_d.c2 * k14);\\\\
  1655.         sncs_d.r2y = k10;\\\\
  1656.         sncs_d.r4y = k14;\\\\
  1657.         sncs_d.r1z = (-sncs_d.s2 * k3 + sncs_d.c2 * sncs_d.c5);\\\\
  1658.         sncs_d.r2z = k12;\\\\
  1659. }
  1660. #endif
  1661. .DE
  1662. .cs R
  1663. .br
  1664. .cs R 23
  1665. .DS L
  1666. .B "                              kine.h"
  1667.  
  1668. extern  KINDYN  armk_c;                 /* arm kinematic and dynamic    */
  1669.                                         /* constants                    */
  1670.  
  1671. extern  SNCS    sncs_d;                 /* current sin cos, jacob coeff */
  1672.                                         /* and U5 matrix                */
  1673.  
  1674. extern  JNTS    jcal_c;                 /* rest position joint range    */
  1675.  
  1676. extern  JNTS    jmin_c;                 /* angles range offset values   */
  1677.  
  1678. extern  JNTS    jrng_c;                 /* maximum joint range values   */
  1679.  
  1680. extern  JNTS    jmxv_c;                 /* max joint velocities */
  1681. .DE
  1682. .cs R
  1683. .PP
  1684. The variable
  1685. .B armk_c
  1686. contains all the arm constants : link parameters, and gravity joint loads.
  1687. The variable
  1688. .B sncs_d
  1689. contains a set of variable
  1690. kinematic parameters updated at sample time intervals :
  1691. joint angles sines and cosines, the terms of 3 by 3 upper left
  1692. Jacobian submatrix, computed in link 4, and the matrix $U5$.
  1693. The variable
  1694. .B jcal_c
  1695. is the joint angle values at the `park' position, in radians.
  1696. The variable
  1697. .B jmin_c
  1698. is the set of angle offsets used to map joint angles expressed in
  1699. solution coordinate frame [-$pi$ ,+$pi$]
  1700. onto joint angles expressed in range coordinates [0, range].
  1701. The variable
  1702. .B jrng_c
  1703. is the set of joint ranges in radians.
  1704. The variable
  1705. .B jmxv_c
  1706. is the set of admissible velocities in radians per second.
  1707. .SH
  1708. which.h
  1709. .PP
  1710. Including this file is equivalent to #define PUMA for now.
  1711. .br
  1712. .cs R 23
  1713. .DS L
  1714. .B "                            which.h"
  1715.  
  1716. #define PUMA            /* current system setting      */
  1717.  
  1718.  
  1719.  
  1720. #ifdef PUMA
  1721. #define ARMTYPE 1       /* for the interface            */
  1722. #define NJOINTS 6
  1723. #define VALII           /* for the hardware clock       */
  1724. #else
  1725. #ifdef STAN
  1726. #define ARMTYPE 2
  1727. #define NJOINTS 6
  1728. #else
  1729.         not rich enough
  1730. #endif
  1731. #endif
  1732. .DE
  1733. .cs R
  1734. .SH
  1735. hand.h
  1736. .PP
  1737. Macros to operate the pneumatic gripper.
  1738. .br
  1739. .cs R 23
  1740. .DS L
  1741. .B "                            hand.h"
  1742.  
  1743. #define CLOSE   hdpos = 'o';            /* close pneumatic gripper      */
  1744.  
  1745. #define OPEN    hdpos = 'c';            /* open pneumatic gripper       */
  1746. .DE
  1747. .cs R
  1748. .SH
  1749. umac.h
  1750. .PP
  1751. This file defines some useful macros that are self explanatory.
  1752. The dangerous side effects of macros must be kept in mind, for
  1753. example :
  1754. .br
  1755. .cs R 23
  1756. .DS L
  1757.         FABS(dot(vect))
  1758. .DE
  1759. .cs R
  1760. will call
  1761. .B dot
  1762. twice !
  1763. .br
  1764. .cs R 23
  1765. .DS L
  1766. .B "                             umac.h"
  1767.  
  1768. #define SINCOS(s, c, a) {s = sin(a); c = cos(a);}
  1769.  
  1770. #define FABS(a)         (((a) < 0.) ? -(a) : (a))
  1771.  
  1772. #define ABS(a)          (((a) < 0) ? -(a) : (a))
  1773.  
  1774. #define ROUND(a)        ((a - (double)(int)a >= .5) ? (int)a + 1 : (int)a)
  1775.  
  1776. #define TERMIO(z)       do {errno = 0; z; pause();} while (errno == EINTR);
  1777.  
  1778. #define GETCHAR(c)      while ((c = getchar()) == ' '           \\\\
  1779.                              || c == '\\\\t' || c == '\\\\n') ;
  1780.  
  1781. #define QUERY(c)        printf(" (y/n) ");                      \\\\
  1782.                         do {                                    \\\\
  1783.                                 GETCHAR(c);                     \\\\
  1784.                         } while (c != 'y' && c != 'n');         \\\\
  1785.                         {int v;                                 \\\\
  1786.                         if ((v = getchar()) != '\\\\n')            \\\\
  1787.                          (void) ungetc(v, stdin);}
  1788.  
  1789. .DE
  1790. .cs R
  1791. .SH
  1792. exiod.h
  1793. .PP
  1794. This file describes the bit definition of the 'exio' field of the
  1795. .B how
  1796. structure of the real time interface [6].
  1797. .br
  1798. .cs R 23
  1799. .DS L
  1800. .B "                             exiod.h"
  1801.  
  1802. #define  EXTERN0       01       /* external input/output                    */
  1803. #define  EXTERN1       02       /* bit definitions                          */
  1804. #define  EXTERN2       04       /*                                          */
  1805. #define  EXTERN3      010       /*                                          */
  1806. #define  EXTERN4      020       /*                                          */
  1807. #define  EXTERN5      040       /*                                          */
  1808. #define  EXTERN6     0100       /*                                          */
  1809. #define  EXTERN7     0200       /*                                          */
  1810. #define  ARMPWR      0400       /* high power on/off bit  (high/low)        */
  1811. #define  OFFL       01000       /* external low signal to stop the arm      */
  1812. #define  RUN        02000       /* front panel switch - run bit low         */
  1813. #define  RESTART    04000       /* front panel switch - restart bit low     */
  1814. #define  HNDOH      01000       /* close pneumatic hand/release  (high/low) */
  1815. #define  HNDCH      02000       /* open pneumatic hand/release  (high/low)  */
  1816. #define  EXTRA4     04000       /* spare output bit (not wired)             */
  1817. #define  EXTRA0    010000       /* spare I/O bit (not wired)                */
  1818. #define  EXTRA1    020000       /* spare I/O bit (not wired)                */
  1819. #define  EXTRA2    040000       /* spare I/O bit (not wired)                */
  1820. #define  EXTRA3   0100000       /* spare I/O bit (not wired)                */
  1821. .DE
  1822. .cs R
  1823. .bp
  1824. .NH
  1825. Transform Data Base
  1826. .PP
  1827. A very simple data base system is implemented.
  1828. Transforms are stored under their names as set in the `name'
  1829. field of the `TRSF' structure.
  1830. From the programming point of view the following functions can be called :
  1831. .br
  1832. .cs R 23
  1833. .DS L
  1834.         maketdb(name)
  1835.         char *name;
  1836.  
  1837.         savetr(trans, fd)
  1838.         TRSF_PTR trans;
  1839.         int fd;
  1840.  
  1841.         gettr(trans, fd)
  1842.         TRSF_PTR trans;
  1843.         int fd;
  1844.  
  1845.         remtr(name, fd)
  1846.         char *name;
  1847.         int fd;
  1848.  
  1849.         dumpdb(fd, v)
  1850.         int fd;
  1851.         bool v;
  1852.  
  1853.         compact(name)
  1854.         char *n;
  1855. .DE
  1856. .cs R
  1857. .PP
  1858. The function
  1859. .B maketdb
  1860. creates an empty transform data base and returns the corresponding file
  1861. descriptor.
  1862. This function
  1863. .B cannot
  1864. be called, when the real time channel is opened, this is the
  1865. purpose of the option `-D'.
  1866. The function
  1867. .B savetr
  1868. stores a transform under its name in the data base.
  1869. If the transform already exits the user is prompt :
  1870. .br
  1871. .cs R 23
  1872. .DS L
  1873.         change ? (y/n)
  1874. .DE
  1875. .cs R
  1876. if `y' is answered, the value `1' is returned otherwise `0' is returned.
  1877. The function
  1878. .B gettr
  1879. retrieves a transform and sets its value.
  1880. The value `0' is returned, when the transform is found, `-2' if not.
  1881. Both functions print an informative message on `stderr' at the
  1882. time the action is performed.
  1883. The function
  1884. .B remtr
  1885. removes a transform from the data base.
  1886. The value `0' is returned, when the transform is found, `-2' if not.
  1887. The function
  1888. .B dumpdb
  1889. dumps the contents of the data base described by the first argument
  1890. on the `stdout' file.
  1891. The second argument, when non zero, specifies a `verbose' dump.
  1892. The function
  1893. .B compact
  1894. compacts the data base, and permits to save some file space if
  1895. the data base as been extensively used.
  1896. This function should not be called from manipulator programs.
  1897. .PP
  1898. In manipulator programs, use the file descriptor
  1899. .B fddb
  1900. as argument for the data base functions.
  1901. All these functions return `-1' if something goes wrong.
  1902. The messages are :
  1903. .br
  1904. .cs R 23
  1905. .DS L
  1906.         Informative messages :
  1907.  
  1908. savetr : NAME created : DATE
  1909. savetr : NAME changed at DATE
  1910. savetr : NAME added at DATE
  1911. gettr : NAME last change : DATE
  1912. gettr : NAME not found\n
  1913. remtr : NAME removed
  1914. remtr : NAME not found
  1915. dump : NUMBER entries
  1916.  
  1917.         Errors messages are :
  1918.  
  1919. read error on data base file
  1920. write error on data base file
  1921. seek error on data base file
  1922. can't duplicate data base file
  1923. could'nt unlink
  1924. bad magic number
  1925. could'nt creat transform data base file
  1926. open error on data base file
  1927. search error
  1928. data base file saturated
  1929. .DE
  1930. .cs R
  1931. .PP
  1932. A data base editor called
  1933. .I edb
  1934. allows the user to maintain transforms files.
  1935. The user can modify an active transform
  1936. with patches or multiplications
  1937. The active transform can also be read from the data base,
  1938. renamed, or reset to the unity transform.
  1939. Transforms can be added to, changed in, or removed from the data base.
  1940. All combinations are thus allowed.
  1941. When a `break' is typed at the terminal the following message is printed :
  1942. .br
  1943. .cs R 23
  1944. .DS L
  1945. These commands are executed one per line:
  1946.         q               quit and save file
  1947.         q!              quit and do not save
  1948.         d[v]            dump data base [verbose]
  1949.         u <name>        use transform 'name'
  1950.         s               save active transform
  1951.         n <name>        rename active transform
  1952.         :               show active transform
  1953.         r <name>        remove transform 'name' from file
  1954.         i               invert active transform
  1955.         pt x y z        patch a translation x y z
  1956.     p <X/Y/Z> a     patch a rotation a around X, Y, or Z axis
  1957.         pa x y z x y z  patch a rotation defined by a and o vectors
  1958.         pe phi the psi  patch a rotation from Euler angles
  1959.         pr phi the psi  patch a rotation from roll pitch and yaw angles
  1960. These commands are cumulative:
  1961.         mt x y z        multiply by translation x y z
  1962.     m <X/Y/Z> a     multiply by rotation a around X, Y, or Z axis
  1963.         ma x y z x y z  multiply by rotation defined by a and o vectors
  1964.         me phi the psi  multiply by rotation from Euler angles
  1965.         mr phi the psi  multiply by rotation from roll pitch and yaw angles
  1966. .DE
  1967. .cs R
  1968. .EQ
  1969. delim off
  1970. .EN
  1971. .bp
  1972. .NH
  1973. Details
  1974. .NH 2
  1975. Compile
  1976. .PP
  1977. Nothing special about compilations, use UNIX's
  1978. .I cc
  1979. command.
  1980. In order to be able to include the declaration files independently
  1981. from the directory they may have been be stored in, a possibility is to define
  1982. a shell variable, `rccl' say, in your .login or .profile files as
  1983. .br
  1984. .cs R 23
  1985. .DS L
  1986. rccl="-I/b/rccl/h"      for sh users
  1987. set rccl=(-I/b/rccl/h)  for csh users
  1988. .DE
  1989. .cs R
  1990. .NH 2
  1991. Link
  1992. .PP
  1993. Your code must be linked with four libraries :
  1994. .br
  1995. .cs R 23
  1996. .DS L
  1997. rccl.a          The real time version basic library
  1998. dbot.a          The data base library
  1999. rtc.a           The real time channel
  2000. libnm.a         system new math library
  2001. .DE
  2002. .cs R
  2003. .PP
  2004. One may conveniently expand the `rccl' shell variable :
  2005. .br
  2006. .cs R 23
  2007. .DS L
  2008. rccl="-I/b/rccl/h /b/rccl/l/rccl.a /b/rccl/l/dbot.a /b/rccl/l/rtc.a -lnm"
  2009. set rccl=(-I/b/rccl/h /b/rccl/l/rccl.a /b/rccl/l/dbot.a /b/rccl/l/rtc.a -lnm)
  2010. .DE
  2011. .cs R
  2012. Such that you can type :
  2013. .br
  2014. .cs R 23
  2015. .DS L
  2016. $ cc myprog.c $rccl
  2017. .DE
  2018. .cs R
  2019. .PP
  2020. In order to get the planning version, just set a shell variable, `plan' say :
  2021. .br
  2022. .cs R 23
  2023. .DS L
  2024. plan="-I/b/rccl/h /b/rccl/l/rccl.plan /b/rccl/l/dbot.a /b/rccl/l/rtc.a -lnm"
  2025. set plan=(-I/b/rccl/h /b/rccl/l/rccl.plan /b/rccl/l/dbot.a /b/rccl/l/rtc.a -lnm)
  2026. .DE
  2027. .cs R
  2028. and type :
  2029. .br
  2030. .cs R 23
  2031. .DS L
  2032. $ cc myprog.c $plan
  2033. .DE
  2034. .cs R
  2035. .NH 2
  2036. Lint
  2037. .PP
  2038. Linting programs proves to be very useful, set a shell variable, `rlint'
  2039. say :
  2040. .br
  2041. .cs R 23
  2042. .DS L
  2043. rlint="-I/b/rccl/h -v /b/rccl/l/llib-rccl /b/rccl/l/llib-dbot /b/rccl/l/llib-rtc
  2044. set rlint=(-I/b/rccl/h -v /b/rccl/l/llib-rccl /b/rccl/l/llib-dbot /b/rccl/l/llib
  2045. .DE
  2046. .cs R
  2047. and type :
  2048. .br
  2049. .cs R 23
  2050. .DS L
  2051. $ lint myprog.c $rlint
  2052. .DE
  2053. .cs R
  2054. The llib-rccl, llib-dbot, llib-rtc files contain the descriptions
  2055. of the functions compiled and stored in the corresponding libraries.
  2056. .NH 2
  2057. Run
  2058. .PP
  2059. Type :
  2060. .br
  2061. .cs R 23
  2062. .DS L
  2063. $ a.out [-options]
  2064. .DE
  2065. .cs R
  2066. once the channel has been set up and the arm calibrated.
  2067. The options can be cumulated after `-' (except the `D' option) :
  2068. .br
  2069. .cs R 23
  2070. .DS L
  2071. $ a.out -b -v -e -d -g -k -Ddata
  2072. .DE
  2073. .cs R
  2074. is equivalent to
  2075. .br
  2076. .cs R 23
  2077. .DS L
  2078. $ a.out -bvedgk -Ddata
  2079. .DE
  2080. .cs R
  2081. .PP
  2082. You will get the programs
  2083. .I
  2084. calib, mkenc, play, dl ,edb, and dsp
  2085. .R
  2086. if the `path' of your shell leads to
  2087. the right directory :
  2088. .br
  2089. .cs R 23
  2090. .DS L
  2091. PATH=$PATH:/b/rccl/s            (for sh users)
  2092. export PATH
  2093.  
  2094. set path=($path /b/rccl/s)      (for csh users)
  2095. .DE
  2096. .cs R
  2097. .NH
  2098. The display program.
  2099. .PP
  2100. The
  2101. .I dsp
  2102. program uses the terminal in pseudo graphic mode
  2103. like a page editor.
  2104. The user's terminal must possess screen addressing
  2105. capabilities (see termcap(5)).
  2106. The user's session environment shell variable TERM must be set to
  2107. the corresponding terminal (adm3a, adm5, vt100, etc..).
  2108. By default, the
  2109. .I dsp
  2110. program reads files of the form :
  2111. .br
  2112. .cs R 23
  2113. .DS L
  2114.         ../g/file.out
  2115. .DE
  2116. .cs R
  2117. The display of this file is obtained by typing :
  2118. .br
  2119. .cs R 23
  2120. .DS L
  2121. $ dsp file
  2122. .DE
  2123. .cs R
  2124. If no argument is given, the user is prompted.
  2125. .PP
  2126. The program displays files that are a sequence of
  2127. numbers of type
  2128. .B double.
  2129. The program also looks for a file of the form :
  2130. .br
  2131. .cs R 23
  2132. .DS L
  2133.         ../g/t.out
  2134. .DE
  2135. .cs R
  2136. that must be a sequence of same length of numbers of type
  2137. .B int.
  2138. If the file `t.out' has the proper length, these numbers
  2139. will appear in the left column of the display.
  2140. The program also looks for a file of the form :
  2141. .br
  2142. .cs R 23
  2143. .DS L
  2144.         ../g/c.out
  2145. .DE
  2146. .cs R
  2147. that must be a sequence of characters.
  2148. These characters will be used for the display on the basis of a one to one
  2149. correspondence.
  2150. If the character file is not found,
  2151. .I dsp
  2152. uses a `#'.
  2153. The pseudo graphic display is tilted of 90 degrees to provide a
  2154. maximum resolution.
  2155. (low on the left, hight on the right, instead of the usual bottom/top).
  2156. If you do not like the idea of the "../g" directory place in your shell's
  2157. environment :
  2158. .br
  2159. .cs R 23
  2160. .DS L
  2161. GRAPHDIR="the directory you like"
  2162. .DE
  2163. .cs R
  2164. but the planning library assume that the "../g" directory exists.
  2165. The program is interactive and the help message is :
  2166. .br
  2167. .cs R 23
  2168. .DS L
  2169. !*/s/r/u/d/g/h/b/f/a/v/p/q/+-n/?
  2170.  
  2171.         ?       his message
  2172.     +-n     [+,-]digits <space> : direct addressing
  2173.         q       quit
  2174.         p       position display
  2175.         v       velocity display
  2176.         a       acceleration display
  2177.         f       forward one page
  2178.         b       backward one page
  2179.         h       half page forward
  2180.         g       half page backward
  2181.         d       down one line
  2182.         u       up one line
  2183.         r       redraw
  2184.         s       scale
  2185.         @       back to prompt
  2186.     !*      ! <space> file <space> : show another file
  2187.  
  2188.  
  2189. Type any character to continue
  2190. .DE
  2191. .cs R
  2192. .bp
  2193. .NH
  2194. References
  2195. .IP [1]
  2196. Kernighan ,B. K., "The C Programming Language",
  2197. Prentice-Hall, 1978.
  2198.  
  2199. .IP [2]
  2200. Paul, R. P., "Robot Manipulators: Mathematics, Programming,
  2201. and Control", MIT Press 1981.
  2202.  
  2203. .IP [3]
  2204. Hayward V.,
  2205. "Introduction to RCCL : A Robot Control "C" Library",
  2206. TR-EE 83-43,
  2207. October 1983.
  2208.  
  2209. .IP [4]
  2210. "High Speed QBUS-UNIBUS Interface", Engineering Drawings,
  2211. School of EE, Purdue University,  Nov. 1963.
  2212.  
  2213. .IP [5]
  2214. Fisher, W. D., "The Modification of a Robotic Manipulator and Digital
  2215. Controller to Incorporate Both Force and Possition Control", MSEE Thesis,
  2216. Purdue University, May 1981.
  2217.  
  2218. .IP [6]
  2219. Hayward V.,
  2220. "Robot Real Time Control User's Manual",
  2221. TR-EE 83-42,
  2222. October 1983.
  2223.  
  2224. .IP [7]
  2225. Paul, R. P., Shimano, B. E., Mayer , E. G.,
  2226. "Kinematic Control Equations for Simple Manipulator",
  2227. IEEE Transactions on Systems, Man, and Cybernetics,
  2228. Vol SMC-11, No 6, June 1981.
  2229.  
  2230. .IP [8]
  2231. Zhang, H., Paul, R. P.,
  2232. "Determination of Simplified Dynamics of Puma Manipulator", Purdue University.
  2233.  
  2234. .IP [9]
  2235. Paul, R. P., Rong Ma, Zhang H., "The Dynamics of the Puma Manipulator",
  2236. The International Journal of Robotic Research, (to be published).
  2237.