One of the salient features for Ch is its capability in importing existing binary static and dynamic C libraries using Ch SDK. Ch and C in binary library have their own name space by which a function in the C space cannot directly communicate with a Ch space function. The binary libraries can be integrated in Ch without recompilation. A Java program can also execute C/C++ scripts through JNI and Embedded Ch. The network computing capability of Java can be enhanced with ChJava. Portable C/C++ scripts can be invoked through CGI. Using a Java applet, Ch scripts can be invoked either in a client side or in a Web server. In case of the client side invocation, the client machine needs to be installed with Ch and ChJava. Ch scripts can also be invoked in a Web server through java applets through either CGI or JSP. In case of JSP, the downloaded applet calls a JSP which in turn calls a Java class with a JNI function. This JNI function invokes a native function which runs the Ch script as described in the previous section. Ch scripts can also be directly accessed through Java applets using CGI. Both these methods are described in detail in the remaining section. Running a Ch script in a server through an applet can be performed using CGI toolkit [14]. One of the most important applications of CGI is handling fill-out forms and generates Web pages dynamically. The communication with the Web server can also be done through Java Server Page (JSP). When the GUI component in a Java applet is activated, the applet sends the corresponding values through the GUI to a Java Server Page. To utilize JSP, Tomcat Web server is used and it is connected to the Internet Information Server (IIS) using Tomcat connectors for better performance. A Java applet invokes the required native function in the library file to perform the required action. This native function invokes embedded Ch and sends the values to the Ch script. To securely access the local resources, signed applets are used. The syntax of ChJava is exactly the same as the C
interface to Java and there is no need for the developer to learn any new syntax. In case of invoking a Ch script from Java, the native function has to accommodate a set of APIs by which communication to Ch script is created, maintained and destroyed. To illustrate application of ChJava for control of mechatronic system, a Barret robot manipulator hand is controlled using ChJava. The ideas and concepts can be applied to control the other mechatronic systems. To control a Barret hand, a Ch package ChBhand is used to interface with the hardware in Ch scripts. The mechatronic system under consideration has three fingers which can be manipulated through a serial port. This manipulation is done using a Ch script but controlled from Java. We developed a GUI in Java that has three buttons Start, Reset, and Stop to start, reset and stop the system, respectively and four slides, one for rotating fingers 1 and 2, the other three for control of three individual fingers. A Web page with an applet having the same GUI can also be used to access the Ch script to manipulate the mechatronic system in a remote location through CGI.
0 comments:
Post a Comment