File size: 2,053 Bytes
6f3affa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8b0ea1d
 
 
 
6f3affa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# coding=utf-8

import pandas as pd
import datasets

_DATA_URL = 'https://frodobots-1k.s3.ap-southeast-1.amazonaws.com/frodobots-1k_20230907_getting-started.zip'

_DESCRIPTION = '''\
'''

_HOMEPAGE = 'https://www.frodobots.com'

_LICENSE = ''

_CITATION = ''

class Test(datasets.GeneratorBasedBuilder):

    BUILDER_CONFIGS = [
        datasets.BuilderConfig(
            name='test',
            version=datasets.Version('1.0.0', ''),
            description='',
        )
    ]

    def _info(self):
        features = datasets.Features(
            {
                'speed': datasets.Value('float32'),
                'angular': datasets.Value('float32'),
                'rpm_1': datasets.Value('int32'),
                'rpm_2': datasets.Value('int32'),
                'rpm_3': datasets.Value('int32'),
                'rpm_4': datasets.Value('int32'),
                'timestamp': datasets.Value('float64'),
            }
        )
        return datasets.DatasetInfo(
            description=_DESCRIPTION,
            features=features,
            supervised_keys=None,
            homepage=_HOMEPAGE,
            license=_LICENSE,
            citation=_CITATION,
        )


    def _split_generators(self, dl_manager):

        archive = dl_manager.download_and_extract(_DATA_URL)
        return [
            datasets.SplitGenerator(
                name=datasets.Split.TRAIN, gen_kwargs={'files': archive + '/frodobots-1k_20230907_getting-started/frodobot2e6388/20230522142406/control_20230522142406.csv', 'split': 'train'}
            ),
        ]

    def _generate_examples(self, files, split):
        df = pd.read_csv(files)
        for index, row in df.iterrows():

           yield index, {
             'speed': row['speed'],
             'angular': row['angular'],
             'rpm_1': row['rpm_1'],
             'rpm_2': row['rpm_2'],
             'rpm_3': row['rpm_3'],
             'rpm_4': row['rpm_4'],
             'timestamp': row['timestamp'],
           }

if __name__ == '__main__':
   Test().download_and_prepare()