From: Affan, S. <as...@us...> - 2005-11-20 01:58:48
|
How do we specify the rate at which each update for our filter will come. i.e. the time step? If I am not sure how long my filter operation takes (but am sure it is less than say 0.5 sec) will the following give me 0.5 seconds between every time I run my filter? PlayerClient pc("localhost",6665); pc.SetFrequency(2); // get data at 2Hz while(1) { if(pc.Read() < 0) exit(-1); <FILTER STATRT: about 0.5 seconds> } Best Regards, Affan, Syed. |
From: Brian G. <br...@ge...> - 2005-12-06 17:19:04
|
On Nov 20, 2005, at 10:58 AM, Affan, Syed wrote: > How do we specify the rate at which each update for our filter will > come. i.e. the time step? If I am not sure how long my filter > operation > takes (but am sure it is less than say 0.5 sec) will the following > give > me 0.5 seconds between every time I run my filter? > > PlayerClient pc("localhost",6665); > pc.SetFrequency(2); // get data at 2Hz > > while(1) > { > if(pc.Read() < 0) > exit(-1); > > <FILTER STATRT: about 0.5 seconds> > } Approximately, yes. But if your filter really takes about 0.5 seconds, then data might back up on the socket. Best to make the data rate a bit slower than the rate at which you expect to be able to process the data. Or put the processing in a separate thread. brian. |