minimum period of sensors

2 views
Skip to first unread message

Saeid Nourian

unread,
Apr 9, 2012, 10:29:13 AM4/9/12
to org-concord-sensor
Is there way to query the sensor to see what's the fastest rate we can
read from it?

The follow code works well for temperator sensor:

final ExperimentRequestImpl request = new ExperimentRequestImpl();
request.setPeriod(0.001f);
request.setNumberOfSamples(-1);

However for motion sensor the period is too small and therefore it
throws the exception below.
The minimum acceptable period for motion sensor seem to be 0.01, how
can I find that out at runtime?

error sending command: 50
org.concord.sensor.labquest.jna.LabQuestException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at
org.concord.sensor.labquest.jna.SingleThreadDelegator.invokeMethod(SingleThreadDelegator.java:
62)
at org.concord.sensor.labquest.jna.SingleThreadDelegator
$1.invoke(SingleThreadDelegator.java:34)
at $Proxy1.startMeasurements(Unknown Source)
at
org.concord.sensor.vernier.labquest.LabQuestSensorDevice.start(LabQuestSensorDevice.java:
235)
at org.concord.netlogosensor.SensorThread.getValue(SensorThread.java:
48)
at
org.concord.netlogosensor.SensorReporter.getSensorValue(SensorReporter.java:
34)
at org.concord.netlogosensor.Test.main(Test.java:15)
Caused by: org.concord.sensor.labquest.jna.LabQuestException:
org.concord.sensor.labquest.jna.NGIOException
at
org.concord.sensor.labquest.jna.LabQuestImpl.startMeasurements(LabQuestImpl.java:
227)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.concord.sensor.labquest.jna.SingleThreadDelegator.run(SingleThreadDelegator.java:
89)
Caused by: org.concord.sensor.labquest.jna.NGIOException
at
org.concord.sensor.labquest.jna.LabQuestImpl.sendCmdAndGetResponse(LabQuestImpl.java:
392)
at
org.concord.sensor.labquest.jna.LabQuestImpl.startMeasurements(LabQuestImpl.java:
224)
... 5 more

Scott Cytacki

unread,
Apr 9, 2012, 12:19:55 PM4/9/12
to org-conco...@googlegroups.com
Looking through the other SensorDevice implementations it should be the case that the period in the ExperiementConfig returned by getCurrentConfig() or configure(request), should have the period set to be the minimum period supported by the collection of sensors in the config. You can see this in the PascoUsbSensorDevice#getCurrentConfig method.

However the LabQuestSensorDevice currently just uses a default value for this period. To implement this for the labquest you should look at how getSensorName is implemented in LabQuestImpl. It is reads in a "data sheet" from the sensor and then pulls the name out of it. The are several other fields in the data sheet, you can see them in GSensorDDSMem class. One of those fields is: MinSamplePeriod.

Scott


--
You received this message because you are subscribed to the Google
Groups "org-concord-sensor" group.
To post to this group, send email to org-conco...@googlegroups.com
To unsubscribe from this group, send email to
org-concord-sen...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/org-concord-sensor?hl=en?hl=en
Google Code project for org-concord-sensor: http://code.google.com/p/org-concord-sensor/

Reply all
Reply to author
Forward
0 new messages