- Interactive Motion Control -

Information Hardware Software Example Code

Software Configuration

Mechatronic systems have become a valuable part of every manufacturing industry. Each mechatronic system utilizes its own language or communication device in order to be controlled. For example, typical robotic systems come prepackaged with their own robotic language and many motion controller boards available on the market today utilize their own language to control any system attached to it. Creating a workcell made of multiple mechatronic systems can be difficult and tedious due to all of the different languages that must be utilized. Manufacturing companies typically purchase equipment from the same company which reduces the need to learn new mechatronic system languages. This can impede the abilities of the manufacturing company by limiting their ability to purchase mechatronic systems that can further help their business or improve it. Using Ch, all mechatronic systems can be controlled under the C/C++ language and one environment.


Ch is a C/C++ interpreter that allows users to run C/C++ code interactively by either entering the code at a prompt, putting the code into a Ch script file, or writing and program and running the program from the prompt without compilation. The main idea behind this project is to allow users to control a Turbo PMAC2 through the use of Ch. This would give users the ability to run motion programs interactively.

Motion control programs can be lengthy requiring lengthy recompilation when mistakes are made. When a mistake has been encountered, getting the motion system back to the same state it was in when the problem was encountered can be tedious and almost impossible since the motion system's environment would have changed. Utilizing an interactive motion control system would allow users to easily overcome any problems encountered without having to stop the system, check the motion program for errors, recompile, and re-run the system from the beginning. Most motion systems utilize their own motion language. Utilizing Ch with a PMAC board would allow any user to program their motion system utilizing the widely known and used C/C++ language.

Ch also comes with CGI capabilities allowing users to create websites giving users around the world control of their motion system. Ch also helps out with any numeric calculations that may be required by providing users with a new 'array' type and numerical functions. Ch also has plotting capabilities allowing users to plot motion paths along with velocities or accelerations. The figures below show example of plotting position and velocity versus time.

Position vs. Time

Velocity vs. Time

Motion Control using Ch

The control of any mechatronic system is done using the available C libraries and functions from the system's manufacturer. Ch Software Development Kit (SDK) allows users to port the C libraries and functions into Ch space by creating Ch packages that bind to the C space libraries and functions. Once that is done, the functions can be called under Ch space with the same ease as user defined functions. Figure 1, shows the architecture overview of how Ch communicates with a mechatronic system.

Once the libraries and functions have been ported over to Ch and the Ch packages created, there are three different ways users can communicate with their mechatronic devices. The first way is to utilize Ch's ability to interpret C/C++ at the prompt. Users can simply type in function names and commands at the prompt and control the mechatronic system. This gives users interactive control of their mechatronic system making debugging and problem solving easier. The second way, after testing a system by interactively controlling it, is to utilize Ch's ability to interpret C/C++ by placing the user's interactive code into a C/C++ file and running that file as a program. C/C++ files can be readily run at the prompt by typing in the name of the file. The third way is to then compile their programs into a binary executables allowing users to create optimized programs.

The Ch PMAC package is an open source Ch binding to Delta Tau's PComm32 library. With Ch PMAC, all C (or C++) programs utilizing functions in the PComm32 C library can readily run in Ch interpretively without compilation.