May 18, 2024, 03:11:16 AM

News:

Be sure to checkout our Vixen interfaces in the Library forum -- if you want PC automation at near zero cost, EFX-TEK and Vixen is a great combination of tools.


Converting a Robo-Ware program to an HC-8+

Started by JackMan, June 22, 2012, 08:56:22 PM

Previous topic - Next topic

JackMan

I'm thinking about the possibility of the HC-8 running one of my more complicated props instead of using my laptop. This part of my show consists of (2) 3-axis skulls with jaw and eye movement (MJ and Vincent Price doing Thriller). The existing program is about 5 minutes long and uses ROBO-WARE software for streaming serial commands to Mini SSC's for servo control. This program took me forever to write and tweak and it's not 100% reliable due to the audio from the laptop not always being in perfect sync with the serial commands. There's no rhyme or reason for this and I never know when it might screw up. Do you think there's a way to hack the HC-8 so this string of serial commands could be put on an SD card and sent to the HC-8+ and then out to the Mini SSC's so I can get rid of the laptop? I would use an AP-16+ for the audio track. Unfortunately Robo-Ware doesn't have an export function and this program runs at 20 FPS. Thanks!

JonnyMac

How many servos are involved?

If eight or less I would suggest we write an SSC-32 compatible servo driver (I actually have one almost finished) and add a capture facility to that.  I would capture in the raw data format that is used by VSA as I have code that will read that back and drop it into any driver I like, including my advanced servo driver (that is based on the SSC-32 feature set).

This probably won't be easy, but with a bit of effort I think we can do it.
Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

Here's another thought: What does your script for RoboWare look like? Maybe I can write a parser to read and process it.  It might in fact be easier than capture and playback.  If it works, you could copy your script (assuming it's a text file) to the uSD card and play it from an HC-8+.

Can you post a bit for me to look at?
Jon McPhalen
EFX-TEK Hollywood Office

JackMan

There's a total of 10 servos for the two skulls.  The program is writen for each servo so there's ten strings of code. The jaw codes are really long. The program uses 2 basic commands, WAIT and MOV. The WAIT command is followed by the number of frames to wait. The MOV command is followed by the servo position to move to and how many frames it takes to get to that position. Here's a very short sample of the script for one jaw servo.


Wait 788
Mov 75, 1
Mov 125, 1
Wait 4
Mov 65, 1
Wait 2
Mov 125, 1
Wait 2
Mov 65, 1
Wait 2
Mov 125, 1
Wait 2
Mov 65, 1
Wait 1
Mov 125, 1
Wait 1
Mov 55, 1
Wait 13
Mov 125, 1
Wait 2
Mov 55, 1
Wait 8
Mov 125, 1
Wait 6

Mov 65, 1
Wait 1
Mov 125, 1
Wait 1
Mov 65, 1
Wait 1
Mov 125, 1
Wait 1
Mov 55, 1
Wait 2
Mov 125, 1
Wait 1
Mov 65, 1
Wait 2
Mov 125, 1
Wait 1
Mov 55, 1
Wait 2
Mov 125, 1
Wait 2
Mov 65, 1
Wait 2
Mov 125, 1
Wait 1
Mov 65, 1
Wait 2
Mov 125, 1
Wait 1
Mov 65, 1
Wait 2
Mov 125, 1
Wait 1
Mov 65, 1
Wait 1
Mov 125, 1
Wait 2
Mov 55, 1
Wait 18
Mov 125, 1
Wait 32

JonnyMac

I'm working on an EFX-TEK client project right now where we have to parse lines like that from an SD card, so I think parsing your script is going to be easier than capture and playback.  You say the frame timing is 20Hz? 
Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

Here's the first step: opening and reading, line-by-line, the Robo-Ware file; I created a new template for the HC-8+ that provides for file I/O. 

The next step is parsing each line, then sending a servo command when needed.  Finally, putting the line parsing into a timed method that allows you to control the speed at which the file is parsed and servo commands transmitted to your display.

It occurs to me that we will have to use one of the servo headers to send data to your servo controllers.  I don't think this will be a problem, but I've never done it.
Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

June 23, 2012, 10:52:33 AM #6 Last Edit: June 23, 2012, 12:19:23 PM by JonnyMac
What version of Robo-Ware are you running?  I ask because I found this image:



It shows channel and position for the MOV token.  It also uses PAUSE instead of WAIT.

