## Proximity sensor incorrect detected points in CoppeliaSim

Report crashes, strange behaviour, or apparent bugs
jboalml
Posts: 2
Joined: 29 Dec 2019, 12:31

### Proximity sensor incorrect detected points in CoppeliaSim

Hi!

I have detected an inconsistency in proximity sensor measurements in the brand new CoppeliaSim (4.0.0 rev. 1) compared to V-REP. I have run a simulation that works fine with the latest version of V-REP (3.6.2) in CoppeliaSim and I am getting divergent readings in some cases.

The setup of the test case to reproduce the issue is the following. I place a Pioneer_p3dx robot in the middle of a 1-meter wide corridor with two parallel side walls made from cuboids. The detected points for those sensors that provide valid readings (detectState is True), are listed below for both simulators:

V-REP (Correct values)

Code: Select all

ultrasonicSensor1  = [3.1441450119018555e-05, 4.982848622603342e-05, 0.3612610697746277]
ultrasonicSensor2  = [0.10018845647573471, 8.103251457214355e-05, 0.40471550822257996]
ultrasonicSensor7  = [-0.10175387561321259, -8.227117359638214e-05, 0.4110390841960907]
ultrasonicSensor8  = [3.156896127620712e-05, -4.9985104851657525e-05, 0.36239516735076904]
ultrasonicSensor9  = [3.086135984631255e-05, -4.999287557438947e-05, 0.362407386302948]
ultrasonicSensor10 = [0.10178583860397339, -8.78119608387351e-05, 0.4111681878566742]
ultrasonicSensor15 = [-0.10145333409309387, 8.26176255941391e-05, 0.40982508659362793]
ultrasonicSensor16 = [3.178436600137502e-05, 4.982828613719903e-05, 0.36124250292778015]

CoppeliaSim (Wrong readings for sensors 1, 2, 15 and 16)

Code: Select all

ultrasonicSensor1  = [5.331297870725393e-05, 8.431146125076339e-05, 0.6112610101699829]
ultrasonicSensor2  = [0.16708533465862274, 0.00013599544763565063, 0.6749482154846191]
ultrasonicSensor7  = [-0.10175386071205139, -8.243322372436523e-05, 0.4110390543937683]
ultrasonicSensor8  = [3.158394247293472e-05, -4.989875014871359e-05, 0.36239519715309143]
ultrasonicSensor9  = [3.0899773264536634e-05, -4.9993097491096705e-05, 0.3624073565006256]
ultrasonicSensor10 = [0.1017858237028122, -8.775293827056885e-05, 0.4111681580543518]
ultrasonicSensor15 = [-0.16834445297718048, 0.0001361500471830368, 0.6800345778465271]
ultrasonicSensor16 = [5.369991413317621e-05, 8.431158494204283e-05, 0.6112424731254578]

Apparently the issue is only present on the left sensors of the robot, which makes me think that the performance improvements introduced in proximity sensor handling broke something. My guess is that the problem has to do with the base change from the robot's reference frame to sensor coordinates.

In case it has something to do or is of any help, I am running the simulator in macOS using the Python Remote API. The first sensor value read uses simxReadProximitySensor in streaming mode and the subsequent in buffer mode. However, with blocking I get the same results shown above.

coppelia
Posts: 8450
Joined: 14 Dec 2012, 00:25

### Re: Proximity sensor incorrect detected points in CoppeliaSim

Hello,

thanks for the info. Your setup is too complicated and too random for us to try to reproduce it. Can you create a minimalistic scene that illustrates your problem, so that we can have a look at it? Best would be to have two objects in the scene, and a single measurement that differs between V-REP and CoppeliaSim. No remote API, since that could introduce other differences not linked to the proximity sensors (e.g. typically, when streaming data from CoppeliaSim/V-REP to your remote API client, you will see timing differences between the execution speed of CoppeliaSim/V-REP and the client application..

Cheers

jboalml
Posts: 2
Joined: 29 Dec 2019, 12:31

### Re: Proximity sensor incorrect detected points in CoppeliaSim

Please find attached a minimal sample environment using a child script on the Pioneer_p3dx robot that reproduces the error. The distance to the left wall measured by ultrasonicSensor1 is output to the console. As you can see, the values differ from V-REP (correct) to CoppeliaSim (incorrect).

Hope this helps!

coppelia
Posts: 8450
Joined: 14 Dec 2012, 00:25

### Re: Proximity sensor incorrect detected points in CoppeliaSim

Hello again,

there was indeed a bug happening in rare situations, thanks for finding it! It was corrected. You can either re-download the whole package, or only the incriminated library:
ubuntu16_04
ubuntu18_04
Windows