PDA

View Full Version : [Question(s)] SSC-32 Servo Controller Newb Question



Superlaxstar112
06-12-2008, 07:55 PM
So a friend and I are looking into making a robot. We 3 years experience building combat robots but have yet to build something with logic. We are avid programmers but have never played with something like this. We are looking at servo controllers that can be directly connected to a computer and then run directly from that computer, possibly from a program running on the computer. I have just found this site, looked around it for about 2 hours. Read a couple of threads and then did a search for info about the SSC-32 Servo Controller. I am wondering, I know this comes with a serial connection, but can it be run from a computer in real time? and how hard is the programming? Thanks!

Adrenalynn
06-12-2008, 08:09 PM
Yup, it can be run in "real time", if we define "real time" as an approximation of a hundred kbit/sec serial communications. :)

Basically you're just sending simple serial control commands similar to the way you would command a Hayes Command Set modem. I can send "#7 P1800 S800 <cr> out the serial port to the servo controller, and it would respond by moving servo #7 a pulse width of 1800uSec at a speed of 800 uSec.

It can also do intelligent group moves where you command it to move a group of servos simultaneously. Further, you can set a desired end-time it takes to group move the servos.

All of this will begin the moment that data hits the serial port/microcontroller on the SSC-32. You can even interrupt it mid-move and send a different instruction.

Finally, if you're brave you can flash the microcontroller with your own code and move away from the host PC...

Hope that answers your question!

Superlaxstar112
06-12-2008, 08:14 PM
What languages can be used with the controller? or what does it understand? how simple is it to tell it to move say servo in port 1 to position 150? or something like that?

Adrenalynn
06-12-2008, 08:22 PM
Any language that can write to the serial port (which is most). The servo controller doesn't know or care. All it knows about is pulses. So you would simply send ""#1 P150 <cr>" out to the serial port. (That's assuming you want it to get there as fast as it can.

In fact, you can do it in no language at all, just write the command file with a text editor and do something like "type mycommandfile.txt > COM1" in a dos/shell window, or send your command above one-time like this: "echo #1 P150" in the same dos shell.

The SSC32 has onboard "smarts". As long as you talk its language, you can talk to it from any language that can get commands to it.

Superlaxstar112
06-12-2008, 08:29 PM
this thing is awesome
thanks deff will be buying this

Adrenalynn
06-12-2008, 08:32 PM
Sorry - correction above: It should read: "echo #1 P150 > COM1" - the command above would have just echoed it to console. My bad!

Yes, they really are quite awesome. I have three of them, which is almost enough to be dangerous, I don't have to strip them from one project to put them on another nearly as frequently now. ;) Another three more would be about perfect. At some point it's on my list. 32 channels of control for that money really is amazing.

4mem8
06-13-2008, 03:11 PM
Adrenalyn: and Superlaxstar112: I have just purchased aJ5 kit and bought an extra SCC32 as well just in case I need it, They do look pretty cool devices.

Superlaxstar112
06-13-2008, 03:13 PM
Could I say hook this up to a gyro or accelerometer into one of the "Inputs = 4 (Static or Latching, Analog or Digital)" and be able to access the data from the gyro via the serial cable? or would I have to get something else to do this?

Adrenalynn
06-13-2008, 04:19 PM
Depends upon the gyro or accelerometer, but in theory, yes. You might need some "glue hardware", again, depending upon the device.

