Hi there,

for a research project we are running at my University (unito.it), I'm
working on creating something like the following using Arduino +
ADXL330 accelerometer + Python + pyserial + Soya 3D:

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

This is were I'm at right now: http://pastebin.com/cGmSTpZX

I've been able to model a simple cuboid and then use both begin_round
or advance_time to implement fixed rotation increments: I hard coded a
fixed rotation angle (see commented code) and I'm able to see the cube
rotating nicely.

The situation become harder when instead of using hard coded rotations
I want to use angles coming from the accelerometer.

Basically the accelerometer is able to measure gravity acceleration
projected on its 3 axes (see http://www.starlino.com/imu_guide.html
for a more detailed description).. so in my python code I get these
values. Now, using some math (atan2 and other stuff) I should be able
to calculate rotations around x, y, z. Once I get these angles using
eg. rotate_x I should be able to rotate the cuboid to the same
position of the accelerometer.

However, I'm stuck on how to rotate my cuboid according to the angles
calculated from the accelerometer. If I use the code posted above the
animation become really slow and sloppy till almost not working.

This, to my understanding, could be a consequence of:
 * me not correctly understanding how to rotate objects in Soya 3D
 * the serial interface reading causing too much delay for the
rendering engine to display a smooth animation


What do you guys think about this?

Thanks for your help,

Fabio Varesano



_______________________________________________
Soya-user mailing list
[email protected]
https://mail.gna.org/listinfo/soya-user

Reply via email to