I can't tell you about the right way to rotate objects in Soya. I can tell
you, however, that you should ensure the readline() call isn't halting your
program until it receives a complete line.

I'm in the middle of moving right now, but if I had two computers, this is
what I'd do to check: connect two computers via serial. Have one of them
read text in the exact same way, and just print it a line at a time. Use
other print statements liberally to be sure you know what's going on. The
other computer sends part of a line, waits for at least half a second, then
sends the rest of the line. If you don't have a null-modem cable, the second
computer can be substituted with an Arduino with a different program, but
the delay between starting the line and finishing it needs to be observable.

Hope this helps.

David Bliss
Percopo 232
1-616-284-1273
CM 1534


On Sat, Aug 21, 2010 at 11:11 AM, Fabio Varesano
<[email protected]>wrote:

> 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
>
_______________________________________________
Soya-user mailing list
[email protected]
https://mail.gna.org/listinfo/soya-user

Reply via email to