Saturday, April 25, 2009

Maya To Moco Sneak Peak


A sneak peak at a set of Maya Tools that can control servo and stepper motors. It uses the Arduino platform as a bridge between Maya and the Motors. I will be releasing the tools on the openMoco website soon.

28 comments:

luuude said...

Hey nice progress you are making on this! I guess you will use the code from your other generallift script to output data to the arduino in some form that takes little place. I havent calculated on the memory but it seems that more memory is needed to store 7 axes of movement sampled at 24fps. I intend to create some form of joystick control to be able to record moves on the fly, it feels like that is the easiest way. Then being able to dump that data back into maya and edit it if needed. I have been looking at linear actuators to do a simple prototype dolly track and possibly also use it as a lifting column. Have you investigated this?

Anonymous said...

very good stuff. All this project it's owesome.
It would be good to have python stripts to use all in the open source 3dprogam Blender.

Dan Thompson said...

Anonymous,

When I release the code on openMoco.org you are welcome to use the code within parameters of the license agreement mentioned on the site.

If you are thinking of porting this to blender, I'm sure it would make a great addition to the various motion control projects listed on openMoco.org

Dan Thompson said...

Luuude,

7 axes of movement! so that would be pan, tilt, roll and translate (x, y, z). What is the seventh axis for?

I like the joystick Idea. I use maya for previsualisation. So I prefer to use a motion capture input device to drive the motion instead of a joystick. But this is only for mimicking hand held shots. For most camera moves, I will use good old-fashioned keyframe animation from within maya.

Yes, I will probably write something similar to what I did with kuperTools to export the move data. But that's a way off at the moment.

My final design will be very similar to the genuflex mkII rig. I like the simple design of this rig. Plus I know how it works, so why re-invent the wheel ;)

luuude said...

7 axes?

Well that´s easy!...

He he, I guess I didn´t think either! Just counted the stepper motors i my head. When you say motion capture what do you mean? Have you timed the latency for driving the motor with maya? Will be interesting when I get my gear to try it out! Yes keyframing will probably be the most used way to control it, but I feel it is important to be able to just move it physically as well to be able to work directly with a model.

Wow... a Genuflex MkII clone that is very ambitious! If you manage to do it and also share your progress I might just clone your clone! I have been looking at the "modula" rig from Mark oberts for inspiration. Again really appreciate you sharing this with us.

Dan Thompson said...

I have already reverse engineered and built a virtual genuflex for maya. So This will be the basis for the design.

The main thing I will be cloning will be the axes pivot points and the formulas that allow the camera to travel straight up and down or left or right. This sounds simple, but if you just rotate the boom arm, it will naturally produce an arc. So the rig base needs to compensate to keep the camera traveling in a straight line.

I have all this sorted already in the virtual rig for maya. Feel free to download it and have a play to see what I mean.

I am trying to build it from hardware store materials mostly. It will be very basic compare to the real Genuflex, an probably will take many iterations. For now, I have zero money. So all of my work is software based. I tend to build real stuff only as I need it, for testing the software.

Paulcam said...

I am also building a motion control rig, I really like the idea of being able to control from maya, will be watching how you get on, my skill is mechanical just bought a arduino board to try and get into the programming side, keep up the good work.
Paul

Dan Thompson said...

Hey Paul,

That's great! I look forward to hearing about your progress.

I am trying to encourage people to get involved over at the new openMoco.org site. I do not know of a motion control community out there. But this would be the perfect place to start one I think.


Dan.

Paulcam said...

Hi Dan.

I have built a gyro stabilized pan tilt head, using solid state gyros, it's working on the bench, I hope to try it out on a vehicle soon.

Does the Maya motion rig work on intel mac?

Paul

fccu said...

Valve actuators are really needed for complex tasks in the high power market.If the load requires accurate positioning, the electric actuators as well as the valve actuators has the advantage among others.That is why,to familiarize yourself in this kind of industrial application , knowing how an automation works is a wisely action and will positively keep us in track. Thanks for sharing this information.Good Day!

gate valves said...

very cool looking blog. i love the colors.

Marcel said...

