File sim/src/components/Dynamics_RegularTwoTrack/dynamics_regularTwoTrack.cpp
In DynamicsRegularTwoTrackImplementation::Init() several values are accessed through parameter maps, without proper checking for existence.
Example:radiusTire.SetValue(parameterMapDoubleExternal.find(radiusTire")->second); Issue: If the key is missing, find delivers std::end(parameterMapDoubleExternal) and ->second accesses some arbitrary value right after the memory or the map. Solution: The parameters should come from recently introduced VehicleModelParameters
This Bug is triggered by the example config set StaticAgentCollision, commit 7d63754d. Module Dynamics_RegularTwoTrack calculates the acceleration of agent 2 as NaN in timestep 0, resulting in AgentUpdater throwing an error.
What is the objective of this test? I don't see a query in the json file for determining success.
When I take the configs, the simulation works and there is a valid collision between two agents.
However, I assume there is a conflict between the parameter import from the VehicleModelsCatalog and the parameters needed from the static SystemConfig, as in the PCM E2E test.
If we include an additional vehicle model in the VehicleModelsCatalog that contains the required parameters, we need to adapt the TwoTrack model, too.
The other option is to include the parameters in the static SystemConfig, am I right?
<component><id>7</id><library>Dynamics_TwoTrack</library><title>Dynamics_TwoTrack</title><schedule><priority>3</priority><offset>0</offset><cycle>10</cycle><response>0</response></schedule><parameters><parameter><!--parameter's title: Radius of the tires--><id>0</id><type>double</type><unit>m</unit><value>0.3</value></parameter><parameter><!--parameter's title: Tire's max. mu--><id>1</id><type>double</type><unit/><value>1.1</value></parameter><parameter><!--parameter's title: Tire's slide mu--><id>2</id><type>double</type><unit/><value>0.8</value></parameter><parameter><!--parameter's title: Tire's slip at max. mu--><id>3</id><type>double</type><unit/><value>0.1</value></parameter><parameter><!--parameter's title: Engine power--><id>4</id><type>double</type><unit>W</unit><value>100000</value></parameter><parameter><!--parameter's title: Max. brake torque--><id>5</id><type>double</type><unit>Nm</unit><value>-10000</value></parameter></parameters><position><x>1176</x><y>369</y></position></component>
Yes, there is no specialized E2E test for this config (no query in json file). But it is part of the Generic config set, for which determinism tests are enabled. The determinism test for this specific config fails on !122 (merged).
The determinism test runs three invocations (configured in simulationConfig.xml) starting from random seed 1, so the invocations will have random seed 1, 2, and 3. Then there will be three individual runs with a single invocation, each run configured to start at random seed 1, 2, and 3, respectively. The cyclics of runs with matching random seeds are compared afterwards. This comparison shows a difference for random seed 2 of StaticAgentCollision. NOTE: Values for random seeds shortened here for simplicity.
The root cause is that the SystemConfig.xml of Dynamics_**Regular**TwoTrack component is missing the parameters you mentioned above. Another aspect is, that the component tries to access them unconditionally, leading to undefined behavior (dereferencing an end() iterator returned by find()).
Also, #36 (closed) should be considered before putting to much effort into this (duplication between Dynamics_RegularTwoTrack and Dynamics_TwoTrack).
I'll take the config snippet posted above and put it into the SystemConfig.xml part of Dynamics_RegularTwoTrack. If this fixes the execution and the simulation result still looks reasonable, we can happily proceed with !122 (merged). If this is not the case, I'd disable the test for now and re-enable it when handling this issue here.
Thanks a lot for the explaination. The reason for the duplication #36 (closed) was the different dynamics signals, as I remember.
The bigger issue we should tackle anyway wrt static system configs is the different parameter IDs for SystemConfig.xml when the new GUI comes into play.