Lidar

Lidar Visualization Lidar Visualization

Overview

BeamNG.tech ships with a simulated Lidar sensor which extracts point clouds from a customizable point on the vehicle. The horizontal angle, rotational radius, fire rate, etc. can be customized by the user and multiple Lidars can be used at once.

Usage

Lidars are exposed to Lua as a class. Upon construction, it is passed the vehicle ID the Lidar is attached to, the direction the Lidar is facing, and various parameters that change the behavior of the laser.


research.Lidar(vehicleID, offset, direction, verticalResolution, verticalFOV, raysPerSecond, hz, horizontalFOV, maxDistance)

Args:

vehicleID(int): vehicle id

offset(Point3F): spatial offset relative to vehicle

direction(Point3F): rotation axis of sensor

verticalResolution(int): vertical resolution

verticalFOV(float): vertical field of view

raysPerSecond(float): number of laser measurements per second

hz(float): refresh rate

horizontalFOV(float): horzontal field of view

maxDistance(float): range


lidar:open(shmemName, shmemSize)

After construction, the Lidar is not yet active and needs to be opened first. This method can be supplied with a shared memory handle to write points to. If none is given, data will be exchanged purely via Lua.

Args:

shmemName(const char*): shared memory id shmemSize(int): shared memory size

Returns: nil


lidar:close()

Removes lidar instance.

Args:

nil

Returns: nil


lidar:enabled(value)

Args:

value(bool): flag for starting/stopping the sensor

Returns: nil


lidar:visualized(value)

Args:

value(bool): En- or disabling the render of Lidar points in the simulator.

Returns: nil


lidar:setVerticalRes(vRes)

Args:

vRes(int): vertical resolution

Returns: nil


lidar:setRaysPerSecond(n)

Args:

n(float): number of laser measurements per second

Returns: nil


lidar:setHorizontalHZ(hz)

Args:

hz(float): setting the refresh rate

Returns: nil


lidar:setMaxDistance(maxDist)

Args:

maxDist(int): sets the range

Returns: nil


lidar:getVerticalRes()

Args:

nil

Returns: int (vertical resolution)


lidar:getRaysPerSecond()

Args:

nil

Returns: float (number of rays per second)


lidar:getHorizontalHZ()

Args:

nil

Returns: float (refresh rate)


lidar:getMaxDistance()

Args:

nil

Returns: int (sensor range)


lidar:requestData(callback)

Making current Lidar data available in lua.

Args:

callback(function): takes an indexed lua table as input argument and puts every point (lua table with x, y, z attribute) into a table

Returns: nil


Page created: 29 December 2018, at 11:02
Last modified: 14 October 2021, at 19:57
On this page:

Any further questions?

Join our discord