Are proximity sensors actually line of sight?

Typically: "How do I... ", "How can I... " questions
Post Reply
RobAtLab
Posts: 49
Joined: 10 Jan 2018, 17:49

Are proximity sensors actually line of sight?

Post by RobAtLab » 28 Sep 2018, 20:58

Excuse me, I've got some child script code running on a proximity sensor in an attempt to check whether a dummy object is within it's field of view.

The key line in the child script being

InFieldOfView, junkDistance, RelativePos=sim.checkProximitySensor(ThisSensor,thatDummy)

If InFieldOfView==1 I then use the data in RelativePos for further calculations. However I've been doing some tests of placing dummies into the field of view and printing out RelativePos. It gives a plausible position. However if I position the proximity sensor somewhere, then put the dummy into its cone (at which point I expect to see printed relative positions), then bring a model between the proximity sensor and the dummy I find that I still get printing. the presence of a visible object with respondability and dynamics enabled, set to be collidable, measureable, detectable and renderable, does not seem to block the proximity sensor's line of sight. It can see the dummy straight through the model. Is there any way to prevent this and make it line of sight so that when objects exist on the line between the proximity sensor and the dummy the InFieldOfView parameter no longer comes back as 1.

The ThisSensor sensor object is explicitly handled, because all it is there for is to check if certain dummies are within line-of-sight view so I don't want to slow my sim by having it constantly trying to do minimum distance claculations to other objects I don't care about. It is subtype infrared and set to be able to detect "all detectable objects in the scene" with the checkbox in it's "scene object properties" pop-up. The volume type is a cone with no offset, a very small inner radius (0.0025m) and a larger range 0.63m. angle is quite wide, face count is 12, subdivisions is 0, subdivisions far is 1, inside gap is 0. detection parameters have ticks in front and back face detection. fast detection is not used, although I might change that in future, don't allow detections if distance smaller than 0.01m is set. Sensing pt size is 0.005m.

Thank You

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

Re: Are proximity sensors actually line of sight?

Post by coppelia » 01 Oct 2018, 07:48

Hello,

proximity sensors are not vision sensors and do not share properties of vision sensors, such as line of sight or occlusion. So if you need to verify whether an object is visible of not, use a vision sensor instead.
A vision sensor will however be much slower.

An alternative would be to have the model occluding the view to the dummy, be also detectable, so that the proximity sensor will first detect the occluding object, instead of the dummy behind it.

Cheers

RobAtLab
Posts: 49
Joined: 10 Jan 2018, 17:49

Re: Are proximity sensors actually line of sight?

Post by RobAtLab » 01 Oct 2018, 18:38

I'm pretty sure the model between the dummy and sensor is detectable, yet the sim.checkProximitySensor(thisSensor,thatDummy) command still seems to see the dummy.

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

Re: Are proximity sensors actually line of sight?

Post by coppelia » 04 Oct 2018, 13:12

If you check your proximity sensor with sim.checkProximitySensor(thisSensor,thatDummy), then it will just trying to detect that dummy. Try with sim.checkProximitySensor(thisSensor,sim.handle_all).

Cheers

Post Reply