You can issue a command like VA or VB and it will report back the voltage on that input, 0-4.98v range (so you'll need to calibrate an analog sensor against the small error). It returns an 8 bit value, 0-255, where 0 is 0v and 255 is 4.98v. Multiply the return value by 5/256 and you'd get the true voltage.

LinuxGuy
06-13-2008, 07:15 PM
Adrenalyn: and Superlaxstar112: I have just purchased aJ5 kit and bought an extra SCC32 as well just in case I need it, They do look pretty cool devices.
Oh, they are! I have two of them myself - one just for testing servos and assemblies. The other one is on W.A.L.T.E.R. Pretty much any robot I build is going to have an SSC-32, assuming the robot is large enough. The smallest RSR I have designed is too small for an SSC-32, but I have another solution for that one if servos are required.

8-Dale

4mem8
06-14-2008, 12:38 AM
Yeah, The reason for getting the other one was just for that reason robotguy, Great minds!.

Adrenalynn
06-14-2008, 02:28 AM
I have this bad habit of not "finishing" projects because I gut one for another. Buying more SSC32's is "cheap insurance" against that bad habit. ;) It's the numero-uno piece of hardware I find myself cannibalizing...

Alex
06-19-2008, 03:35 PM
Man, I wish I had more time in my life:(

I started to build a .NET wrapper long ago for the SSC32. I had a blast doing it, but I had to stop the project to do some other work.

Oh yeah, yes, the SSC32 rocks! The cool thing about PC based robotics, is that software or "brains" runs on the computer (not the board) and you can have several robotic components all running within the same application.

For example. Say you start off building an application using the SSC32 controller (http://www.trossenrobotics.com/store/p/3191-SSC-32-Servo-Controller.aspx). Then, you get to a point where you want accelerometers, maybe a DC motor controller or two, some relays, some sonar and/or IR sensors. Stuff that basically the SSC32 controller isn't really designed to do. Well, you can step into the world of Phidgets (http://www.trossenrobotics.com/phidgets.aspx), and use any of their devices in the same application! Or, you could also pick up a Serializer (http://www.trossenrobotics.com/store/c/3105-Robotics-Connection-Serializer.aspx) which would allow you to interact with all kinds of devices! The diff between Phidgets and the Serializer is that Phidgets gives you an API for practically any language, whereas the Serializer's API is limited to .NET. You can still control the Serializer in any language that supports serial port communication, but you'll have to learn serial level programming like what Adrenalynn mentioned earlier with the SSC32.

DresnerRobotics
06-19-2008, 03:41 PM
The SSC-32's are so cheap theres not much reason not to pick up an extra. I have one built up to be a test unit, has a battery pack + Bluesmirf mounted via SES Electronics carrier, so its nice and compact, and completely wireless. Makes for testing servos during a build very easy.

metaform3d
06-19-2008, 07:43 PM
I started to build a .NET wrapper long ago for the SSC32. I had a blast doing it, but I had to stop the project to do some other work.I'd be very interested in a driver for the SSC-32. Given that everyone shudders in horror when they contemplate emulating RS232 over USB, I'm not that keen to try what would in this case be my only option.

Alex
06-19-2008, 08:17 PM
It's doubtful I'll have time to write one anytime soon though. It's quite easy if you have the time available to learn how. You know C# right? Just look through the SerialPort class and then in the SSC-32 manual, it gives you all the commands you need to send to the serial port. Just wrap all of those commands into overloaded methods.

metaform3d
06-19-2008, 09:02 PM
It's doubtful I'll have time to write one anytime soon though. It's quite easy if you have the time available to learn how. You know C# right? Just look through the SerialPort class and then in the SSC-32 manual, it gives you all the commands you need to send to the serial port. Just wrap all of those commands into overloaded methods.Oh, sure; that would be trivial. I was thinking more about the auto-recognition magic that USB devices do. Plug in an SSC-32 and have the host realize it's an SSC-32 and load the right driver.

I guess I'll have to play with USB to serial and see what the pitfalls are.

Alex
06-19-2008, 09:19 PM
ah, that... Well, the SSC-32 is not an HID, so I'm not sure how this could happen. I know that a board we were developing in house for a project had a feature that we added that would allow you to ping the device via a SerialPort object and the device would reply with a specific set of characters. This would basically allow you to use the GetPortNames (I think that's the method...) which gives you the list of all the serial ports on your computer. Then, you would simply issue that ping command. If it responds with the set of characters, then you know that is the board you want to open. I'd do this at the beginning of each application I wrote.

Now, if the SSC-32 controller has this or a similar feature... I have no clue. Anybody else wanna chime in on this?

Adrenalynn
06-20-2008, 07:13 AM
Leave for a day, and there's all these interesting posts...

I'm not really sure I'd call it "serial level programming". That leaves me feeling like I'd need to be "diddling the bits" - worring about what my RTS/CTS are doing, etc. In fact, you can fully control the SSC32 with *no* programming. Anything that talks to a terminal - hyperterm, lynxterm, freeterm, putty, ... can be used to control the SS32. Or you can just simply blast commands out using a copy command or echo or ... Any OS that can redirect I/O to the serial port (which is any OS I can think of off the top of my head - even the old hacked TIMEX watch I have here could do it) can handle it. The SSC32's command-set is human readable. Just initializing the HID stack... isn't...

USB/HID, on the other hand, marries one to a commitment to "fight with it". ;) USB Virtual COM Ports are mostly excluded from that - although there's still some fight to get 'em working reliably.

----

USB "owns" the auto-device-identification thang. That was one of the selling pitches over RS232. We played a lot of games historically for device identification that would still work today. A simple example would be: As soon as you run your application that wants to see [an/multiple] SSC32's, you might set the baudrate, then instantiate each of your com ports in order and send: VER <cr> to the port. If there's an SSC32 out there on that port it will report back with its version number as an ascii string.

Not so fast, though! If you have other serial devices, they *may* get cranky about being sent that string. I haven't found any that do anything other than return something like ERR or ERROR (primarily some modems), or just straight out ignore you. ;)

Now if we get into "serial level programming", we can do some advanced profiling of the device (like waiting to see how long it takes it to respond to having certain lines diddled and such) and get much more confidence before we start blasting random strings out.


------
I know we're off in the weeds, but let's just move a servo with the SSC32 and C# real quick: (this code needs to be emdedded in a function that I've only stubbed out)



{
//Make sure we're clean Assuming only one serial port exists here!

if (serialPort.IsOpen)
{
seralPort.Close();
}
try
{
//configure the serial parameters
serialPort.PortName = cbbCOMPORTS.Text;
serialPort.BaudRate = 19200;
serialPort.Parity = System.IO.Ports.Parity.None;
serialPort.DataBits = 8;
serialPort.StopBits = System.IO.Ports.StopBits.One;

//open the port
serialPort.Open();
}
catch () {} //do your exception catch here

//Now send it a command
try
{
serialPort.Write("#15 P1200" + Environment.NewLine); //This will move servo #15 to position 1200
}
catch () {} //do your exception catch here


That's it. At the simplest, we just controlled a servo from .Net/C#. This is far from brain surgery... ;)

metaform3d
06-20-2008, 09:29 AM
Thanks for the sample code. I definitely want to play with one of these.

Adrenalynn
06-20-2008, 11:51 AM
Wow. Crappy code. I really should be caught up on sleep before posting. I may go back and fix that up.

Anyway - good enough for you to understand, for sure. Except for that missing brace at the end and dropping it into some method, it'd probably compile.

You can find the documentation for the SSC32 here: http://www.lynxmotion.com/images/data/ssc-32.pdf