Mumbling heard from behind a desk in a remote corner: "'Lobotomy, I'll give that Nora a lobotomy SHE won't forget!" (See: http://share.crustcrawler.com/JohnR/LobotomyProtests.htm)
Before I even purchased the Nomad, I know that the supplied walking gait code, and even the BOE were not long for this world. I know that I would be replacing the BS2 with a Propeller, and writing my gait code. This was one of the specific things I wanted to do for "fun". Before you call the funny men in their clean white coats, you should know that my family already has, and thus far, I've been able to escape capture. Yes, I admit that my idea of "fun" can be a bit twisted at times. (maybe even always)
While I'm not ready to do the lobotomy yet, I have made some progress, and thought I'd share what I've been up to.
I like to be able to do things "incrementally". That is, I tend not to "shoot for the whole shebang", but set myself up for success one step at a time, and try to leave things functional along the way. This is why the Nomad is still sitting with the BOE and PSCs intact. For now.
Off to the side, or maybe a little to the front and side, I've got a propeller robot controller board sitting, along with an S3 tilt/pan unit and a set of flight controls (the little angel in the background is my God-daughter):
I've been working on setting up PC/Propeller communication, and also a Windows based application for controlling the robot. This user interface will support multiple types of input, including mouse, keyboard and joystick.
Short term, the idea is to get the propeller able to receive commands and send back responses (and data) from/to the PC. Most, or all, of the actual "thinking" will be done by the PC based software. I will be doing the "lobotomy" before I have a walking engine.
Once the base software is working, and the PRC in place on the Nomad, I'll start working on the walking engine on the PC side, where I've got more "power" in terms of math and processing. The PC side will send servo positioning commands to the prop.
Once that's working, or partially working, I'll start looking at making the prop "smarter". Long term, I hope to have a walking engine "onboard". At a minimum, I'll get some "smarts" in place that will allow me to send the Nomad a "LegPosition" command, that will allow one command to set all three servos on one leg.
With my minimal amount of experimentation, I've already learned a lot, and until I have a better feel with what works and what doesn't, the final design is very much in limbo, and seems to change daily (or hourly). I really don't have the final end point figured out, and don't want to yet. After all, this isn't a project for work, this is a hobby!
Initially the PC side software will just be a way to manually manipulate servo positions, and also see the feedback from any sensors I put onboard (there are currently none).
The Propeller or Prop, is a 32 bit 8 processor (cog) chip from the fine folks at Parallax. (See: Parallax Propeller Home Page ) It can be programmed in either Spin (a sortakinda Basic language) or assembly (If I have to, and only if I have to). There are also a slew of "objects" available to use with the processor (Propeller Object Exchange). I'm using the SERVO32 as well as FullDuplexSerial and an Enhancement to FullDuplexSerial. As a result, the code I need to process a servo position command from the PC is a whopping 13 lines or so!
The Propeller Robot Controller is a "carrier board" for the propeller created by Wulfden. As of late January, 2007, they are about to release an updated version. Here's a link to the Wulfden PRC page: (Wulfden PRC Home Page), and here's a low quality picture (too lazy to get the tripod out, and the flash made too much glare):
I will probably design my own circuit board at some point (one of my personal goals), and would do a couple things different. The biggest thing I'd do different is provide a jumper so that I could disconnect the reset line from the USB2SER connection. This would allow more robust use of this connection for PC/Propeller communication. If you use the programming port for PC communication, you risk resetting the propeller if the communication software (e.g. hyper term) messes with the DTR line. For now, I've got a "Prop Plug" hooked up for PC communications. (Note that you can use the programming port, you just need to understand the ramifications.) I've also found this setup to work nice in that I can leave the IDE connected to the prop while still using other software to communicate with the propeller.
With this setup, I also won't be using the Parallax Servo Controllers. The SERVO32 object running on the propeller provides this functionality (for up to 32 servos), and the PRC provides connections for up to 28 servos, including separate power supplies for the servos. (The servos can also be supplied by the same power supply that powers the propellers.) There is also a breadboard area to work with (the same size as the BOE).
The PC side software, as of now (January 21, 2007 @ 3:11 PM CST [GMT -6] is "rough" as an understatement. It was used for several purposes, and has served/is serving them well, but it looks like hell, and the code has as much blocked out with "block" comments as it does running code. There are also a number of "If (false)" statements, generating the wonderful "Unreachable Code" warnings! I used this "application" to explore how to connect to and read a joy stick, work out communications with the propeller, and to explore how I wanted to build the user interface.
My background is a "business systems programmer" and "IT Manager". If you asked me to come in and write you a Customer Order Processing System, Document Management System, Data Collection System, Product Configurator, etc., for a small fortune, I'd get you get one heck of a product from me, and you're users would love it, productivity would go up, and world peace would follow. (Well, maybe not the world peace.) Alas, I've settled down to a 'real job' as an IT Manager here and town, and don't do the consulting thing anymore. Back on task: That stuff is all good and well, but doesn't equate to writing software to manually control an 18 DOF robot (more once PTZ sensors arrays are added). You also don't find too may Flight Controllers in the business environment. The last "entertainment" program I wrote was a 4 ball pool game on a Commodore 64. (I forgot about friction the first pass, and the chances of at least one ball finding a parallelogram to carom around in are pretty high!)
As a result, it took some time to learn how to work with joysticks, and provide a user interface that can be manipulated with a mouse, the keyboard, and/or joystick. Here's a screen shot, and then I'll talk about some of the stuff on the screen:
The drop list in the upper right will show a list of what "controls" the attached game controller has. I was hoping to select from this list to correlate the input to an "on screen" element. I couldn't find an easy way to do this, and not needing to worry about multiple types of game controllers, said, "enough of this noise" and moved on. (It does display a nice list of controls available, unfortunately the names have no correlation of how you access the input with DirectX.) I'm using a Saitek X45 Flight Controller. I'd like to get my hands on one of the newer X52s (or the X52 Pro), but that's half my battery budget, so this will have to do. I had it around for a couple flight simulator "games" I have, and it has lots of buttons, "hats" and 6 axis or sliders (the joystick (2), throttle, rudder (on the throttle) and two "rotary knobs"). The X52s also have a rotate on the joystick, and this would be sweeeet for controlling a Nomad (X and Y for movement control, twist to "spin in place"). Maybe my sweetheart will get me one for Valentines day.
The "Use Joy Stick" check box turns the joystick (actually all game controller) input on and off. With the joystick "on" the mouse and keyboard inputs are disables (this prevents "fighting"). The spinner with the 20 in it lets me adjust the "refresh" rate that joystick commands are processed at. It represents milliseconds. More on that latter.
The text box, Send button, and drop list with COM8 in it and the check box next to it, are all part of the serial communication setup and testing. The Send button will send any text in the text box out the serial port. This let me manually test commands. The drop list displays a list of com ports, and the check box opens the selected com port and establishes communication with the prop.
The upper left corner was my initial work with joystick input. the vertical slider is the "Y" axis of the joystick, the horizontal the "X". the spinner above the horizontal is the value of the X axis, and the spinner below is the servo the slider is controlling. These are all separate controls. The horizontal slider inside the "Custom Control" is a custom control that I put together. It might get a little more work, and there will also be a horizontal version made. The control set works just like the separate controls, but they are all tied together, and it "acts" like one window control. If you "set" the control to 1200, the value spinner, as well as the slider will get set to 1200. If you move the slider, the value spinner (and control value) will change as you move it. If the associate joystick value is changed, all values of the control change also. The "servo channel" spinner is also integrated with the control, and from within the software, it appears as a "property". The custom control also has an "ExternalControl" property, and when this is "set", the manual input (slider and spinner) are disabled. They still change with the control's value, but can not be manipulated "manually".
The set of three checkboxes in the lower left is some testing to sense when control buttons are pressed. The spinner to the right of checkBox3 allows me to set what button checkBox3 is "looking at".
Inside the software, I've been working with various ways of passing the servo positioning to the propeller. I was using the joystick to pan and tilt the S3 with the joystick (or other "sliders" on the flight controller), and work with various "schemes" and command structures to talk with the propeller.
There were several things that had to be worked out. The first was keeping the two sides in sync, and providing a mechanism for them to get back in sync if there was noise or other problems with communication. That's resolved for now, but may need to get "enhanced" as additional features are added. I also needed to develop an extensible command set for sending information back and forth. I don't know that this is fully resolved, but a good foundation is in place. Lastly, all of this needs to happen fast enough so that the servos work smoothly. At one point I had things slowed down during some debugging, and the control was a bit "coarse". Eventually the servos would get where you wanted them, but in the mean time, it could take a while for things to stabilize. This will be an ongoing battle. With just two axis, I can get the refresh rate down at or even well below 20 milliseconds. This matches (or is faster than) the servo refresh rate, so that's quite good enough, thank you. Once I get 18 or more servos online, this might be another story, and we may be back to ground zero on all three of these inter-related issues.
The next steps are to tweak the custom control for the servo axis. I also need the Vertical version. Then I need to get the joystick laid out on a windows form. Somewhere along the line, I probably need to get a "fresh start" on the application. The custom controls will be the heart of the user interface, and should move over nicely. Moving the serial communications and command routines will give me an excuse/reason to clean up some of the junk.
Then I'll be ready to do the "lobotomy" and put the PRC on/in the Nomad, and start working.
Initially, I just map the servos for one or two legs to the PC software. After that, I'll start working on some kinematics to generate leg motion based on position requests (put the foot at coordinates (X, Y, Z)) and finally a walking engine.
Somewhere along the line, I'll need to expand the command set to/from the propeller. Currently, I only have a "servo position" command that returns an acknowledgment. I want to get some more complex commands for leg movements (possibly by developing a "leg" object on the propeller that "knows" where it is, and how to move to various positions and/or coordinates), and also commands for getting sensor readings from the Nomad to the PC.
I have an array of sensors to work with, and as they say, you can always buy more. I've got GPS, compass, tilt as well as Ping:)) and IR sensors. Plenty to work with, and I've got a few other ideas too. I'm also exploring wireless IP cameras. I found one I really like, but it's a bit pricey (about the price of a complete Nomad with standard servos), and I don't think it would tilt low enough to see where the legs are touching down, so I'm still looking for alternatives.
I'm also doing the communication with a USB cable. I want to switch this to an IP stack, and will be ordering a WiPort adapter for the Nomad. I'll start with the "wired version" and the wireless (802/11b/g) is a pin for pin drop in replacement. (The No radio version is $45, vs $126 for the Radio version, and I have other users for the wired version down the road.) The propeller side shouldn't need much in the way of changes, and the PC side will need changes, but they should be minimal, and the communications are are "compartmentalized" so there will only be one or two places where the changes will need to be made.
Once the thing can move without wires for communication, I'll have to bite the bullet and get some batteries. I've been holding off because I don't know what the camera power requirements will be, or how much juice the 802/11 stuff will draw. I don't want to have a battery pack that's good for 5 minutes and then needs an hour to charge. With things still in "tethered" mode, there's no hurry yet.