Skip to content

Commit

Permalink
updated data provider to use all collected data, changed sim ranges a…
Browse files Browse the repository at this point in the history
…nd updated hyperparams for model learning
  • Loading branch information
sukhijab committed Dec 4, 2023
1 parent eecddcd commit 68e105c
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 47 deletions.
4 changes: 3 additions & 1 deletion experiments/data_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@ def get_rccar_recorded_data_new(encode_angle: bool = True, skip_first_n_points:
recordings_dir = [os.path.join(DATA_DIR, 'recordings_rc_car_v1')]
elif car_id == 2:
num_train_traj = 12
recordings_dir = [os.path.join(DATA_DIR, 'recordings_rc_car_v4')]
recordings_dir = [os.path.join(DATA_DIR, 'recordings_rc_car_v2'),
os.path.join(DATA_DIR, 'recordings_rc_car_v3'),
os.path.join(DATA_DIR, 'recordings_rc_car_v4')]
else:
raise ValueError(f"Unknown car id {car_id}")
files = [sorted(glob.glob(rd + '/*.pickle')) for rd in recordings_dir]
Expand Down
2 changes: 1 addition & 1 deletion experiments/offline_rl_from_recorded_data/exp.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def experiment(horizon_len: int,
if high_fidelity:
outputscales_racecar = [0.008, 0.008, 0.009, 0.009, 0.05, 0.05, 0.20]
else:
outputscales_racecar = [0.008, 0.008, 0.01, 0.01, 0.08, 0.08, 0.5]
outputscales_racecar = [0.008, 0.008, 0.01, 0.01, 0.1, 0.1, 0.5]
sim = AdditiveSim(base_sims=[sim,
GaussianProcessSim(sim.input_size, sim.output_size,
output_scale=outputscales_racecar,
Expand Down
46 changes: 32 additions & 14 deletions experiments/offline_rl_from_recorded_data/launcher.py
Original file line number Diff line number Diff line change
@@ -1,79 +1,97 @@
import exp
from experiments.util import generate_run_commands, generate_base_command, dict_permutations

PROJECT_NAME = 'OfflineRLRunsSimConsecutive'
PROJECT_NAME = 'OfflineRLRunsGreyBoxHWFinal'

_applicable_configs = {
'horizon_len': [200],
'seed': list(range(5)),
'project_name': [PROJECT_NAME],
'sac_num_env_steps': [2_000_000],
'sac_num_env_steps': [1_000_000],
'num_epochs': [50],
'max_train_steps': [100_000],
'min_train_steps': [40_000], # for HW 30_000 worked the best.
'min_train_steps': [40_000],
'learnable_likelihood_std': ['yes'],
'include_aleatoric_noise': [1],
'best_bnn_model': [1],
'best_policy': [1],
'margin_factor': [20.0],
'ctrl_cost_weight': [0.005],
'ctrl_diff_weight': [0.0],
'num_offline_collected_transitions': [20, 50, 100, 200, 400, 800, 1600, 2000, 2500, 10_000, 20_000],
'num_offline_collected_transitions': [20, 50, 100, 200, 400, 800, 1600, 2000, 2500, 5_000, 10_000, 20_000],
'test_data_ratio': [0.0],
'eval_on_all_offline_data': [1],
'eval_only_on_init_states': [1],
'share_of_x0s_in_sac_buffer': [0.5],
'bnn_batch_size': [32], # for HW 8 worked the best
'likelihood_exponent': [0.5],
'train_sac_only_from_init_states': [0],
'data_from_simulation': [1],
'data_from_simulation': [0],
'num_frame_stack': [3],
'bandwidth_svgd': [0.2],
'length_scale_aditive_sim_gp': [10.0],
'length_scale_aditive_sim_gp': [5.0],
'input_from_recorded_data': [1],
'obtain_consecutive_data': [0, 1],
'obtain_consecutive_data': [1],
'lr': [3e-4],
}

_applicable_configs_no_sim_prior = {'use_sim_prior': [0],
'use_grey_box': [0],
'use_sim_model': [0],
'high_fidelity': [0],
'predict_difference': [1],
'num_measurement_points': [8]
} | _applicable_configs
_applicable_configs_high_fidelity = {'use_sim_prior': [1],
'use_grey_box': [0],
'use_sim_model': [0],
'high_fidelity': [1],
'predict_difference': [1],
'num_measurement_points': [8]} | _applicable_configs
_applicable_configs_low_fidelity = {'use_sim_prior': [1],
'use_grey_box': [0],
'use_sim_model': [0],
'high_fidelity': [0],
'predict_difference': [1],
'num_measurement_points': [8]} | _applicable_configs

_applicable_configs_grey_box_low_fidelity = {'use_sim_prior': [0],
'high_fidelity': [0],
'use_grey_box': [1],
'predict_difference': [0],
'use_sim_model': [0],
'predict_difference': [1],
'num_measurement_points': [8]} | _applicable_configs

_applicable_configs_grey_box_high_fidelity = {'use_sim_prior': [0],
'high_fidelity': [1],
'use_grey_box': [1],
'predict_difference': [0],
'use_sim_model': [0],
'predict_difference': [1],
'num_measurement_points': [8]} | _applicable_configs

_applicable_configs_sim_model_high_fidelity = {'use_sim_prior': [0],
'high_fidelity': [1],
'use_grey_box': [0],
'use_sim_model': [1],
'predict_difference': [1],
'num_measurement_points': [8]} | _applicable_configs

_applicable_configs_sim_model_low_fidelity = {'use_sim_prior': [0],
'high_fidelity': [0],
'use_grey_box': [0],
'use_sim_model': [1],
'predict_difference': [1],
'num_measurement_points': [8]} | _applicable_configs

# all_flags_combinations = dict_permutations(_applicable_configs_no_sim_prior) + dict_permutations(
# _applicable_configs_high_fidelity) + dict_permutations(_applicable_configs_low_fidelity) + dict_permutations(
# _applicable_configs_grey_box)

all_flags_combinations = dict_permutations(_applicable_configs_no_sim_prior) + dict_permutations(
_applicable_configs_high_fidelity) + dict_permutations(_applicable_configs_low_fidelity) # + dict_permutations(

# _applicable_configs_grey_box)
_applicable_configs_high_fidelity) + dict_permutations(_applicable_configs_low_fidelity) + \
dict_permutations(_applicable_configs_grey_box_high_fidelity) + \
dict_permutations(_applicable_configs_sim_model_high_fidelity)

all_flags_combinations += dict_permutations(_applicable_configs_grey_box_low_fidelity) + dict_permutations(
_applicable_configs_grey_box_high_fidelity)


def main():
Expand Down
2 changes: 1 addition & 1 deletion experiments/online_rl_hardware/online_rl_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class MainConfig(NamedTuple):
likelihood_exponent: float = 0.5
data_batch_size: int = 32
bandwidth_svgd: float = 0.2
length_scale_aditive_sim_gp: float = 10.0
length_scale_aditive_sim_gp: float = 5.0
num_f_samples: int = 512
num_measurement_points: int = 16
initial_state_fraction: float = 0.5
Expand Down
60 changes: 30 additions & 30 deletions sim_transfer/sims/car_sim_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,35 +96,35 @@
'm': 1.65,
'l_f': 0.13,
'l_r': 0.17,
'angle_offset': -0.05,
'angle_offset': 0.00,
'b_f': 2.58,
'b_r': 5.0,
'blend_ratio_lb': 0.01,
'blend_ratio_ub': 0.01,
'c_d': 0.0,
'c_f': 1.2,
'c_m_1': 7.0,
'c_m_2': 1.4,
'c_m_1': 8.0,
'c_m_2': 1.5,
'c_r': 1.27,
'd_f': 0.02,
'd_r': 0.017,
'i_com': 0.01,
'steering_limit': 0.25
'steering_limit': 0.3
}

BOUNDS_PARAMS_BICYCLE_CAR2: Dict = {
'use_blend': (0.0, 0.0),
'm': (1.6, 1.7),
'l_f': (0.11, 0.15),
'l_r': (0.15, 0.19),
'angle_offset': (-0.15, 0.0),
'b_f': (2.58, 2.58),
'angle_offset': (-0.15, 0.15),
'b_f': (2.4, 2.6),
'b_r': (2.0, 8.0),
'blend_ratio_lb': (0.4, 0.4),
'blend_ratio_ub': (0.5, 0.5),
'c_d': (0.01, 0.01),
'c_f': (1.2, 1.2),
'c_m_1': (6., 8.),
'c_m_1': (6., 10.),
'c_m_2': (1.0, 1.8),
'c_r': (1.27, 1.27),
'd_f': (0.02, 0.02),
Expand All @@ -138,39 +138,39 @@
'm': 1.65,
'l_f': 0.13,
'l_r': 0.17,
'angle_offset': -0.035,
'b_f': 3.0,
'b_r': 4.5,
'blend_ratio_lb': 0.01,
'blend_ratio_ub': 0.025,
'angle_offset': 0.0,
'b_f': 2.75,
'b_r': 5.0,
'blend_ratio_lb': 0.001,
'blend_ratio_ub': 0.017,
'c_d': 0.0,
'c_f': 1.68,
'c_m_1': 7.3,
'c_m_2': 1.11,
'c_r': 1.6,
'd_f': 0.36,
'd_r': 0.34,
'i_com': 0.08,
'steering_limit': 0.58,
'c_f': 1.45,
'c_m_1': 8.2,
'c_m_2': 1.25,
'c_r': 1.3,
'd_f': 0.4,
'd_r': 0.3,
'i_com': 0.06,
'steering_limit': 0.6,
}

BOUNDS_PARAMS_BLEND_CAR2 = {
'use_blend': (1.0, 1.0),
'm': (1.6, 1.7),
'l_f': (0.125, 0.135),
'l_r': (0.165, 0.175),
'angle_offset': (-0.05, 0.05),
'angle_offset': (-0.15, 0.15),
'b_f': (2.0, 4.0),
'b_r': (3.0, 8.0),
'blend_ratio_lb': (0.01, 0.1),
'blend_ratio_ub': (0.001, 0.2),
'b_r': (3.0, 10.0),
'blend_ratio_lb': (0.0001, 0.1),
'blend_ratio_ub': (0.0001, 0.2),
'c_d': (0.0, 0.0),
'c_f': (1.5, 2.0),
'c_m_1': (6.5, 9.0),
'c_m_2': (1.0, 1.4),
'c_r': (1.0, 2.0),
'c_f': (1.1, 2.0),
'c_m_1': (6.5, 10.0),
'c_m_2': (1.0, 1.5),
'c_r': (0.4, 2.0),
'd_f': (0.25, 0.6),
'd_r': (0.15, 0.45),
'i_com': (0.06, 0.18),
'steering_limit': (0.5, 0.65),
'i_com': (0.03, 0.18),
'steering_limit': (0.4, 0.75),
}

0 comments on commit 68e105c

Please sign in to comment.