Home News Products Services Contact Us
 
 
Pan/Tilt Servo Controller, version 2
Updated July 17, 2006
 
 

Overview

This is the 2nd iteration of a remotely operated pan/tilt mechanism I built a few years ago. (Version 1). It allowed me to test a new servo control framework and Macromedia Flash Media Server 2.



Demonstration

I periodically have a live version of this setup in my home-office.


It is not online currently. Email me if interested and I'll turn it back on.


When it is not online:

  • Recorded Video from the web cam during a move sequence
  • Screenshot of the Flash UI (w/o the video)


Notes:

  • If you see the camera moving when you connect, please wait a while for whoever is using it to finish.
  • The developer edition of Flash Media Server is limited to a maximum of 10 connections.
  • The camera is pointed towards a mirror.

Overall Design

There are much easier ways to build a remote controlled pan/tilt web cam than what is described here. However, this approach definitely lends itself to more advanced uses.

Servo Control

The new servo library is designed for more complex servo movement control and to provide for some level of abstraction for interfacing with various servo controllers. The most important new function it provides is abstraction for the movement of servos. Normally, servos will move to the requested position as fast as they can. The new framework provides for other types of interpolated movement, including linear (constant velocity), accelerated, synchronized timing, ease-in/ease-out, etc. Note that some servo controllers support certain types of movement interpolation on-board. The framework is designed to be able to take advantage of those controllers without requiring controller specific programming.

For controllers that do not provide interpolated movement onboard, the host computer must be able to update the servo position at a constant and relatively fast frequency. The library is designed to operate either as a multi-threaded blackbox, or as a component of a single-threaded application that runs in a constant loop.

The library makes use of the open-source RXTX library to handle serial port communications from Java. The RXTX library is basically an implementation of the Javax Comm API. For some reason, Sun decided to drop support of Javax Comm on Windows recently. Getting the RXTX library to work with Java 5 was not straight-forward, but it does work now.

The UML diagram probably doesn't explain much, but it's a start. ;)

Flash Media Server - Video

One of the main purposes of this project was to test the FMS2 video stream handling and quality at various settings. FMS makes working with live and recorded video relatively easy.

One thing that still surprises me with FMS, is that there is no live video encoder supplied with the product. (At least not that I have found.) Its easy to write your own that runs in the Flash player, but its still surprising to me. I would like to test if it's possible to write an encoder that can run as a service (no GUI). I have noticed already though that letting my custom encoder run over night causes the video to be sluggish by the next morning. I don't know why yet.

Flash Media Server - Shared Objects

A powerful feature in FMS is the notion of shared objects. A shared object is an AS object that FMS will automatically synchronize/replicate to all connected clients over an RTMP connection. Shared objects are great for multi-user applications. I've seen similar constructs in multi-user game development libraries, but this is the first I've seen it for Flash. Yes, you can do it yourself using remoting or XML/HTTP ...but FMS makes it very easy.


Flash Remoting

My FMS application script connects to the servo controller web application via Flash Remoting, although the mechanism for doing so is not as straightforward as in a normal Flash application. On the Java side, the Flash remoting is handled by the open source OpenAMF gateway servlet. (This is the equivalent of Macromedia's Flash Remoting Server.) The gateway translates between actionscipt methods and objects to Java methods and objects.

I could have the clients connect directly to the servo control web application via Flash remoting. (I did that originally.) However, by brokering the servo control through the FMS, I can easily add multi-user capabilities. For example in the current client, if one client moves the camera, all other clients are immediately notified via a shared object.

Physical Device

In version 1, the pan/tilt device was built out of wood. I wanted to improve upon that a bit this time and experiment with some new materials. I ended up using Lexan for the camera plate, but keeping the wood base. The linkages were built using pieces of the servo erector set from Lynxmotion. Lynxmotion also sells a pan/tilt kit which is exactly what I ended up with.


Version 3

I probably won't build a version 3 because I have no reason to. However, if I did, these are some of the things I'd change or improve:

  • The camera still vibrates and wobbles during and after quick movements. The linkages are just not precise. I think it's because I'm still using plastic servo horns, but I'm not sure. So next time, I'd first try metal servo horns, and if that didn't work, I'd probably completely redesign to use push/pull rods to do the movement.

  • It would be nice to have dynamic zoom in/out controls. If unable to hack the camera protocol (or if using a DV camera that doesn't have programmatic control of zoom), then maybe a solution would be to rig a third servo that operated the physical zoom controls on the camera.

  • This is the last project I will use the FT639 servo controller on. Its very limited and quirky, and there are much better servo controllers available now. I am anxious to see if my servo library can update positions frequently enough from a user level install of windows or linux to allow for fluid motion. Right now, the FT636 is the resolution and frequency limiter.


Miscellanous Links

  • Logitech QuickCam Fusion - This is the web cam being used. It's capable of 1.3MP at 640x480 and 30fps. Serving that up at a decent quality over residential DSL is a different story. Typical settings I'm using for the demo above are 320x240x15 limited to 256kb ...which is why the quality in the videos above is not so great.

  • Elab - New suppliers of the FT639 Chip. I'm not sure why anyone would purposefully use the FT636 over other available options these days though. Maybe for space?

  • ServoMaster - An open source servo control library. This is a well though-out and working servo control library, also written in Java. I would have used this library myself, but I'm not keen on some of the author's design decisions. I'm also not sure it could be modifed to provide for some of the more advanced functions I have in mind for a servo control library. That said, the library is well written, mostly complete, and it does work (at least with the FT639). He wrote some great notes regarding the FT639 specifically, which match exactly with what I found out while using the chip.

  • Example Servo Controllers - As supplied by Lynxmotion. There are lot of servo controllers available now as compared to when I first purchased the FT639. Some of them are more like microcontrollers with servo capabilities. And vice-a-versa ...a lot of robotics oriented microcontroller boards now support servo functions directly.

  • RXTX - A great open-source Javax Comm implementation for Windows, Linux, and lots of other platforms. This is a great alternative (maybe the only alternative) to the Sun standard javax comm library...which doesn't seem like its being actively supported by Sun anymore. I'm not really clear on that though.

  • Flash Media Server 2 - By Macromedia...I mean Adobe. There is decent documentation included for administrators and AS programmers. However, I found the overall design documentation that would be of use to architects a bit lacking. It took some real digging to figure out if and how FMS could do Flash Remoting itself. Starts at $4000 per CPU I think....which is probably a fair price if you really have reason to use it. ...unlike the original pricing of Flex. ($10,000 per cpu.)

  • OpenAMF - An open source Flash Remoting Server alternative for Java. I think flash remoting is one of the most powerful and most under-utilized features of Flash.

  • Lynxmotion's Servo Erector Set - The erector set for servos is very cool and new components keep coming out. Like a ball-bearing version of the connectors I used in this project.

  • Servo City - Lots of unique servo related products, including a new, very powerful, servo pan/tilt platform.

  • Budget Robotics - A small online store by Gordon McComb. Has some useful servo mounts and related products.



 

 

<< Back to Products Overview