Using Linux in a Control and Robotics Lab
The system file for an actual experiment contains code sections which mediate between floating-point program variables and the binary hardware levels, in addition to the requirements of a simulation file. A file for measuring the response of a servomotor to a constant voltage input is shown in Listing 2. This file illustrates the use of so-called utility code and definition sections in the system file. There is really no restriction on the type of code placed here. The program user guide contains an example of such code written to carry out a recursive least squares identification algorithm using measured data resident in files. The example in Listing 2 is much more modest and uses library include files to abstract the interface board data access.
The include files serve to hide the actual hardware interface behind port access macros like set_dac() for setting digital-to-analog converter levels and get_encoder() for reading the count of the optical quadrature position encoder from the interface boards. The code blocks using these macros are converted to dynamically linked subroutines and repeatedly called by the program main real-time control loop.
This example is really “open loop control” and primarily illustrates the hardware interface provided by the program. Feedback controllers typically employ filtering of the measured data, and the system file for such a controller includes a system code section which implements the dynamics of the filters.
True, certainly we would be in trouble trying to run a print server and a copy of the Apache WWW daemon at the same time that we were balancing an inverted double pendulum. However, in the lab environment, the window manager (preferably Open Look olvwm) and the control environment dlxrun are the only user level applications running. The program dlxlab is an XView application, written in the explicit dispatch mode. This means the timing of the control loop is under control of the programmed loop and not the XView notifier.
As long as the lab machines are provided with enough memory to avoid swapping during the experiments, the effect of timing jitter has a smaller effect than, for example, pretending that the behavior of servomotors is entirely linear. It was originally thought that selectively killing and restarting certain daemon processes would be necessary, but our experience has shown that this is not the case. In any event, one of the aims of control design is to produce controllers which are robust against unmodelled disturbances, and timing jitter provides an example of such a disturbance.
We run lab experiments on machines ranging from a 12MB 486SLC-66 to a Pentium P5-166. There is no problem running the experiments on our set of 486DX2-66 boxes, with sample rates up to several thousand samples per second. The lab machines are on a local network with 10Base-2 coaxial cable, with a salvaged 386DX-16 staggering along as the resident print server.
The Linux machine in my office is running the Apache web server and has a WWW page for our control and robotics lab. The address is http://jhd486.mast.queensu.ca/. The lab page has photos of the lab equipment and links to my home page where documentation, sources and binaries for the dlxlab programs are available.
The dlxlab environment described began life as an awk script that turned a system file (ancestor of the ones above) into an XView control system simulation program, running under SunOS-4.1. After a Linux conversion experience, I came upon a version of the Kernel Hacker's Guide by Michael Johnson and discovered that user level I/O port access was possible under Linux. This allowed the program to accomplish hardware control as well as simulation tasks.
The low cost and wide availability of interface boards for PC-compatible machines make them ideal for a lab such as the one we have set up. The complete openness of the Linux system made it possible to undertake program development with the confidence that it could be made to work. It is also helpful to have the same operating environment in the office, at home and in the robotics and control lab.
Virtual beers all around.
Fast/Flexible Linux OS Recovery
On Demand Now
In this live one-hour webinar, learn how to enhance your existing backup strategies for complete disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible full-system recovery solution for UNIX and Linux systems.
Join Linux Journal's Shawn Powers and David Huffman, President/CEO, Storix, Inc.
Free to Linux Journal readers.Register Now!
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- ServersCheck's Thermal Imaging Camera Sensor
- The Italian Army Switches to LibreOffice
- Linux Mint 18
- Chris Birchall's Re-Engineering Legacy Software (Manning Publications)
- Petros Koutoupis' RapidDisk
- Oracle vs. Google: Round 2
- The FBI and the Mozilla Foundation Lock Horns over Known Security Hole
- Privacy and the New Math
Until recently, IBM’s Power Platform was looked upon as being the system that hosted IBM’s flavor of UNIX and proprietary operating system called IBM i. These servers often are found in medium-size businesses running ERP, CRM and financials for on-premise customers. By enabling the Power platform to run the Linux OS, IBM now has positioned Power to be the platform of choice for those already running Linux that are facing scalability issues, especially customers looking at analytics, big data or cloud computing.
￼Running Linux on IBM’s Power hardware offers some obvious benefits, including improved processing speed and memory bandwidth, inherent security, and simpler deployment and management. But if you look beyond the impressive architecture, you’ll also find an open ecosystem that has given rise to a strong, innovative community, as well as an inventory of system and network management applications that really help leverage the benefits offered by running Linux on Power.Get the Guide