Vehicle Terrain Sensor
Vehicle and tire distances to objects
Vehicle Terrian Sensor will be removed in a future release. Use Simulation 3D Terrain Sensor instead. For more information, see Version History.
Libraries:
Vehicle Dynamics Blockset /
Vehicle Scenarios /
Sim3D /
Sim3D Vehicle /
Components
Description
Note
Simulating models with the Vehicle Terrain Sensor block requires Simulink® 3D Animation™.
The Vehicle Terrain Sensor block implements ray tracing to detect the terrain below the tires and objects in front of the vehicle. Specifically, for these actor components, the block returns the hit location (in the world coordinate system) and the distance to an object.
Vehicle body
Left front wheel
Right front wheel
Left rear wheel
Right rear wheel
Tip
Verify that the Vehicle Terrain Sensor block executes before the Simulation 3D Fisheye Camera block. That way, the Unreal Engine® 3D visualization environment prepares the data before the Vehicle Terrain Sensor block receives it. To check the block execution order, right-click the blocks and select Properties. On the General tab, confirm these Priority settings:
Simulation 3D Scene Configuration —
0
Vehicle Terrain Sensor —
1
For more information about execution order, see Control and Display Execution Order.
Actors are scene objects that support 3D translation, rotation, and scale. Parts are actor components. Components do not exist by themselves; they are associated with an actor.
Hit Distance
To calculate the hit distances shown in the illustration, the block implements these equations.
Front of vehicle to object, DistToHitVhAdjust |
DistToHitVh = GetLength(CntrLocVh,HitLocVh) DistToHitVhAdjust = DistToHitVh - VehCntrLngthVal EndLocVh = CntrLocVh + VehRayLngth - VehRayOffset VehRayOffset = CntrLocVh - StartLocVh VehRayLngth = StartLocVh - EndLocVh |
Tires to terrain, DistToHitTrAdjust |
DistToHitTr = GetLength(CntrLocTr, HitLocTr) DistToHitTrAdjust = DistToHitTr - TireRadiiVal EndLocTr = CntrLocTr + LengthTr - OffsetTr OffsetTr = CntrLocTr - StartLocTr LengthTr = StartLocTr - EndLocTr |
This illustration and equations use these variables.
CntrLocVh | Vehicle center location |
DistToHitVh | Distance from vehicle center location to object |
DistToHitVhAdjust | Distance from the front of the vehicle to object |
EndLocVh | Vehicle ray trace end |
HitLocVh | Vehicle hit location |
OffsetVh | Vehicle trace offset |
StartLocVh | Vehicle ray trace start |
VehRayLngth | Vehicle trace length |
VehCntrLngthVal | Distance from vehicle center to front |
CntrLocTr | Tire center location |
DistToHitTr | Distance from tire center location to terrain |
DistToHitTrAdjust | Distance from tire to terrain |
HitLocTr | Tire hit location |
EndLocTr | Tire ray trace end |
OffsetTr | Tire trace offset |
StartLocTr | Tire ray trace start |
LengthTr | Tire trace length |
TireRadiiVal | Tire radius |
Hit Event
To determine a hit event, the block uses the ray trace. The block provides the hit location in the world coordinate system.
Miss Event
To determine a miss event, the block uses the ray trace.