Problem with reading data from two vision sensors

Typically: "How do I... ", "How can I... " questions
Post Reply
NivX
Posts: 2
Joined: 27 Aug 2013, 22:07

Problem with reading data from two vision sensors

Post by NivX » 06 Sep 2013, 12:45

I defined two vision sensors the the same way as in the tutorial
Ive read the data of the first sensor in a "while" loop and it was ok:
result,data=simReadVisionSensor(floorSensorHandles[1])
if (result>=0) then
sensorReading=(data[11]<0.3) -- data[11] is the average of intensity of the image
end

But when I read the second value "simReadVisionSensor" in a second "while" loop it returns -1:
result2,data2=simReadVisionSensor(floorSensorHandles[2])
if (result2>=0) then
sensorReading2=(data2[11]<0.3) -- data[11] is the average of intensity of the image
end

What could be the problem?

coppelia
Site Admin
Posts: 7272
Joined: 14 Dec 2012, 00:25

Re: Problem with reading data from two vision sensors

Post by coppelia » 06 Sep 2013, 12:49

Hello,

It is difficult to analyze what you did wrong with this little information. If possible, post your scene via dropBox or google drive.

Does the status bar display any error message?

Cheers

coppelia
Site Admin
Posts: 7272
Joined: 14 Dec 2012, 00:25

Re: Problem with reading data from two vision sensors

Post by coppelia » 06 Sep 2013, 13:59

We have received your scene file. But next time please post it publicly, so that other users can also have a look at it.

You should always inspect what the status bar is printing. In your case, it says something like:

Code: Select all

Lua call error: [string "SCRIPT OmniPlatform"]:6: Object does not exist. (simGetObjectHandle)
Looking at your code, it seems you have not correctly spelled the name of the second vision sensor (names are case-sensitive).

Cheers

Post Reply