Custom SPAD sensor

Typically: "How do I... ", "How can I... " questions
Post Reply
simtiaz
Posts: 1
Joined: 26 Feb 2021, 18:25

Custom SPAD sensor

Post by simtiaz »

Hi all,
I am currently new to CoppeliaSim and needed pointers on how to go about creating a custom sensor in the simulator. Essentially, I'm trying to simulate a Single-Photon Avalanche Diode (SPAD) sensor. It works most similarly to the random-ray proximity sensors already built in, in that it shoots random rays of light within a cone and picks up photons one at a time. It collects all these photon measurements in a histogram, and then outputs the average or peak of the histogram as the distance from an object.
I wanted to know if there was a way to try and recreate this behavior on CoppeliaSim and ideas on how I might be able to accomplish this.

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

Re: Custom SPAD sensor

Post by coppelia »

Hello,

you have three ways to go about this:
  • use a ray-type proximity sensor mounted on top of two serially built revolute joints. Attach a child script to the sensor, and every simulation step, in the sensing section, acquire n points by applying random values (within a certain range) to your two joints, then reading the sensor. Make sure to multiply the acquired coordinates with the transformation of the sensor, to get absolute values (otherwise values are relative to the sensor itself). You'll have n values that you can then process and generate from them the desired output. The proximity sensor needs to be explicitely handled in that case.
  • use a randomized ray-type proximity sensor. Adjust its volume to what you need. Then click Show detection parameters and specify 1 for Ray count, and 1 for Ray detections count for triggering. Then at procedure is similar as to the first point above. Here too, the proximity sensor needs to be explicitely handled.
  • use a vision sensor. Read one image in each simulation step, then randomly pick pixels and read their depth values (i.e. with sim.getVisionSensorDepthBuffer).
I'd go with solution 2, since it is probably the easiest. With solutions 1 and 3, you will have to watch out yourself to generate evenly distributed random sampling directions.

Cheers

Post Reply