Beispiel #1
0
def create_sample_tub(path, records=128):
    inputs = [
        'cam/image_array', 'user/angle', 'user/throttle',
        'location/one_hot_state_array'
    ]
    types = ['image_array', 'float', 'float', 'vector']
    t = Tub(path, inputs=inputs, types=types)
    cam = SquareBoxCamera()
    tel = MovingSquareTelemetry()
    num_loc = 10
    for _ in range(records):
        x, y = tel.run()
        img_arr = cam.run(x, y)
        loc = [0 for i in range(num_loc)]
        loc[1] = 1.0
        t.put_record({
            'cam/image_array': img_arr,
            'user/angle': x,
            'user/throttle': y,
            'location/one_hot_state_array': loc
        })

    global temp_tub_path
    temp_tub_path = t
    print("setting temp tub path to:", temp_tub_path)

    return t
Beispiel #2
0
def create_sample_tub(path, records=10):
    inputs = ['cam/image_array', 'angle', 'throttle']
    types = ['image_array', 'float', 'float']
    t = Tub(path, inputs=inputs, types=types)
    cam = SquareBoxCamera()
    tel = MovingSquareTelemetry()
    for _ in range(records):
        x, y = tel.run()
        img_arr = cam.run(x, y)
        t.put_record({'cam/image_array': img_arr, 'angle': x, 'throttle': y})

    return t
Beispiel #3
0
class TestMovingSquareTelemetry(unittest.TestCase):
    def setUp(self):
        self.tel = MovingSquareTelemetry()

    def test_run_types(self):
        x, y = self.tel.run()
        assert type(x) == int
        assert type(y) == int
Beispiel #4
0
def create_sample_tub(path, records=128):
    inputs = ['cam/image_array', 'user/angle', 'user/throttle']
    types = ['image_array', 'float', 'float']
    t = Tub(path, inputs=inputs, types=types)
    cam = SquareBoxCamera()
    tel = MovingSquareTelemetry()
    for _ in range(records):
        x, y = tel.run()
        img_arr = cam.run(x, y)
        t.put_record({
            'cam/image_array': img_arr,
            'user/angle': x,
            'user/throttle': y
        })

    global temp_tub_path
    temp_tub_path = t
    print("setting temp tub path to:", temp_tub_path)

    return t
Beispiel #5
0
def create_sample_record():
    cam = SquareBoxCamera()
    tel = MovingSquareTelemetry()
    x, y = tel.run()
    img_arr = cam.run(x, y)
    return {'cam/image_array': img_arr, 'angle': x, 'throttle':y}
Beispiel #6
0
 def setUp(self):
     self.tel = MovingSquareTelemetry()