Skip to content

マルチタブ化

マルチTub化

MultiTub化することで、保存データをフォルダわけすることが可能です。

RaspberryPi側のmanager.pyを修正します。

multiple tubsの部分のコメントを外し、single tubの部分を無効にします。

~/mycar/manage.py

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
import os
from docopt import docopt

import donkeycar as dk
from donkeycar.parts.datastore import TubGroup, TubWriter, TubHandler
from donkeypart_ps3_controller import F710JoystickController
from donkeycar.parts.camera import PiCamera
from donkeycar.parts.transform import Lambda
from donkeycar.parts.keras import KerasLinear
from donkeycar.parts.actuator import PCA9685, PWMSteering, PWMThrottle

...

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
    V.add(steering, inputs=['angle'])
    V.add(throttle, inputs=['throttle'])

    # add tub to save data
    inputs = ['cam/image_array', 'user/angle', 'user/throttle', 'user/mode', 't$
    types = ['image_array', 'float', 'float',  'str', 'str']

    # multiple tubs
    th = TubHandler(path=cfg.DATA_PATH)
    tub = th.new_tub_writer(inputs=inputs, types=types)

    # single tub
    #tub = TubWriter(path=cfg.TUB_PATH, inputs=inputs, types=types)