A converter that turns real-vehicle logging CSVs into a CarMaker IFF trajectory + TestRun. The goal is to replay a drive recorded on a proving ground (position, attitude, speed) along the very same trajectory in simulation. It handles a single ego vehicle.
Python standard library only (not even numpy).
./log2testrun.pyAll it does is move the latitude/longitude in the log into the CarMaker inertial frame Fr0.
| Step | What happens |
|---|---|
| CSV parsing | Per-device channel names are absorbed by profiles, giving samples of (time, lat/lon, heading, altitude, attitude, speed, steering angle) |
| WGS84 → ECEF → ENU | Into a local tangent plane whose origin is the first sample |
| Smoothing | Position quantization noise is removed with Savitzky-Golay; the window width is derived from the actual position update period |
| ENU → track frame | The principal axis of the trajectory is taken as the track azimuth, and the motion is split into longitudinal / lateral displacement |
| Track → Fr0 | Rotated into the heading of the target rd5 and translated by the start station and lane offset |
| Check | Path length before and after the transform, and speed differentiated from position against the logged speed, are reported |
If the driven distance exceeds the road, the straight segment of the rd5 is extended as far as needed and written out anew.
Three files land under --outdir (out/ by default), laid out like a CarMaker
project. Copy them straight into your CarMaker project directory.
out/
├── SimInput/<name>.csv IFF trajectory — tab separated, first line is the "# " channel names
├── Data/Road/<name>.rd5 extended road, when needed
└── Data/TestRun/<name> TestRun (InfoFile)
log2testrun.py entry point
log2sim/
├── logreader.py logging CSV parsing, per-device channel profiles
├── geodesy.py WGS84 → ECEF → ENU, angle utilities
├── smoothing.py Savitzky-Golay smoothing
├── convert.py coordinate transform orchestration and output writing
├── road.py rd5 reading and straight segment extension
├── iff.py IFF trajectory file rendering
├── testrun.py TestRun InfoFile template, DrivMan.OW block
└── cli.py command line entry point
data/
├── can/ logging CSVs
├── simulation/ reference rd5, vehicle datasets
└── testrun_example/ examples shipped with CarMaker (IFF format reference)