remove preprocess base_action calibration, add postprocess option in eval_bc()
这个提交包含在:
@ -12,7 +12,7 @@ from constants import DT
|
|||||||
from constants import PUPPET_GRIPPER_JOINT_OPEN
|
from constants import PUPPET_GRIPPER_JOINT_OPEN
|
||||||
from utils import load_data # data functions
|
from utils import load_data # data functions
|
||||||
from utils import sample_box_pose, sample_insertion_pose # robot functions
|
from utils import sample_box_pose, sample_insertion_pose # robot functions
|
||||||
from utils import compute_dict_mean, set_seed, detach_dict # helper functions
|
from utils import compute_dict_mean, set_seed, detach_dict, calibrate_linear_vel # helper functions
|
||||||
from policy import ACTPolicy, CNNMLPPolicy
|
from policy import ACTPolicy, CNNMLPPolicy
|
||||||
from visualize_episodes import save_videos
|
from visualize_episodes import save_videos
|
||||||
|
|
||||||
@ -295,6 +295,7 @@ def eval_bc(config, ckpt_name, save_episode=True):
|
|||||||
action = post_process(raw_action)
|
action = post_process(raw_action)
|
||||||
target_qpos = action[:-2]
|
target_qpos = action[:-2]
|
||||||
base_action = action[-2:]
|
base_action = action[-2:]
|
||||||
|
base_action = calibrate_linear_vel(base_action, c=0)
|
||||||
|
|
||||||
### step the environment
|
### step the environment
|
||||||
ts = env.step(target_qpos, base_action)
|
ts = env.step(target_qpos, base_action)
|
||||||
|
|||||||
12
utils.py
12
utils.py
@ -139,11 +139,13 @@ def load_data(dataset_dir, num_episodes, camera_names, batch_size_train, batch_s
|
|||||||
|
|
||||||
return train_dataloader, val_dataloader, norm_stats, train_dataset.is_sim
|
return train_dataloader, val_dataloader, norm_stats, train_dataset.is_sim
|
||||||
|
|
||||||
def calibrate_linear_vel(base_action):
|
def calibrate_linear_vel(base_action, c=None):
|
||||||
|
if c is None:
|
||||||
c = 0.19
|
c = 0.19
|
||||||
v = base_action[:, 0]
|
v = base_action[..., 0]
|
||||||
w = base_action[:, 1]
|
w = base_action[..., 1]
|
||||||
base_action[:, 0] = v - c * w
|
base_action[..., 0] = v - c * w
|
||||||
|
print(f'c: {c}, v: {v}, w: {w}')
|
||||||
return base_action
|
return base_action
|
||||||
|
|
||||||
def smooth_base_action(base_action):
|
def smooth_base_action(base_action):
|
||||||
@ -152,7 +154,7 @@ def smooth_base_action(base_action):
|
|||||||
], axis=-1, dtype=np.float32)
|
], axis=-1, dtype=np.float32)
|
||||||
|
|
||||||
def preprocess_base_action(base_action):
|
def preprocess_base_action(base_action):
|
||||||
base_action = calibrate_linear_vel(base_action)
|
# base_action = calibrate_linear_vel(base_action)
|
||||||
base_action = smooth_base_action(base_action)
|
base_action = smooth_base_action(base_action)
|
||||||
|
|
||||||
return base_action
|
return base_action
|
||||||
|
|||||||
在新工单中引用
屏蔽一个用户