Using Linux in a Control and Robotics Lab
The Mathematics and Engineering program at Queen's University in Kingston, Ontario operates a control and robotics laboratory as part of the course offerings in the control systems area. The lab experiments use our custom-built electro-mechanical setups and require the students to write algorithms in C for controlling the hardware.
The lab began using C under DOS as the software environment for the lab experiments, but not all students had an easy time with the environment. Generally, it was too easy for configuration files to be inadvertently changed with frustrating consequences. Subsequently, an integrated experiment environment known as dlxlab has been developed for simulating and running control lab experiments. It consists of a single program, run as dlxsim for simulations or as dlxrun for controlling hardware experiments. The program was developed using the XView toolkit under Linux (see “Programming with XView” by Michael Hall, LJ, March 1998), and operates in the lab on a variety of PC-compatible hardware running Linux 1.2.13.
The students taking the lab vary widely in computing background and skill. The primary intent of the control labs is to investigate the application of control theory to actual motors, carts, inverted pendula and so on, without having software operation dominate the experience. On the other hand, understanding low-level interfacing code is also a desirable outcome, so the hardware interface has to be “visible”.
In order to design a control algorithm for a physical system, one must have a mathematical model of the system to be controlled in the form of either differential or difference equations, and knowledge of the physical parameters in the model. The user interface to dlxlab was designed so that, as far as possible, this is the only information that must be supplied by the user.
This goal is attained for the case of the program running in simulation mode. For the situation where actual hardware is being controlled, information describing the hardware interface must also be provided, although it can be largely hidden from the user through header files.
The user input to the program takes place through interactive construction of a system file which describes the system under investigation.
To simulate a system, one invokes dlxsim with a system description file as argument.
dlxsim sim.sys &
One of the lab experiments consists of a pair of track-mounted carts, coupled by springs and driven by a servomotor. A simple system file for simulating such a pair of spring-coupled carts is shown in Listing 1. The format of the system file is a sequence of begin ... end delimited blocks. The blocks are of two types:
Definition blocks establishing identifiers for variables (including parameters)
Code blocks containing C code sequences which are executed by the program to initialize variables, as well as numerically integrate the governing differential equations to simulate the system
The main program panel (see Figure 1) contains a “Build” button, which when pressed causes processing of the system file. That is, the user system file is converted into a series of C code files by a parsing process. The files are compiled to a shared object file by gcc, and the contents of the resulting shared object module are dynamically linked into dlxsim as it runs. The linked code contains not just the system differential equations, but also modules for interactively manipulating parameters and plotting results on the basis of the variable names provided in the system file.
Assuming that the system file contains no syntactic errors, the program log window contains only progress messages, and a pop-up panel for controlling simulations appears (Figure 2). As long as only parameter changes are made, a series of simulation runs can be made. Plotting and printing is handled by gnuplot running as a child process.
If the system file contains errors, the error location is reported in the log window, and the pop-up does not appear. The errors are caught either at the parsing level or within the C code segments. In the latter case, the error messages from gcc refer to lines in the user system file, since the generated C files include #line statements referring to the user system file. Since the dlxsim system file edit window is an XView textsw, it inherits the line searching menus associated with XView applications.
Simulations can be run and plotted, as long as the system file contents (such as variable names, equations of motion and so on) are not changed. If such changes are made, the “ReBuild” button must be invoked to cause freeing of resources, recompilation of the dynamic module and relinking of the generated codes.
Practical Task Scheduling Deployment
July 20, 2016 12:00 pm CDT
One of the best things about the UNIX environment (aside from being stable and efficient) is the vast array of software tools available to help you do your job. Traditionally, a UNIX tool does only one thing, but does that one thing very well. For example, grep is very easy to use and can search vast amounts of data quickly. The find tool can find a particular file or files based on all kinds of criteria. It's pretty easy to string these tools together to build even more powerful tools, such as a tool that finds all of the .log files in the /home directory and searches each one for a particular entry. This erector-set mentality allows UNIX system administrators to seem to always have the right tool for the job.
Cron traditionally has been considered another such a tool for job scheduling, but is it enough? This webinar considers that very question. The first part builds on a previous Geek Guide, Beyond Cron, and briefly describes how to know when it might be time to consider upgrading your job scheduling infrastructure. The second part presents an actual planning and implementation framework.
Join Linux Journal's Mike Diehl and Pat Cameron of Help Systems.
Free to Linux Journal readers.Register Now!
- Paranoid Penguin - Building a Secure Squid Web Proxy, Part IV
- SUSE LLC's SUSE Manager
- Google's SwiftShader Released
- Managing Linux Using Puppet
- My +1 Sword of Productivity
- Murat Yener and Onur Dundar's Expert Android Studio (Wrox)
- Non-Linux FOSS: Caffeine!
- SourceClear Open
- SuperTuxKart 0.9.2 Released
- Parsing an RSS News Feed with a Bash Script
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide