Hi David,

thanks for your input. Unfortunately I don't think that readline() is
the problem here.

Of course, readline() is blocking until it gets a '\n' but I'm sending
something like 200/300 lines/seconds with Arduino (each line contains
an ending '\n' see Arduino code at http://arduino.pastebin.com/KNAmnScS).

This is actually confirmed if I uncomment the print x_rot statement:
this would result in lot of prints in the Python stdout meaning that
the read has been successful and fast.

FV

On 08/21/2010 05:48 PM, David Bliss wrote:
> 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] <mailto:[email protected]>> wrote:
> 
>     Hi there,
> 
>     for a research project we are running at my University (unito.it
>     <http://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] <mailto:[email protected]>
>     https://mail.gna.org/listinfo/soya-user
> 
> 
> 
> 
> _______________________________________________
> 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