# Path: lib/replay_memory.py
# class ReplayMemory(object):
#     def __init__(self, filepath, max_size, max_size_tolerance):
#     def create_instance_supervised(val=False):
#     def create_instance_reinforced(val=False):
#     def create_instance_by_config(cfg_name):
#     def add_states(self, states, shrink=True):
#     def add_state(self, state, commit=True, shrink=True):
#     def update_state(self, idx, state, commit=True):
#     def get_state_by_id(self, idx):
#     def get_states_by_ids(self, ids):
#     def get_random_states(self, count):
#     def get_states_range(self, pos_start, length):
#     def get_random_state_chain(self, length, from_pos_range=None):
#     def get_random_state_chain_timediff(self, length, max_timediff_ms=500, depth=50):
#     def update_caches(self):
#     def is_above_tolerance(self):
#     def shrink_to_max_size(self, force=False):
#     def commit(self):
#     def close(self):
#     def connect(self):
# 
# Path: lib/steering_wheel.py
# STEERING_WHEEL_TRACKER_CNN_FP = os.path.join(Config.MAIN_DIR, "train_steering_wheel/steering_wheel.tar")
# class SteeringWheelTrackerCNN(object):
# class SteeringWheelTracker(object):
#     def __init__(self, default_angle=0):
#     def reset(self):
#     def estimate_angle(self, image):
#     def __init__(self, default_angle=0):
#     def reset(self):
#     def estimate_angle(self, image, visualize=False):
# def get_angle(v1, v2):
# def estimate_by_last_match(image, last_match=None, visualize=False):
# def estimate(image, expected_position=None, search_rect=None, search_rect_border=0.05, expected_pixels=(10, 200), optimal_size=90, visualize=False):


import sys
import os
import numpy as np
import time
import sqlite3
import cv2
import imgaug as ia
from lib import replay_memory
from lib import steering_wheel as swlib
from scipy import misc
from __future__ import division, print_function

sys.path.append(os.path.join(os.path.dirname(__file__), '..'))



if sys.version_info[0] == 3:
    raw_input = input

try:
    xrange
except NameError:
    xrange = range

MAX_TIMEDIFF_MS = 500
MAX_PIXELDIFF = 800

def main():
    #cv2.namedWindow("overview", cv2.WINDOW_NORMAL)

    key = raw_input("This will add the approximated steering wheel location to all states in the database. Press 'y' to continue.")
    assert key == "y"

    tracker_classical = swlib.SteeringWheelTracker()
    tracker_cnn = swlib.SteeringWheelTrackerCNN()
    memories = [
        (replay_memory.ReplayMemory.create_instance_reinforced(val=False), 10**6),
        (replay_memory.ReplayMemory.create_instance_reinforced(val=True), 10**6),

# Path: lib/replay_memory.py
# class ReplayMemory(object):
#     def __init__(self, filepath, max_size, max_size_tolerance):
#     def create_instance_supervised(val=False):
#     def create_instance_reinforced(val=False):
#     def create_instance_by_config(cfg_name):
#     def add_states(self, states, shrink=True):
#     def add_state(self, state, commit=True, shrink=True):
#     def update_state(self, idx, state, commit=True):
#     def get_state_by_id(self, idx):
#     def get_states_by_ids(self, ids):
#     def get_random_states(self, count):
#     def get_states_range(self, pos_start, length):
#     def get_random_state_chain(self, length, from_pos_range=None):
#     def get_random_state_chain_timediff(self, length, max_timediff_ms=500, depth=50):
#     def update_caches(self):
#     def is_above_tolerance(self):
#     def shrink_to_max_size(self, force=False):
#     def commit(self):
#     def close(self):
#     def connect(self):
# 
# Path: lib/steering_wheel.py
# STEERING_WHEEL_TRACKER_CNN_FP = os.path.join(Config.MAIN_DIR, "train_steering_wheel/steering_wheel.tar")
# class SteeringWheelTrackerCNN(object):
# class SteeringWheelTracker(object):
#     def __init__(self, default_angle=0):
#     def reset(self):
#     def estimate_angle(self, image):
#     def __init__(self, default_angle=0):
#     def reset(self):
#     def estimate_angle(self, image, visualize=False):
# def get_angle(v1, v2):
# def estimate_by_last_match(image, last_match=None, visualize=False):
# def estimate(image, expected_position=None, search_rect=None, search_rect_border=0.05, expected_pixels=(10, 200), optimal_size=90, visualize=False):


# Path: scripts/add_steering_wheel_to_replay_memory.py
import sys
import os
import numpy as np
import time
import sqlite3
import cv2
import imgaug as ia
from lib import replay_memory
from lib import steering_wheel as swlib
from scipy import misc

from __future__ import division, print_function

sys.path.append(os.path.join(os.path.dirname(__file__), '..'))



if sys.version_info[0] == 3:
    raw_input = input

try:
    xrange
except NameError:
    xrange = range

MAX_TIMEDIFF_MS = 500
MAX_PIXELDIFF = 800

def main():
    #cv2.namedWindow("overview", cv2.WINDOW_NORMAL)

    key = raw_input("This will add the approximated steering wheel location to all states in the database. Press 'y' to continue.")
    assert key == "y"

    tracker_classical = swlib.SteeringWheelTracker()
    tracker_cnn = swlib.SteeringWheelTrackerCNN()
    memories = [
        (replay_memory.ReplayMemory.create_instance_reinforced(val=False), 10**6),
        (replay_memory.ReplayMemory.create_instance_reinforced(val=True), 10**6),

        (replay_memory.ReplayMemory.create_instance_supervised(val=False), 60*10),