DistanceSensor
This simulation component outputs a value indicating the distance to a 3D object within a configured range. This can be for example an optical distance sensor or an ultrasonic distance sensor.
When to use
Use this simulation component if you want to output a value indicating the distance to a 3D object.
For example, beams of different lengths run through a machine. The distance sensor is intended to measure the lengths in order to correctly pre-position a linear axis in order to be able to align the carriers on a stop.
How to use
Add this simulation component from the simulation component library.
If the sensor should be attached to a 3D object, select the 3D object either in the 3D View
window or in the Assembly Structure
window by using the select button near the property Object3D
.
After that you can adjust the origin of the light ray, change direction and define the valid window in which the measurement should be executed.
Note
The ray only detect 3D objects, which are part of the physical simulation.
That means, only 3D objects whose Rigid Body Behavior
is not equal to None
can interrupt the light ray.
Parameters
GlobalDirection
Indicates the direction of the light ray in the global coordinate system.
GlobalOrigin
Indicates the origin of the light ray in the global coordinate system.
WindowStart
A value indicating the start of the defined measurement window in m.
WindowEnd
A value indicating the end of the defined measurement window in m.
DefaultDistanceOutput
A value indicating the default distance output when no object is within the specified window.
Possible values are:
Value | Description |
---|---|
Window End | The WindowEnd value is set as default distance output when no object is within the specified window. |
Window Start | The WindowStart value is set as default distance output when no object is within the specified window. |
Zero | Zero is set as default distance output when no object is within the specified window. |
Object3D
Indicates the 3D object the light ray is attached to. If not set, the reference of the light ray is the world origin.
Outputs
Distance
An output indicating the distance of the nearest object in m. If the object is outside the defined window, distance is the specified DefaultDistanceOutput
.
Interrupted
An output indicating whether the light ray is interrupted by an other physical 3D object or not.
NotInterrupted
An output indicating whether the light ray is not interrupted by an other physical 3D object or is.
Example
In this example, the length of different beams should be measured as shown in the picture before. Therefore the sensor 3D object is selected as template and the windows are defined as shown in the picture below.
If no beam is detected in the defined range of 0.2 to 6 m, the sensor outputs zero. The valid window is in the area of the red highlighted ray.