The Sandbox: the AVSandbox knowledge hub
The Sandbox knowledge hub discusses many of the crucial issues affecting the development, engineering, use and regulation of Autonomous Vehicles.
Scroll to explore
What is a Map Sensor?
Introduction
For a vehicle driving along a road, it can be difficult to define its location in terms we can understand. While both GPS and IMUs can give data in cartesian coordinates relative to a start point, they do not naturally inform how the vehicle is situated on the road. They do not explain if the vehicle is navigating a tricky corner or running off the road and whether the trajectory of the vehicle is following the centre of the lane or taking the racing line.
The map sensor plugin introduces the concept of a road coordinate system where s is the displacement down a road, t is the lateral displacement in to the lane and u is the vertical offset. The map sensor is a virtual sensor that extracts information from the map using an OpenDrive file. The plugin gives the user access to 19 different metrics, including the current road id, the distance down the road and the lateral offset relative to both the road and the lane.
The purpose of the map sensor is to provide ground truth data for testing ADAS and autonomous vehicle systems. The data can be accessed in real time using UDP or postprocessed with Claytex’s Analysis tool. Lane Keeping and Lane Centering features can be tested easily using the variables provided including the lateral distances to the lane boundaries and the time until lane crossing (TTLC). The lane offset value can be used as feedback for reinforcement learning to teach the vehicle how to behave in lane. A list of all the parameters in the map sensor are included at the end. A section of the Leonberg Autobahn is depicted in Figure 1, below, with each road ID shown in a different colour.
Figure 1: OpenDrive Map of Leonberg Autobahn
Map Sensor Workflow
The workflow below explains how to set up and use the map sensor using Claytex Simulation Manager and rFpro.
- Open up Claytexs’ Simulation Manager as normal with one Dedi and Physics x64 instance
- In a Physics instance go to WarpBlend Plugin in 0 – Plugins section and select MapSensor (Shown in Figure 2)
- In section 4 – Sensor Specific, write the file path to the OpenDrive file you wish to use
- If UDP is required, go to the MapSensor ini file and activate it there.
- In the Scenario tab, select the road model to match the .xodr file
- Under Metric Calculator select the WriteToMatlabFile
- Make any additional changes to the vehicle and scenario as desired for your project
- In the Status tab click Apply then Start All.
- Control the vehicle as desired in rFpro and close once finished.
- The results can now be viewed in the Analysis tab or exported to Matlab.
Data Analysis
Using the data collected from a test run with the map sensor on Figure 3, below, compares the direction of the road with the direction of the ego vehicle in the analysis tab. Notably the heading values are bounded between -pi and pi. The offset between the vehicle and road heading occurs when the vehicle is not parallel to the lane. The difference can be observed in more detail with the roadHeading metric.
Figure 3: Simulation Manager Map Sensor analysis
Post processing the trajectory of a vehicle allows the performance to be assessed. It is common to analyse the lateral offset of a vehicle in lane, but this gets more involved when moving between roads. Simulation is especially important for high level autonomy features which use maps of the road to help with navigation to test edge cases and performance.
Road Coordinate System
The road coordinate system is defined where s is the offset down the road, t is the lateral displacement and u is the vertical offset. A similar concept is used in Dymola which uses w in place of t. As a vehicle moves down a road, the coordinate directions change relative to global coordinates. The coordinate system in Figure 4 below moves almost 90 degrees between when the vehicle joins the green road at A and leaves it at B. This coordinate system is essential for comparing positions and manoeuvres relative to the road, however care should be taken in noting if the vehicle is going in the same direction as the road is defined or against it. Moving between roads changes the s and t as different roads have different start coordinates and angles.
Figure 4: Road Coordinate System
Summary
By measuring data relative to the road, it is more intuitive to read how a vehicle moves in its lane and between roads. Using the OpenDrive road description, the performance of AV and ADAS features, such as lane centring and lane changing can be analysed in detail.
Written by Rob Smith – Project Engineer
Please get in touch if you have any questions or have got a topic in mind that you would like us to write about. You can submit your questions / topics via: Tech Blog Questions / Topic Suggestion
Ultra photorealism in AVSandbox
Thanks to the hard work of rFpro, ultrarealistic light rendering is now available in the AVSandbox toolkit. This is ...
Tackling High Development Costs: How AVSandbox Can Accelerate Your Autonomous Vehicle Deployment
Reducing costs of autonomous vehicle development without compromising AV Safety The development and successful deployment of autonomous vehicles is ...
Determinist Traffic Simulation
Introduction In my previous blog deterministic scenario simulation, I detailed why we define our simulator deterministic and what is ...