• No results found

The servo-motors for biceps, brachialis and triceps control communicate on an RS-232 serial comm link. Thus, motor displacements must be converted to ASCII strings and addressed to each motor specifically. Besides motor displacements, there are other types of motor commands, such as E-STOP (emergency stop) and status requests. The software developed in this work is highly parallel in order to maintain real-time execution. Thus, motor status and E-STOP commands can originate from several sources. This leads to a common computer resource problem. The motor comm channel is the resource that must be shared. However, if all programs that have access to the motor comm channel are allowed to send commands whenever they want, then collisions can occur. At best, a collision may cause a motor displacement to be missed. At worst, a collision may cause an E-STOP command to be missed. Therefore, motor comm channel resource management is also a safety issue.

When the simulator is running, the motor comm channel is continuously transferring motor displacement commands, making the likelihood of motor command collisions very high during this critical phase. Thus, comm channel management is not merely academic, but quite necessary.

The motor server software developed in this work is based on a client/server design. Only one component of the motor server has direct ownership of the motor comm channel, and all motor commands pass through it. For a program to access the motor server, it must acquire permission, and this is done using a semaphore model of resource allocation. In computer science, a semaphore is a protected variable or reference that provides a simple but useful abstraction for controlling access by multiple processes to a common resource in a parallel programming environment.(Dijkstra, 1965) In this case, only one program can possess the semaphore at any one time, and the semaphore will not be granted if another program is in possession.

The block diagram in Figure D.1 illustrates how motor comm allocation is implemented for motor displacement commands. The motor server, and most of the

Figure D.1: Scalable Motor Displacement Server with Resource Allocation

cement Server with Resource Allo

cation

lacemen

ts are corrected for shaft rotation directi

on, and then sent to the motors th

rough a serial comm link.

ts are not sent in order to save ba

ndwidth. A semaphore is acquired before

m

itting the disp

lace

me

nts, and then released

simulator software, is designed to be scalable. Scalability means that different numbers of motors or other actuators, and even trackers and force transducers can be operated without needing to change the software. Scalability makes it possible to add actuators for more muscles, or to use more or even fewer transducers. Given that the entire software suite is very large and complex, scalability can greatly facilitate development. In this example, scalability is implemented with arrays. N motors are identified by N motor reference numbers in an array. A corresponding N number of displacements and motor tension directions also exist in arrays. When the software suite is initialized, N is set to the number of muscles that will be actuated by servo-motors, and all such arrays are initialized to size N. This architecture takes advantage of a computer’s innate abilities to allocate memory spaces for arrays, and to rapidly index and traverse array structures in real-time.

Calculations on array elements are all performed simultaneously. For example, the multiplication and logical tests in this example are performed on all elements of the arrays at once (at the program execution level). This highly parallel design also takes advantage of scalability and rapid array traversal by indexing all the arrays simultaneously at the For Loop. Since there is only one motor comm channel, the motors cannot be commanded in parallel. However, this limitation does not slow performance because the RS232 link is the slowest component, and sending the motor commands individually easily keeps up with the serial link speed.

Motor displacements (shaft increments) which have been calculated, first get corrected for shaft rotation direction (clockwise: 1, counter clockwise: -1). This is the direction in which the motor can apply muscle tension. Clockwise indicates that the cable is spooled around the motor spool in a counter clockwise direction, so that clockwise motor displacements increase muscle tension. Before transmitting the displacements, a motor comm channel semaphore is requested. If any other program is communicating with the motors, then this program must wait. Since all motor commands are very short, wait times are generally less than 5 ms. If the wait period takes more than 500 ms, then and error is generated which propagates through the entire system, causing a safety shut down.

Displacements that are less than 5 increments are not transmitted to the motor. If all the displacements in the array are less than 5, then no communication is attempted and no semaphore is requested, thus avoiding unnecessary usage of comm channel bandwidth. Since the RS232 serial comm link is the bottle neck of most any system, it is important to avoid extra comm traffic. Also, motor displacements for all motors are sent with one semaphore, rather than acquiring and releasing N semaphores for N motors. This is logical since the motor displacements are synchronized and need update the motors simultaneously. If the semaphore was released after sending the motor displacement for motor 1, then another program might acquire the semaphore, causing a delay in displacement commands for motors 2 and 3. Thus the current design ensures motor synchronization.

D.1

R

EFERENCES

Dijkstra,E.W. (1965) Cooperating sequential processes. Technological University, Eindhoven, The Netherlands.

APPENDIX E

COPYRIGHT RELEASES