View Full Version : Introducing IPMechCam

05-08-2010, 06:16 PM
EDIT: IPMechCam is no longer supported. See notes at the bottom of this post for its replacement.

IPMechCam is a cross platform python program to display a motion jpeg stream from an IP camera. The intent is to provide a powerful, customizable and easy to use application for anyone to use in the Mech Warfare robotics competition.

By default IPMechCam will support the TRENDnet TV-IP100W camera with the option to expand support for other similar IP cameras.

The most interesting feature of IPMechCam will be its support for highly customizable HUD or Heads Up Display widgets. HUD widgets are able to display information in a visual manner over the top of IPMechCam's camera image. Information can include cross hairs to indicate targeting, sensor and control status relayed back from the mech and even indication of game status such as time remaining in the match and the current health of both you and your opponent.

IPMechCam is the first tool in a line of applications geared for the Mech Warfare robotic competition. Other tools planned include gait visualization and optimization, gait generation, pose/sequence editor and robot control interface.

http://forums.trossenrobotics.com/gallery/files/3/3/1/6/ipmechcam_thumb.jpg (http://forums.trossenrobotics.com/gallery/showimage.php?i=2893&c=3)
Early test screenshot

If you would like to try IPMechCam:

Download and install Python (http://www.python.org/download/) (either version 2.5 or 2.6 is fine. I use 2.6)
Download and install wxPython (http://www.wxpython.org/download.php) GUI toolkit library.
Download the current version of UpgraydMech (edit: link removed).
Unzip and run the UpgraydMech.py file.

IPMechCam has been replaced with the much simplified UpMechIPCam
To try UpMechIPCAM:

Download and install Python (http://www.python.org/download/) (either version 2.5 or 2.6 is fine. I use 2.6)
Download and install wxPython (http://www.wxpython.org/download.php) GUI toolkit library.
Download UpMechIPCam (https://sites.google.com/site/upgraydlabs/UpMechIPCam.zip).
Unzip UpMechIPCam.zip and edit the first few lines of of UpMechIPCam.py to match your trendnet IP camera's settings.
Run and enjoy!

05-08-2010, 06:51 PM
That sounds AWESOME Upgrayd! I definitely see a little Python in my future! ;) lol

05-08-2010, 09:04 PM
Very nice! I’m interested for sure.

05-09-2010, 01:53 AM
I like the cross platform deal. I especially like how you plan to make it as flexible. This is just a great idea.

05-09-2010, 11:42 PM
I made some great progress over the weekend. I was able to flesh out a rough format for HUD widgets and implemented a simple customizable crosshair demo.

http://forums.trossenrobotics.com/gallery/files/3/3/1/6/ipmechcamcrosshairmenu_thumb.jpg (http://forums.trossenrobotics.com/gallery/showimage.php?i=2897&c=newimages)

Here I have dropped two instances of the crosshair widget into IPMechCam's widget folder. On program start up IPMechCam has detected the the widget files, loaded them, displayed them using their defaults, and added menu listings for each.

http://forums.trossenrobotics.com/gallery/files/3/3/1/6/ipmechcamcrosshairpref_thumb.jpg (http://forums.trossenrobotics.com/gallery/showimage.php?i=2898&c=newimages)

Clicking on a widgets menu listing opens that widgets preference dialog (if the widget has a preference dialog configured for it). In the case of the crosshair widget I simply have two slider controls to adjust the the origin of the cross hair.

05-09-2010, 11:50 PM
Nice project. I was doing the same thing in windows, but I prefer the open source nature of yours. Finally give me a reason to learn python. :)

05-10-2010, 02:26 AM
For those that may be interested in Python here's two tutorials I've found on the web; at least some of the syntax is different between these two versions:

Beginner's Python v2.4 Tutorial (http://www.sthurlow.com/python/) [EDIT] - This was previously misidentified as a tutorial for v2.5/2.6.
Python v2.5.2 Tutoral @ Python.org (http://docs.python.org/release/2.5.2/tut/tut.html)
Python v2.6.5 Tutorial @ Python.org (http://docs.python.org/tutorial/)
Python v3 Tutorial @ SwaroopCH (http://www.swaroopch.com/notes/Python_en:Table_of_Contents)

05-10-2010, 09:23 AM
For those that may be interested in Python here's two tutorials I've found on the web; at least some of the syntax is different between these two versions:

Beginner's Python v2.5/2.6 Tutorial (http://www.sthurlow.com/python/)
Python v3 Tutorial @ SwaroopCH (http://www.swaroopch.com/notes/Python_en:Table_of_Contents)

99.999% of people are still using python 2.5/2.6 -- because nearly all 3rd party libraries have yet to port to python 3. (they're working on it, but many libraries took this opportunity to do a ground up rewrite on their software, rather than just porting to 3.0)


05-10-2010, 10:14 AM
Just for fun here is a screenshot of IPMechCam running on my MacBook. Works and looks just the same.

http://forums.trossenrobotics.com/gallery/files/3/3/1/6/ipmechcamcrosshairmacos_thumb.jpg (http://forums.trossenrobotics.com/gallery/showimage.php?i=2904&c=member&imageuser=3316)

05-10-2010, 11:43 AM
That's pretty groovy man. You have source yet?

05-10-2010, 02:53 PM
I made another test widget for fun. It is aptly named 'Animated Doodad' as it is simply an animated display similar to an altimeter display in an airplane. This serves no purpose itself it does demonstrate how animation can be used in other widgets.

Below is a little video of all the current widgets running and playing with their preferences.


The screen capture program I was using was causing issues when IPMechCam while displaying the mjpeg feed from the camera so I have it turned off in the video.

I plan to release the code soon. Ill have it up on a page in my blog or also make a Google code page. Its still in quite a hacked up mess to get it working. I want to clean up the code and add some nice comments before I open it up.

05-11-2010, 07:11 PM
For those interested you can download IPMechCam's current code here (http://sites.google.com/site/upgraydlabs/IPMechCam.zip).

To run it you will need python 2.6 and wxPython installed.
It is still in a very early and buggy stage so do not expect anything amazing.

I have the camera turned off by default. Uncomment lines 27 and 28 of IPMechCam.py if you wish to play with the camera display.

05-11-2010, 10:07 PM
Looking good Upgrayd. Thanks for sharing. :happy:

05-12-2010, 04:16 PM
Im getting a lot of great feedback from people who have tried IPMechCam out in both the chat and PMs. It is greatly appreciated and helpful. I should have a google code site up soon when I actually sit down and take the time to figure it out.

Just wanted to share the list of features I am currently work towards and their priorities:
H - Camera Configuration Dialog (Change IP, username and password without needing to dig into the code)
H - Global Widget Color (Color picker w/ preview to set color of all HUD widgets)
L - Local Widget Color (Ability to override the global color setting for individual widgets)
H - Save and load widget, camera and video preferences (Preferences can be saved to a text file. Preferences are loaded on program startup)
M - Screen size scaling (Adjust the frame size and have the camera image and widgets scale accordingly)
L - Keyboard hot keys

I have already made some progress with a color picking interface...
At the moment you can mix red, green, and blue to get your desired color. I am also planning to add a control to adjust the color alpha to hopefully allow semitransparent widgets. Having the option of text input would also be nice if a user knows what color they want.

http://forums.trossenrobotics.com/gallery/files/3/3/1/6/color_pickn_demo_thumb.png (http://forums.trossenrobotics.com/gallery/showimage.php?i=2907&c=3)

If anyone has any ideas on program features and widgets to add please to not hesitate to post them. It would be great to turn this into a community driven project.

05-13-2010, 03:56 PM
I had a friend doing some tests for me by running IPMechCam on various machines and operating systems. When he was done he had some fun making an animated cross hair widget. I liked it so much that I incorporated it into the base cross hair widget. Bellow is a little video that demonstrates it.


05-13-2010, 04:39 PM
That looks really good Upgrayd; it's going to be really neat incorporating that into builds! :)

05-15-2010, 10:03 PM
Camera settings can now be saved and loaded by IPMechCam.

http://forums.trossenrobotics.com/gallery/files/3/3/1/6/ipmechcam_camerasettings1_thumb.jpg (http://forums.trossenrobotics.com/gallery/showimage.php?i=2908&c=member&imageuser=3316)
On program startup camera and video settings are read from file.

http://forums.trossenrobotics.com/gallery/files/3/3/1/6/ipmechcam_camerasettings2_thumb.jpg (http://forums.trossenrobotics.com/gallery/showimage.php?i=2909&c=member&imageuser=3316)
Clicking 'Camera Settings' in the camera menu opens a camera settings dialog. Pressing ok after changing any settings saves the settings to file.

http://forums.trossenrobotics.com/gallery/files/3/3/1/6/ipmechcam_camerasettings3_thumb.jpg (http://forums.trossenrobotics.com/gallery/showimage.php?i=2910&c=member&imageuser=3316)
Clicking 'Camera Connect' in the camera menu attempts to connect to the camera and begins image display if the connection was successful.

For now the latest IPMechCam can always be downloaded here (edit: link removed).

05-16-2010, 01:34 PM
Global widget color can now be set and saved.

On program start up display settings (screen size and global widget color atm) are read from file.
Widgets are displayed using the color read from file or... if a color was not specified default to black.

http://forums.trossenrobotics.com/gallery/files/3/3/1/6/ipmechcam_globalwidgetcolor3_thumb.jpg (http://forums.trossenrobotics.com/gallery/showimage.php?i=2913&c=newimages)
Clicking 'Global Widget Color' in the Display menu opens up the color picker dialog.

http://forums.trossenrobotics.com/gallery/files/3/3/1/6/ipmechcam_globalwidgetcolor1_thumb.jpg (http://forums.trossenrobotics.com/gallery/showimage.php?i=2911&c=newimages)
Select a new color using the sliders to mix red green and blue.

http://forums.trossenrobotics.com/gallery/files/3/3/1/6/ipmechcam_globalwidgetcolor2_thumb.jpg (http://forums.trossenrobotics.com/gallery/showimage.php?i=2912&c=newimages)
Hitting the ok button sets the new global color and saves the selection to file.

05-19-2010, 10:43 AM
Very nice! I'm not interested in Mech Warfare at all, but am definitely interested in what you are doing here. Now I am going to have to dig into some of the more advanced features of Python. Are you using the object oriented features of Python?? I will be using Python as the control language on a BeagleBoard eventually. :D


05-31-2010, 02:00 PM
The first post in this thread has been edited with some simple instructions for trying out IPMechCam.

The instructions are by no means comprehensive. The python and wxPython web pages should provide all the information you need to get them properly installed.

06-01-2010, 08:55 PM
While working with the dynamixel ax-12 servo read register features I began to think about widgets that may be useful to add into IPMechCam.

The first idea I have started to play around with is a temperature widget. My thinking here is to average the servo temperatures and display it in a color temperature chart.

http://forums.trossenrobotics.com/gallery/files/3/3/1/6/ipmechcam_temperature_widget_thumb.jpg (http://forums.trossenrobotics.com/gallery/showimage.php?i=2949&c=3)

Other widgets I plan to add in the near future include:

A set of various general gauges to display servo voltage, servo load, ect.
Icon or line drawing to help keep track of turret pan and tilt position.
Icon or line drawing to indicate mech front. (I guess only useful for my new mech. He will be able to change what side is forward.)

06-20-2010, 01:30 PM
I have not posted an update here in a while so I figured I would give a rundown on the things that are being worked on.

http://forums.trossenrobotics.com/gallery/files/3/3/1/6/upgraydmech_thumb.jpg (http://forums.trossenrobotics.com/gallery/showimage.php?i=3076&c=3)

First off I have started rolling all my tools developed by myself into one software suite under the name of UpgraydMech.

Widget Preferences:
IPMechCam widget preferences are in the process of a large overhaul...

The biggest change with the widget preferences is you are now able to make instances of a widget. For example, If you want two cross hairs, you will no longer have have two separate crosshair.py widget files in the widgets folder. You can now enter the widgets preferences dialog, click the '+' button to create a new instance of the widget. From there you can give the widget instance a name, description, and set its settings.

All widgets share the common settings of name, description, its enable status, and its X and Y position on the screen.

Some widgets have the option of displaying a label next to the widget on the screen to differentiate instances of a single widget from each other.

Widgets that display a value have a text box that allows you to enter a values name, or series of value names, that the widget should use. For instance in the screen shot above we can see the 'Ave Coxa Temp' widget instance has the values 'Temp1 Temp4 Temp7 Temp10' are entered. These values will be averaged and displayed in the temperature widget.

Graph Widget:
A graph widget is in the works. You can see me testing it in the screen shot above. The graph will be able to display a value, or average of values, over time.

Gauge Widget:
Also a gauge widget is in the works. It will be similar to a speedometer. Useful for values where its displaying its change over time is not important.

Text Widget:
Lastly I am adding a text widget. This will simply let you place some text along with a value anywhere on the screen. This will be useful for things like a match duration, a stop watch or hit point indicators.

Edit: Updated the first post with a link to UpgraydMech.py

07-01-2010, 09:06 PM
Progress continues with IPMechCam.

I am continuing to streamline the widget preferences. Now all widgets share a common preference dialog class that displays only preferences relevant to each individual widget. Saving and loading widget preferences is in the works.

Widgets are now able to access data from a data stream. This allows them to display information from other systems. For example I will be linking my mech control software to allow widgets to access inputs status, servo information, turret position, ect. Other possible uses are linking into the scoring system (assuming an interface is provided by the event organizers) or any of the arbotix control solutions.

It is also now much easier to create a new widget. For example, the new text widget demoed below is only about 25 lines of code.

http://forums.trossenrobotics.com/gallery/files/3/3/1/6/ipmechcamtextwidget_thumb.jpg (http://forums.trossenrobotics.com/gallery/showimage.php?i=3094&c=3)

08-05-2010, 08:30 PM
I like the idea for turret position. That is something which would be very handy for me. I have been thinking about that type of widget since you put ipmechcam together. On my quad, I want it to be able to walk straight, and turn the turret to a side. With the widget I would be able to turn quickly back to the center, and continue walking straight, seeing where I am going. Would also like to set one of the button on the controller to recenter the turret as well, but thats not in ipmechcam.