Roads sensor

Overview

The roads sensor provides geometric and semantic data of the road where the vehicle stands within a certain (modifiable) distance ahead. Main input of the sensor is the navigation graph map, the coordinates of its nodes and the road width at these nodes. The sensor outputs the coordinates of the four closest points on the centerline of the road, the cubic parametric polynomial (U and V equations) of the centerline and the left and right roadedges. There is also information on the drivability of the road, the speed limit and if it is a one-direction road or not.

Usage

The roads sensor code is written in Lua code and has an API similar to the other sensors in our suite.


sensorId = extensions.tech_sensors.createRoadsSensor(vid, args)

Args:

vid(int): An id that leads to the vehicle id

GFXUpdateTime(float): How often the roads sensor should update its readings in the simulator (in seconds). This determines how often the user will be able to retrieve a new reading from the sensor.

physicsUpdateTime(float): How often in the simulator’s physics step, we should update the roads sensor readings (in seconds).

Returns: sensorId(int): The unique Id number of this sensor, useful to refer to it hereafter, for example when closing it.


extensions.tech_sensors.setRoadsSensorUpdateTime(sensorId, vid, updateTime)

Args:

sensorId(int): The ID number of the roads sensor.

vid(int): the id number which leads to the vehicle id.

updateTime(float): The new update time for this sensor.

Returns: nil


readings = extensions.tech_sensors.getRoadsSensorReadings(sensorId)

Args:

sensorId(int): The ID number of the roads sensor.

Returns: readings(table): The latest readings from the sensor


The following three functions can be used to send ad-hoc polling requests to a roads sensor. This is for when we need to first send a request using sendRoadsSensorRequest, then wait for it. We can check it is complete using isVluaRequestComplete then retrieve it using collectRoadsSensorRequest.

requestId = extensions.tech_sensors.sendRoadsSensorRequest(sensorId, vid)

Args:

sensorId(int): The ID number of the roads sensor.

vid(int): id number that helps get the vehicle id.

Returns: The unique Id number of the ad-hoc sensor polling request which is being sent.


isComplete = extensions.tech_sensors.isVluaRequestComplete(requestId)

Args:

requestId(int): The ID number of the ad-hoc sensor polling request to check on.

Returns: isComplete(bool): True if the ad-hoc polling request has been completed, otherwise false.


data = extensions.tech_sensors.collectRoadsSensorRequest(requestId)

Args:

requestId(int): The ID number of the ad-hoc sensor polling request.

Returns: data(table): The roads sensor readings


extensions.tech_sensors.removeRoadsSensor(vid, sensorId)

Args:

vid(int): The id used to get the vehicle id. sensorId(int): The ID number of the roads sensor to remove.

Returns: nil.

Last modified: 4/10/2023 15:27
On this page:

Any further questions?

Join our discord