Hi Dan.

I'm not moving forward with my project in actuality but am giving it lots of 'blue-sky' time. The overriding thought is my likely need to scrap all the present code and start again. In my last upgrade of the Arduino IDE I had to re-hash the code I'd been using to count microseconds, and now I see that in the new version 16 they have a built in function called micros() which is the microsecond equivalent of millis(). Whoopah! That alone is going to clean things up a bit.

Here's another nagging thought... so far I've only played with one stepper motor. I've had seeming success running it down to a pulse interval of 70 microseconds before the stepper starts tripping up. However, reading about how the Arduino executes code, particularly in terms of speed, I'm not sure how we're going to get on running multiple steppers. By the time we've gone round a few iterations of code as we send multiple pulses, are we going to be late when we get back to stepper 1??

Any thoughts welcome.

kr

Marcel

Dan Thompson said...

Hi Marcel,

Yes, I too have had my head in the clouds about these issues. I've been meaning to look into interupts as a way around this.

But I have been very intrigued with a new chip out by parallax called the propeller. I'm not ready to make the change yet, but It's a very temping piece of hardware.

And the quality of the support on the forums is top notch!

The propeller has eight processors that all run independly of each other but can be linked as well!

You can check out this link for some questions I have already asked on the propeller forums about the same concerns you have.

As far as getting the motor to go faster well I'm told it's very reliant on several hardware things other than the Arduino. you can read more about that here.

Here's a quote about it straight off the site: "Stepper rpm is largely a factor of driver. You can probably quadruple the top speed of your stepper by simply increasing the voltage and adding a power resistor to keep the current within spec. It's largely about inductance, which limits how quickly the current rises to its max value. This time limits how fast you can switch the coils on and off. If you get a suitably sophisticated driver you'll be able to go faster. It's a massive subject."

Marcel said...

Interesting stuff.

I understand the EasyDriver board can deliver up to 30V which would increase torque - but I'm not sure what effect it would have on speed.

It's also a 'chopper' driver. Which means it senses the current that is going through the coil and then cuts it off when it reaches your specified limit (150-750mA?) — then as the current drops off again it will switch the coil back on. I'm told all this happens quite quickly!

I'm not sure about interrupts. I thought they were more about input than output, but I've not used them at all yet.

with best wishes

Marcel

Marcel said...

Tiny update from me...

I've just had a play reworking my code to use the new micros() function in Arduino v16.

It works great. My new code is working a bit like the "Blink (without delay)" so it's non-blocking which opens the way to having multiple steppers running concurrently and independently. Multiple axes yet to be tried however.

Something worth noting - whilst debugging with the serial port running, my top stepping speed capped at about 4ms per step... far too slow for my purposes. Without the serial port running the brakes come off and I can run the steps MUCH faster. (like 200us and less!)

It may be down to my serial speed of course (9600bps). I've not tried communicating faster.

This may be significant for you - trying to drive the thing from the computer the whole time. I'm doing all the math work on-board so I can switch serial comms off.

-

I'm now trying to get the new LCD library working which has drawn me to a halt once more.


hth

Marcel

Anonymous said...

Very interesting stuff here.

I'm curious about whether this could be used for input as well, e.g. in a homebrew mocap rig.

For stop-motion the timing and interrupt questions might not be an issue, but for real-time capture I imagine it would, would you agree?

If so, would you recommend investigating Propeller over the Arduino for such an application?

Cheers,
Peter

Dan Thompson said...

Hi Marcel,

Sounds like you are making some great progress there!

My engine works in a way where it's only sending position data. This means that the pulse engine code can live on the chip and not the computer.

I'm not sure if I've mentioned it, but moco tools for maya will never be a rock solid realtime interactive controller due to the nature of pcs and openGL. Frame rates in openGL are always dependent on hardware, unless you are using a program like autodesk's motion builder which makes realtime playback a priority.

Think of moco tools for maya as like a virtual remote control for the real hardware. You use it for positioning and playing back the camera move to check the spacial relationships between the camera and set.

Once you are ready to commit the move. It's then a matter using maya to make a move file that loads directly onto the Arduino (or Propeller) for full speed playback.

