WalrusBrigade wrote:I too have been trying to figure out how to access some vernier sensors in lejos. I've got the adapter, but all of the support is for LabView, RobotC or NXT-G. I'm trying to turn 4 force sensors into a force plate, and was going to use the NXT to do the processing and output. But trying to code sensors is a bit beyond my ability. So if anyone can answer this question and already has a way to communicate with them, I would love to hear what it is.
Christian, if you can figure this out would you please post the result so I could try your code. Thanks.
WalrusBrigade wrote:Thanks!! I'm not really familiar with RobotC . . . or any C for that matter. I just brought it up because the support for the NXT adapter has RobotC in it. Still, I can fiddle around with SensorPort and hopefully will figure out how to get the data out. By the looks of it I can use the .readRawValue() method and do some processing after the fact. My only concern now is figure out how to configure the sensor properly. Again, thanks for pointing me in the right direction.
skoehler wrote:You probably to call SensorPort.S1.setTypeAndMode once before readRawValue will work.
SensorConstants.MODE_RAW is probably the right mode. I'm not sure about the type. Try SensorConstants.TYPE_LIGHT_ACTIVE and TYPE_LIGHT_INACTIVE.
skoehler wrote:Apply a known force, write down the value. Apply another known force, write down the second value. Now perform linear interpolation. Or, even better, apply a third known force, and write down the value. Now look, whether linear interpolation is actually the correct method.
skoehler wrote:readRawValue() returns the value of the ADC. it's neither Newton-meters or any other unit that has a name.
The r1 and r2 the two raw values and let f1 and f2 be the corresponding known forces.
Then f = (r-r1)*(f2-f1)/(r2-r1)+f1 where r is the current raw value and f is the current force.
That's pretty basic linear interpolation between two known points (r1,f1) and (r2,f2).
Users browsing this forum: No registered users and 0 guests