2.2.4.2 Coordinate transformations
2.2.4.2.1 Vehicle and sensor coordinate systems
When running simulations, it is frequently necessary to transform coordinates from the global coordinate system for a specific vehicle and its sensors.
This section provides an overview of the messages and fields involved and their relationship for this task. It demonstrates how a global coordinate system, vehicle coordinate system, and sensor coordinate system are related on the basis of a specific (ego) vehicle.
Mathematical Definitions of Coordinate Transformations
All vectors and matrices are noted with reference frame as a superscript index and the direction of translation as a subscript index. [9] The translation direction is from the first index to the second index (src: source coordinate system, trg: target coordinate system). The vector \(\boldsymbol{v}^x\) denotes the 3D position of an object in the coordinate frame \(x\). Vector \(\boldsymbol{t}\) is the translation vector between two coordinate systems with the described indices for reference frame and direction. The angles yaw \(\psi\) around the z-axis, pitch \(\theta\) around the y-axis and roll \(\phi\) around the x-axis are defined in a right handed coordinate system according to DIN ISO 8855:2013 [6]. The sign of the angles corresponds to the direction of the transformation.
Transformation from source \(src\) to target \(trg\) coordinates:
Transformation back from target \(trg\) to source \(src\) coordinates
With the rotation matrix (from rotating the coordinate system) [10]:
Get Tait–Bryan angles from rotation matrix [11]:
Relative orientation:
Object rotation Matrix: \(\boldsymbol{R}_{object}^{src}\)
Host vehicle rotation Matrix: \(\boldsymbol{R}_{ego}^{src}\)
Resulting rotation matrix between object and host: \(\boldsymbol{R}_{object}^{src}(\boldsymbol{R}_{ego}^{src})^{T}\)
To transform from world coordinates into host vehicle coordinates and back use the formulas from above with the world coordinates frame \(w\) as source system \(src\) and host vehicle coordinates frame \(v\) as target system \(trg\). To transform from host vehicle coordinates into sensor coordinates and back use the formulas from above with the host vehicle coordinates frame \(v\) as source system \(src\) and sensor coordinates frame \(s\) as target system \(trg\).
Corresponding messages
GroundTruth::moving_object::base::position
-
This field defines the position of the vehicle’s reference point in global coordinates. In Open Simulation Interface, an object’s position is defined by the coordinates of the center of the object’s 3D bounding box.
GroundTruth::moving_object::base::orientation
-
This field defines the orientation of the vehicle’s reference point in global coordinates.
GroundTruth::moving_object::vehicle_attributes::bbcenter_to_rear
-
This field specifies the vector pointing from the vehicle’s reference point to the middle of the rear axle under neutral load conditions.
SensorData::mounting_position
-
This field defines the sensor’s virtual mounting position and orientation and thereby the origin of the virtual sensor coordinate system. The mounting position is given in the host vehicle coordinate system.
Example
The following image shows the relationship between the coordinate systems. The reference point of the vehicle is given by a vector in the global coordinate system. A vector pointing from the reference position of the vehicle to the center of the rear axle then yields the origin of the host vehicle coordinate system. The mounting positions of the sensors and therefore the origins of the corresponding sensor coordinate systems are given with respect to the host vehicle coordinate system.