That said, I got a start on a parser based on the text you provided.  As I like to build things step-by-step I tested the parser with a little program that measures the time required to read a line from the file and extract the command and values.  In the output screen shot you can see that this never takes more than 3ms which means there should be plenty of time to send appropriate serial commands.

I've attached the test program so you can start to get the hang of things.  The Propeller is very powerful and that power takes a little time to wrangle -- not much, but it does take time.  Start now! ;)
Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

QuoteThe program is writen for each servo so there's ten strings of code.

There is a one-file-open limit with the Propeller so if you have multiple files for your show, they will have to be merged into a single file for reading, parsing,and output.  PCs have huge memory buffers that allow multiple open files; we can't do this in the microcontroller world.
Jon McPhalen
EFX-TEK Hollywood Office

JackMan

I'm using v2.0  Here's a link to more info on it, you can download the info and some screen shots.
http://www.rentron.com/Robo-WareV2.htm

Yeah, I'm running this program at 20 FPS. Even though there are ten strings of code, each one corrisponds to a specific servo so they are all part of the total program. When you click on a specific servo in the software it brings up the string of commands for that servo. All of the serial commands are sent via a 2 wire phone cable to the first Mini-SSC. The 2nd Mini-SSC is daisy chained to the first one with each having a different address, just like a lot of your boards. I appriciate your time on this, I hope it's doable without too much effort on your part.

JonnyMac

I can't guarantee success; just that I'll try.

We must always remember that we're not able to access the data on the SD card as fast as your home PC can.  This is why I was hoping for an binary export (no time required to parse and convert ASCII to values), and doing critical timing tests just to see just what we could do in how much time.

Quote...so they are all part of the total program.

That is to say you can create a single, unified script for the entire show, correct? Can you provide that as an attachment? I'm certain I'll need to modify the parser so that the servo channel # is included in the command.
Jon McPhalen
EFX-TEK Hollywood Office

JackMan

Here's the complete list of servo #'s and the commands. Robo-Ware also has settings for the "Home" position of each servo so when the Mini-SSC's get powered up it moves each servo to that position and holds it there until a command is sent. In addition, there's settings for the MIN and MAX position for each servo so no damage can be done from over-driving a servo. I don't think we need to worry about that with what you are attempting.

JonnyMac

Sorry if I wasn't clear, but we can only open and play one file at a time.  Somehow, those files need to be merged into a single file that is the show.  Perhaps this is where Robo-Ware is having problems; having multiple files open at the same time and attempting simultaneous access may be upsetting the apple cart (in PCs we can have a lot of files open, but we don't tend to be trying to read them all at once).

If you can get/make a single file that will be great. You can also create a file called "home.txt" that the HC-8+ can read at start-up and end-of-show to move the servos to the positions you want them.
Jon McPhalen
EFX-TEK Hollywood Office

JackMan

You were clear about the single file dilema, the Robo-Ware program is actually a single file but only allows you to look and write each servo individually. Each servo is assigned a number and a name when you write the script but the servo # doesn't show in the commands. When the program is executed it sends all the serial commands simultaneously to the Mini-SSC's. I'm still thinking it might be easier to somehow capture the actual serial commands as they are sent from the program but you would know much more about the best approach to this than I would. I may be forced to completely re-write the whole thing using an advanced version of VSA. I really don't want to do that, I know it will take me forever. If anyone can figure out a way to do this it's definitely you! (No Pressure!)  ;)

bsnut

Jack,

I have this suggestion for you and don't know if you though of it. That is having the HC-8+ handle all of the servo movements for you, since it has an servo header on the board.
QuoteI really don't want to do that, I know it will take me forever. If anyone can figure out a way to do this it's definitely you! (No Pressure!)
The file you created with the Robo-Ware program can be stored on an SD card and a driver to read this single file which would drive the servos or a driver similar to the Robo-Ware programming would make it somewhat easier to program the show again.   
William Stefan
The Basic Stamp Nut

JonnyMac

QuoteI'm still thinking it might be easier to somehow capture the actual serial commands as they are sent from the program but you would know much more about the best approach to this than I would.

Looks like we'll have to give that a try.  Even at 16 channels (max) I calculate 37ms to receive all channel positions at 9600 baud (that's the output rate, correct?). This leaves us about 13ms to dump 16 bytes to the SD card.  That part I have to do timing tests.

Let me think about it and explore later.
Jon McPhalen
EFX-TEK Hollywood Office