PDA

View Full Version : Controlling desktop blender with N900 accelerometers


int_ua
09-09-2010, 02:39 AM
Both Blender and Maemo have python.
So it is potentially possible and potentially not so hard to make N900 3d blender controller.
All we need is python modules for:
0. Recording accelerometers data on N900;
1. Streaming accelerometers data live to desktop and caching it real-time;
2. Controlling active blender view;

I suppose it will be:
a) active only when holding some button (camera for example), and
b) turning blender view relative, not absolute.

paulkoan
09-09-2010, 04:59 AM
Great idea!

From your description you just want to control the scene camera, but you could also use it for tracking when recording video with the n900 camera.

But even if you wanted to use a more advanced camera and use tracking, you could literally strap the n900 to a video camera. If you had the clocks synced on both.

int_ua
09-10-2010, 10:26 AM
Just found similar project:
http://www.aktasway.com/blog/2009/06/11/n95-accelerometer-with-blender/
woohoo =)
but the archive with sources is not downloadable =(
Had written a comment and waiting for a reply...

int_ua
09-10-2010, 10:51 AM
you could also use it for tracking when recording video with the n900 camera.

But even if you wanted to use a more advanced camera and use tracking, you could literally strap the n900 to a video camera. If you had the clocks synced on both.
To be honest, I don't get it yet. :o please explain more :)
What data can be synced with video this way?

luiscesjr
09-10-2010, 11:18 AM
What`s the pratical use of this? I mean, I`m not complaining, I`m just asking.
Like, could we use pc mouse via acc control ( example )? Or maybe play a game?

Edit : And oh, for the guys who knows about this, and will port it, the source codes are avaible to download in the link given before.

int_ua
09-10-2010, 11:45 AM
What`s the pratical use of this?
Like, could we use pc mouse via acc control ( example )? Or maybe play a game?
Edit: the source codes are avaible to download
First of all I want to control 3d view of Blender (in edit mode, not in games or videos). I think it would be much more comfortable then with mouse or numpad.

Is it's URL http://www.aktasway.com/blog/2009/06/11/files/blender95.rar ?
I can't download it:
Sorry, no posts could be found here. Try searching below:
Can someone send it to my by email or any other way?

int_ua
09-10-2010, 11:50 AM
Here is quick reference for controlling 3d view with Python:
http://www.blender.org/documentation/250PythonDoc/bpy.ops.view3d.html

luiscesjr
09-10-2010, 12:16 PM
Oh, well, sorry, I didn`t click the link in that post cause for me the source wouldn`t be of much use, and I didn`t check it was dead. Anyway, it seems to be a nice app, and as I am right now developing something personal, I might still be able to test it when you guys release it. =)

int_ua
09-13-2010, 02:55 PM
First working code that controls one boolean value of 3d view with python (for Blender 2.54):

import bpy

def test():
areas = bpy.context.screen.areas
for area in areas:
if area.type == 'VIEW_3D':
area.active_space.show_floor=not(area.active_space .show_floor)
test()

using two links:
http://www.blender.org/documentation/blender_python_api_2_54_0/bpy.types.SpaceView3D.html
http://blenderartists.org/forum/showthread.php?t=193207

Update: rotating camera (not view yet but object named so):
area.active_space.camera.rotation_euler.rotate(0.2 ,'X')

int_ua
09-15-2010, 07:33 PM
It was easy:
http://www.youtube.com/watch?v=gkQ9wUo1DFk
Now the only thing that left is translating raw accelerometer data in blender moves...

int_ua
09-16-2010, 02:25 AM
Can someone with admin rights move this thread to "Development"?

int_ua
09-18-2010, 10:03 PM
Two-dimensional relative rotation is almost ready. Adding blender-specific actions.

And only when I was writing python class for converting accelerometer data into rotations I realised that for full 3d rotations we need compass or two highly accurate accelerometers...

Cue
09-18-2010, 10:15 PM
Nice project, keep up the good work. Just a slightly odd idea but has anybody tried to track a lit IR port on the n900 with a webcam along with the accelerometers? it might be a good way of mimicking a Playstation Move for absolute translation and rotation.

lcuk
09-18-2010, 10:24 PM
Both Blender and Maemo have python.
So it is potentially possible and potentially not so hard to make N900 3d blender controller.
All we need is python modules for:
0. Recording accelerometers data on N900;
1. Streaming accelerometers data live to desktop and caching it real-time;
2. Controlling active blender view;

I suppose it will be:
a) active only when holding some button (camera for example), and
b) turning blender view relative, not absolute.

onedotzero application uses the opensoundcontrol library to transmit data about what it is doing in the different interactions.
if you could listen from the desktop using the osc bindings you would not need to create a new app :)

Cue
09-20-2010, 02:18 AM
Two-dimensional relative rotation is almost ready. Adding blender-specific actions.

And only when I was writing python class for converting accelerometer data into rotations I realised that for full 3d rotations we need compass or two highly accurate accelerometers...

Just realised how small and recessed the IR LED is. would probably be impossible to track depth with a webcam using the IR port; but what about the screen? You could use the screen with a specific colour (flashlight app maybe) then track the corners. http://www.roninworks.com/?p=14
Better yet it might be better to track 3 circles of different colour set in the corners of a triangle on the screen. rotation and translation could then be tracked with the accelerometers used only for stability. Your rotation would be limited since the screen has to be visible to the webcam but it should be good enough.

int_ua
10-02-2010, 07:45 AM
I've invented (can't find better English word for this, requesting your help :] ) two possible ways of turning control (besides switching side inclination to control rotation):
1) Use swipes on screen to rotate view.
2) Analyze image from front camera and track lights source if there is only one.
Any other ideas?

And about actual scripting.
There is a bug in python3's socketserver which restricts tranferring data (I will post error later, if someone is interested) and at the moment server is only working in blender 2.49b. But I know how to control view only is blender 2.54 :(
Searching a way.
Any help is still appreciated.

And third problem (not directly, but related).
How can I find out what's wrong if package failed to compile in Extras autocompiler? Can't find any errors in log. (project is "opensubtitles")

int_ua
10-02-2010, 08:21 AM
it might be better to track 3 circles of different colour set in the corners of a triangle on the screen. rotation and translation could then be tracked with the accelerometers used only for stability. Your rotation would be limited since the screen has to be visible to the webcam but it should be good enough.
Interesting, but above my programming skills yet... Maybe someday... )
onedotzero application uses the opensoundcontrol library
Can't launch onedotzero :(
$ onedotzero-run.sh
sudo: /usr/bin/liqbase-playground-cpu-performance: command not found
./onedotzero: error while loading shared libraries: liblo.so.0: cannot open shared object file: No such file or directory
sudo: /usr/bin/liqbase-playground-cpu-ondemand: command not found
libliqbase1 is installed...

int_ua
09-02-2011, 05:18 PM
So. After a huge delay I'm back.
I've decided to try to finish this concept.
Already improved the basic transport code, two things left:
- unpuzzle Blender View3D rotation schema and make it work;
- create a basic GUI.

After that I will publish it. Hope it will take no more than a week or two of my spare evenings.

cutehunk04
09-02-2011, 06:42 PM
eagerly waiting for it ... :)

int_ua
09-16-2011, 05:17 AM
okay, It doesn't have GUI yet, but working almost as I expected. Will upload into devel today, I hope.

int_ua
09-17-2011, 02:52 PM
Another delay and here it is:
http://talk.maemo.org/showthread.php?p=1090383#post1090383
It is not a Brainstorm anymore, so I'm creating a new thread.