Tuesday, August 26, 2008

Maya + Python + Arduino + Servo (Part 1)



This is something that has been going around in the back of my head for a while now. It's amazing what you can find online these days. Practically all of the code for this setup is borrowed from other sources. So thanks to everyone who's contributed to this by posting their own projects on the web.

Here are the links to the main contributors:
http://www.arduino.cc/en/Reference/ASCIIchart
http://principialabs.com/arduino-serial-servo-control/
http://pyserial.wiki.sourceforge.net/pySerial
http://principialabs.com/wp-content/uploads/servo.py
http://www.digitaltutors.com/store/

I will post more details on this project as I get time. I'm am planning to document this whole Idea exhaustively.
This is just the beginning...

If you liked this post, check out PART 2 for some further progress

9 comments:

Lynn said...

Well said.

Daniel said...

I understand why you used Maya, but have you ever considered an open source application such as, http://www.k-3d.org/wiki/Main_Page for your servo project?

Dan Thompson said...

Hi Daniel,

A valid suggestion. I'm a Visual Effects Artist by trade and have been using maya for years. I know it's rigging tools inside out which is why I decided to experiment with this technique in the first place.

There are many powerful solvers and constraint systems in maya.

I'm hoping to harness these high level tools to create complex robotic movements that would normally require a lot of complex algorithms and formulas to be worked out and hard coded into a micro controller before you could see any movement.

If I chose an open source 3D app it would be blender. But for now, I'm happy with maya.

Anonymous said...

Your wolrd looks like mine.
I love CG and Eletronics.
I really appreciate your job! Is possible do the inverse? The Servo act as input position device?
And do u know if is possible do what u did with 3d Studio Max (I use it superficialy) and ATMEGA8 (not the arduino)
Thanks and congratulations!

Adam said...

Hi,

I noticed you said you had to play the scene back in dynamic mode in order to force an update. Is this because you using expressions with functions that query attributes on demand (using getAttr or setAttr for instance) or some other reason?

Dan Thompson said...

Hey Anonumous,

Yes you could definitely do the reverse. But I'm not so interested in motion capture as I am motion export.

If you are a max user then you may find this video
interesting.

Hey Adam,

Check out part 2 of this post. It now works without the need for any playback. But to answer your question, yes it was because I was using expressions to fire the pySerial commands. But now it's all working through the plugin.

Hope to do another update with a full tutorial over the Christmas break.

Anonymous said...

hey Dan i just came acroos your plugin and i can only say its awsome im getting an arduino to start working on it, is there a way to connect more than 4 servos or posibly another arduino.

Dan Thompson said...

Hi Anonymous,

There is a forum over at creativecrash.com dedicated to Servo Tools For Maya. I suggest you have a read of that before you commit to too much. But in answer to your question, yes you should be able to connect more that 4 servos.

Currently I have not documented how to do it but I plan to release a new version soon that will use an already existing Arduino servo library that should make it easier to add more servos.

You could also in theory expand the amount of servos even more with extra hardware like this serial servo controller board http://www.pololu.com/catalog/product/207

Regards,

Dan.

Mathew Schwartz said...

Hi Dan,

Do you have any documentation on the basics of sending maya data to arduino? I have arduino sending serial data to maya pretty easily by looking through some peoples examples but have not found anything the other way around. Is it that much more difficult? If no tutorial do you have even the first code you wrote when first trying to link maya and arduino so it would be easier to read through the code?

Thanks a ton,

mat