Class CameraSensingComponent
This class implement the sensing part of the photosensor.
This implementation relies on a Unity camera to measure depth and intensity. Thus, all incoming rays have to converge to a single point, the camera effective pinhole. Consequences:
- Origin of individual beams (e.g. for multi-beam lidars) will be ignored and assumed to be at the camera pinhole.
- Photosensor translation cannot be interpolated; if the lidar is moving in the scene, all samples taken during a Unity update will use the final lidar position, introducing translational error.
- Lidars usually have constant angular difference between consecutive beams, while cameras have constant translational difference between consecutive pixels. Thus, some approximation must be made, leading to slight depth inaccuracies compared to a ray tracing implementation.
For the last point, use the Max Approx Error field to configure the maximum approximation angular error, that is, the maximum angle between the desired lidar beam and the closest camera ray going through a pixel center. This is used to compute the texture size used by the camera.
The code also uses a few assumptions:
- Beams in beamPoses are roughly oriented along the positive Z axis.
- Photosensor angular speed is constant, which avoid having to look at all the stamps.
- Looking at the photosensor pose at the previous frame and at the current frame is enough to compute a bounding box.
- Photosensor turns less than 120 degrees between consecutive updates, otherwise some lidar points may be missing.
Warning: this will not work for lidar using beam patterns (e.g. MEMS) instead of physically moving the photosensor, since it violates the first assumption.
Inheritance
Inherited Members
Namespace: Mechatronics.SensorSDK
Assembly: solution.dll
Syntax
[Serializable]
public class CameraSensingComponent : PhotosensorSensingComponent
Fields
Name | Description |
---|---|
maxApproxErrorDeg | Maximum approximation angular error, i.e. maximum angle between the desired lidar beam and the closest camera ray going through a pixel center. This is used to compute the texture size used by the camera. |
Methods
Name | Description |
---|---|
Activate(PhotosensorData, GameObject, Action<CustomPassContext>) | Initializes the sensing component. |
Deactivate() | Releases the sampler and other GPU resources. |
InitializeComputeShader(string, string) | Load and find the kernel in a compute buffer. |