|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: Monday, September 27, 2010 10:51 AM
Posts: 8,
Visits: 41
|
|
Hi all,
I'm working with the sharp IR sensor and the serializer in visual C#. While the frequency of the sensor is set to 50Hz, I'm planning to extract all data points over a given length of time and plot them on a dynamic graph (adds data points as time progresses, of course). Logically this seems simple if we could simply do:
while
{
obtain sensor reading
store sensor reading into array if necessary
plot point on graph
}
However, I realized that given the serializer's library for the sensor, the data points are not generated in a while loop, but are instead updated with a given frequency by the command:
xxx.UpdateFrequency = 50;
My question is, is there a way to extract these readings and plot a real time graph?
Thanks a ton
|
|
|
|
|
Supreme Being
      
Group: Forum Members
Last Login: Friday, April 22, 2011 6:18 PM
Posts: 153,
Visits: 547
|
|
| Hi, from you post I get the sense you want to read the Sharp IR sensor samples as quickly as possible. If so, realtime is relative to the speed of acquiring a stable sample and processing it. The Sharp GP2d12 is spec'd at about 40mS per sample. The updatefrequency is in Ms. For manual readings of sensors, the Serializer API has some discussion on that under Namespace RoboticsConnection.Serializer.Sensors and Class GP2D12. I wish I could tell you what page is is on but unfortunately we dont get a PDF copy of these documents. To quote a little out of context: If, however, you wish to manually send a request down to query a sensor, and wait on the value returned from the Serializer, you can disable polling of the object of interest (e.g. irSensor.Enabled = false  , and invoke the Update() interface. This will query the component, obtain the returned value, and (internally) store the value in the appropriate property, as mentioned above (e.g. irSensor.Update()  You can then read the value of the updated property and use it as needed (e.g. localValue = irSensor.Distance  Each queryable Serializer component inherits this interface, and you can enable/disable each component as needed. You can poll some, you can explicitly query some, or whatever you like. I hope this helps answer your query,
Don Lewis
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: Monday, September 27, 2010 10:51 AM
Posts: 8,
Visits: 41
|
|
| ahh my bad for mixing up the units. Thank you so much for the post, I'll give that a try
|
|
|
|