Mocap

Has anyone here ever monitered encoder clicks directly to Blender VIA Python.

I have this idea that I am dying to try, that involves getting the current position of two encoders and solving for Z.

I have the encoders (Linear Sony Magnascales), or mouse parts.
I have an “Optitracker” PCI board to make my interface and the C source code for it.

I have the construction of the mechanism that I am planning well along on the (probably mis-guided) assumpion that I can make this work.

I know Blender and have a smattering of Python.

Where would I start looking for a way to make this connection? Whats my Python strategy?

There’s an easy way and a hard way of couse :slight_smile:

The easy way:

  1. Using your C code, dump the sensor information to a text file.
  2. Load and interpret the data from python in Blender.

Or the hard way:

  1. Wrap a python interface around your C code.
  2. Load the python module from within Blender.

Good luck!

Hmmm. the easy way sounds to me like it would have some latency issues.
So let me ask some stupid questions until I catch up with the reality of the second method.

  1. Wrap a python interface around your C code.

Could you give me a simple example to illustrate this sort of thing.

  1. Load the python module from within Blender.

So I would be compiling my own module in C and calling it like I might call the Math or Draw module?

I have had a couple of false starts in my understanding of calling outside modules. Where sould I be reading/studying to round out that area of my python ability???

With the first method, it would be offline, ie you record your mocap data, then load it into Blender. I would try this way first, you should be able to reuse all the Blender-python bits.

To create your own module, you can try:
http://www.python.org to do it by hand,
Extending & Embedding Python (the reference) http://www.python.org/doc/current/ext/ext.html
http://swig.sf.net for an automatic tool.

Example code would be from the Blender source, or:
http://www.python.org/doc/current/ext/simpleExample.html

Good luck!

I think that may be what I needed to put me on the trail. Thanks Alien-xmp

This project is a really cool idea. You should make a website with some picture and more information. asdf_46

Thanks asdf_46:

I think that there are some broad implications for the scripts, but I am out of my depth in moving this along in any kind of timley fashion.

I will let you in on part of what what I am doing tho.

I am building two new machine tools in my studio this year.

The first is a tracker that has a cutter that I can push around manually in the X&Y axis’ and has a motion control assy that positions the cutter in Z, for carving the soundboards for the string Basses and archtop guitars that I build.

http://www.door3.org/tracker.gif

The second is a much more ambitious project that will the my third generation of 3 axis CNC profiler, designed specifically for shaping stone for sculpture. I can do Blender models and meshes in most machinable materials now, but it is a cumbersom processthat needs LOTS of manual input from Maya and Surfcam. If I can work out the passing of these values through the port (serial, USB I dunno) I can machine directly from Blender/Python, and thats why I am here.