[Twisted-Python] UDP some Q's

Sven-Erik Tiberg Sven-Erik.Tiberg at ltu.se
Thu May 3 04:42:46 EDT 2007


Background; working on a two node simulation system using X3D
(www.h3d.org ) and simulink (www.mathworks.org) also CarSim
(www.carsim.com) using simulink in the future.

Made a first code suggestion on transmit / recive UDP. Se attached file
trancive_UDP.py
Used time. to restrict the transmit rate. Doesn't matter if I lose some
state update, 50 updates / second are enough for perception of a smooth
motion. Have to work on events from mouse click to togle them on for 0.2
second.
 
Don't know how to access objects from the main module in the classes in
the lib module.
The tricky part as I see it are ( part of from transive_UDP.py ):
# ------------------------------------------------------------------
 def datagramRecived(self, data):
        count = 0
        data_str = string.split(data)
        for recive_items in data_str:
            __main__.recived_data[ count ] = float( recive_items )
            count = count +1           
        __main__.update_on_recive()

#-----------------------------------------------------------------
The problems are that I need to update __main__.recive.dada before
calling __main__.updat_on_recive().

Second how to access the  .send_UDP from the __main__ module.

/Sven-Erik Tiberg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: trancive_UDP.py
Type: application/octet-stream
Size: 1611 bytes
Desc: trancive_UDP.py
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20070503/d30de264/attachment.obj 


More information about the Twisted-Python mailing list