|
|
import datasets |
|
|
import pandas as pd |
|
|
import pyarrow as pa |
|
|
|
|
|
PLATFORMS = ["ACURA_RDX_2020", "AUDI_A3_3RD_GEN"] |
|
|
|
|
|
_URLS = [f'https://huggingface.co/datasets/commaai/commaSteeringControl/resolve/main/data/{platform}.zip' for platform in PLATFORMS] |
|
|
|
|
|
_DESCRIPTION = "Steering controls dataset from cars running openpilot" |
|
|
|
|
|
|
|
|
class CommaSteeringControl(datasets.ArrowBasedBuilder): |
|
|
|
|
|
def _info(self): |
|
|
return datasets.DatasetInfo( |
|
|
description=_DESCRIPTION, |
|
|
features=datasets.Features( |
|
|
{ |
|
|
"t": datasets.Value("float"), |
|
|
"latActive": datasets.Value("bool"), |
|
|
"steeringPressed": datasets.Value("bool"), |
|
|
"vEgo": datasets.Value("float"), |
|
|
"aEgo": datasets.Value("float"), |
|
|
"steeringAngleDeg": datasets.Value("float"), |
|
|
"steer": datasets.Value("float"), |
|
|
"steerFiltered": datasets.Value("float"), |
|
|
"roll": datasets.Value("float"), |
|
|
"latAccelSteeringAngle": datasets.Value("float"), |
|
|
"latAccelDesired": datasets.Value("float"), |
|
|
"latAccelLocalizer": datasets.Value("float"), |
|
|
"epsFwVersion": datasets.Value("string"), |
|
|
} |
|
|
) |
|
|
) |
|
|
|
|
|
def _split_generators(self, dl_manager): |
|
|
downloaded_files = dl_manager.download(_URLS) |
|
|
return [ |
|
|
datasets.SplitGenerator( |
|
|
name=PLATFORMS[i], |
|
|
gen_kwargs={ |
|
|
"files": dl_manager.iter_archive(downloaded_files[i]) |
|
|
} |
|
|
) for i in range(len(downloaded_files)) |
|
|
] |
|
|
|
|
|
def _generate_tables(self, files): |
|
|
for path in files: |
|
|
df = pd.read_csv(path[1]) |
|
|
pa_table = pa.Table.from_pandas(df) |
|
|
yield path[0], pa_table |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|