Final playback doesn't not require the Arduino to be connected to the computer.

Dan Thompson said...

Zoomy,

This Wiimote Server may be of interest to you for mocap input to maya's cameras.

As for the Propeller, I have almost saved up enough money to buy one for testing. I will post the resluts as they come to hand. The propeller certainly does look rather beefy in it's specs.

Dan.

Anonymous said...

Thanks Dan -- that Wiimote server is very cool, and if it can handle multiple inputs I'd be set. I'm considering something with at least 4 inputs, possibly for frame-by-frame capture (in a stop-motion rig) or real-time, puppet-style. I'll watch this space for your Propeller report, good luck!

Marcel said...

And now — some great news. (well I think so)

Although I've got two steppers and two easyDriver cards in my possession, only one set is hooked up to my Arduino. Knowing that it will take a bit of time to hook up the other set has kept me at arms length from the project for a little while.

However, I realised a few days ago, that I don't actually need two (or more) steppers hooked up to test the effect that having more axes will have in the whole scheme of things.

Maybe I should explain (trying to be brief !!)... One stepper (driven by some non-blocking code (see blink examples)) clips along nicely even at 100uS timing. It 'sounds' nice.

Next I added more code that pretends like it's driving a second stepper. When I switch straight from having one stepper to two steppers running, the sound of stepper one changes. Slightly. Very slightly. Of course I'm only measuring this by ear - hearing the pitch drop a little.

Now I've got THREE steppers running (simulated). The code runs one stepper on it's own for a few seconds, then adds the second stepper for a few secs, then finally adds the third.

With each additional stepper, the pitch of stepper one drops slightly, and it also sounds perhaps a little 'rougher'. Again, I'm only judging this by ear.

I've got an old oscilloscope kicking around here (under piles of junk!) so it would be interesting to actually see what's happening to my step pulses. Whether the changes I'm hearing will be visible or not is anybody's guess. But alas, it's past my bedtime once again, and I've missed my story. ;) So the 'scope will have to wait for another day.

I hope this info has been of interest, and will be of use to you - and any anyone else passing through.

All the best

Marcel

Dan Thompson said...

Hi Marcel,

Always welcome to share progress if it's on the topic of motion control.

Sounds like you've found a good way to test your code without buying extra hardware until you absolutely need to.

Nice idea!

Marcel said...

Following your comments about moving to Propeller... check out MAPLE - http://leaflabs.com/Maple - it's Arduino compatible but clocked at 72MHz (apparently running 9 times faster than a Duemilanove with a 328 chip!)

There's also more IO pins which might be handy.
Just thought you chaps might like to know.

Happy New Decade! :D [m]

Dan Thompson said...

Happy New Year Marcel,

Looks promising,

I received my propeller education kit just before Christmas and have only had time to assemble and test the hardware.

Can't wait to get stuck into it. The most appealing thing for me is the multi processors. I'm reluctant to use interrupts unless I absolutely need to. This is where the propeller shines.

No low level programing required to achieve a multi-threaded like result!

Looking forward to the Arduino 1.0
http://arduino.cc/blog/?p=392

Dan.

Marcel said...

Hey Dan....

http://www.youtube.com/watch?v=nZIdlTDZwHQ

...at last!

[m]

Marcel said...

WHOOPAH!!

Now with TWO steppers hooked up and running at different speeds...

http://www.youtube.com/watch?v=cD-VJSsa4h0

It's be a LONG while coming but it kinda makes me feel ok about the zillions of hours of blue-sky thought that have gone before! (like, I got my second EasyDriver card this time last year!?)

Still a LONG way to go before it's useable but I'm pleased as punch that I have two steppers running smoothly.



[m]

Dan Thompson said...

fantastic!

Well done Marcel. Looks like your project is picking up steam!

Dan.

Jan Van Opstal said...

MotionBuilder looks like a better GUI platform for this...

Jan_Van_Opstal@hotmail.com

Dan Thompson said...

Jan Van Opstal,

I'm not sure what you mean? Can you please be more constructive with your comment and elaborate your point?