Discussion: Interpretation of points for Trajectories and SetPosition
While working on the openScenarioEngine we came across the following situation:
- Coordinates coming from the openSCENARIO file defines positions w.r.t the center of rear axle.
- When communicating these points to the simulation, e.g. within the TeleportAction, we use
IEntity::SetPosition(...)
This method specifies the points w.r.t to the center of the bounding box, so we do a proper coordinate transformation before sending the data to the simulator - Internally, the simulator uses the same definition as openSCENARIO and we reverse the coordinate transformation, which means that:
- we do the same (reverse) transformation again -> highly inefficient
- we need to know the properties of the entity (which is okay for SetPosition, as we are inside if the implementation of the Entity itself)
The actual issue arise when we now look at Trajectories. To be consistent with Mantle, we also translate the points to the center of the bounding box, but it is not our core component, which implements the actual trajectory. Instead we have 2 different modules interpreting the trajectory. That means that every module needs to do the same reverse transformation and needs to know about the offset to be applied. Note that we do not write directly to the Entities via SetPosition, which would solve that issue indirectly. Also potential calculations need the translated positions.
- This is also highly inefficient
- It opens the door for potential bugs
- We need to propagate the translation to the modules
We propose to enhance the SetPosition
method as well as the definition of the Trajectory
by an optional enumeration defining, how to interpret the position and which defaults to the center of the bounding box.
e.g.:
SetPosition({1_m,, 2_m, 0_m}, AnchorType::CenterOfBoundingBox)
SetTrajectory({{1_m,, 2_m, 0_m}, {3_m, 4_m, 0_m}}, AnchorType::CenterOfRearAxle)
Any ideas about that?