2010/8/21 Fabio Varesano <fabio.vares...@gmail.com>:
> 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
>

you are rotating inside begin_round, which is wrong.

You should do the following: in one side (probably a thread), you
should read the data from the serial port and accumulate it.
In the other side (soya's main thread), inside the begin_round
function you should read the accumulated data and put it inside some
object variables (like rot_inertia_x and so). Then,
advance_time(proportion) function will get called several times, each
one with a proportion value. Always, between begin_round and end_round
are N advance_time calls and the sum of proportion argument for those
calls will be 1.
So you should rotate there, in advance_time, but multiplied per proportion.

If really the code used to read the data from serial takes less than
1ms, you can put it in begin_round directly (so no threading is
required), but i prefer to do threading.

Take in account that in a 3D app, each funciton gets called over 50
times per second (or more), a small amount of time spent inside of
them counts a lot.

_______________________________________________
Soya-user mailing list
Soya-user@gna.org
https://mail.gna.org/listinfo/soya-user

Reply via email to