Magic Smoke
   


Once the magic smoke comes out, it won't work any more.

John Kasunich
jmkasunich@fastmail.fm
GPG Key

Postings:

Index (titles only):

If you are into RSS, you can Subscribe to a syndicated feed.


Links


Friends


I Support

Individual Rights

Electronic Frontier Foundation


Powered by



       

Sun, 04 Feb 2007

Open GL "Simulated Machines" for EMC2/HAL

I've wanted to be able to render a "simulated machine" on screen for quite a while. In addition to the coolness factor, it would be very handy for testing non-trivial kinematics code. Very few developers have access to any hardware with non-trivial kins. Such machines tend to be very expensive, and more vulnerable to damage than a conventional machine if something goes wrong. In the past, we've discussied the idea of a simulator a bit on IRC, but the work involved always seemed like too much, and I've always dropped the subject.

Yesterday Alex Joni was doing work on Puma robot kinematics, and the subject came up again. We talked about it for a while, and again, it seemingly got dropped. But a little later, Jeff Epler posted army.py and army.hal. ("army" has nothing to do with the military. Its called "arm - y" because it draws a representation of a robot arm.) The Python program uses the Open GL infrastructure that Chris and Jeff developed for Axis, which really cuts down the amount of coding needed to get an image on the screen. "army" draws a simple three segment robot arm, controlled by HAL pins, and animated as the values of the pins change. Below is a screenshot:

When I saw that it kicked my enthusiasm into high gear. I asked Jeff lots of questions before he went to sleep, then I start hacking on the code. Chris also joined in, writing a box primitive to go along with the cylinder/cone one that Jeff wrote. I tweaked both primitives to make them a little more convenient to use, then started writing a definition for the Puma robot arm. The finished files are puma.py and puma.hal. Copy them to the top level directory of your EMC2 CVS checkout, and run them like so:

. scripts/emc-environment
halrun -f puma.hal

The result is a 6 DOF (seven if you count the gripper) Puma style robot, doing its dignified dance under the influence of seven HAL siggen blocks.

I'd like to split puma.py into two pieces, one of which handles all the dirty work (graphics setup, implementation of primitives and transforms, etc) and another that defines the machine you are simulating. That would allow easy conversion to other types of machines. But I need to talk to the Python experts to do that. (I also need to ask Jeff why the background turned pink!)

(posted: 04 Feb 2007 06:23) (permalink)