商业性质网站设计,上海网站建设服务是什么,全国最大型网站建设,黄冈建设信息网0.前置
机器人持续学习基准LIBERO系列1——基本介绍与安装测试机器人持续学习基准LIBERO系列2——路径与基准基本信息机器人持续学习基准LIBERO系列3——相机画面可视化及单步移动更新机器人持续学习基准LIBERO系列4——robosuite最基本demo
1.更改环境设置
LIBERO-master/l…0.前置
机器人持续学习基准LIBERO系列1——基本介绍与安装测试机器人持续学习基准LIBERO系列2——路径与基准基本信息机器人持续学习基准LIBERO系列3——相机画面可视化及单步移动更新机器人持续学习基准LIBERO系列4——robosuite最基本demo
1.更改环境设置
LIBERO-master/libero/libero/envs/env_wrapper.py第37行camera_depthsFalse改为True
2.获取归一化后的深度图
robosuite里面直接获取到的是三维的归一化到[0,1]区间的深度图其中第三个维度为通道数1
agentview_depth (obs[agentview_depth])
robot0_eye_in_hand_depth (obs[robot0_eye_in_hand_depth])3.调整显示深度图
要把第三个维度去掉再把值扩大到0-255化为整数才能显示(参考)
agentview_depth (agentview_depth.squeeze() * 255) .astype(np.uint8)
robot0_eye_in_hand_depth (robot0_eye_in_hand_depth.squeeze() * 255) .astype(np.uint8)显示
display(Image.fromarray(agentview_depth))
display(Image.fromarray(robot0_eye_in_hand_depth))
4.同时可视化彩色图和深度图
前置代码:机器人持续学习基准LIBERO系列1——基本介绍与安装测试, 机器人持续学习基准LIBERO系列2——路径与基准基本信息
env_args {bddl_file_name: os.path.join(os.path.join(get_libero_path(bddl_files), task.problem_folder, task.bddl_file)),camera_heights: 128,camera_widths: 128
}env OffScreenRenderEnv(**env_args)
#设置种子
env.seed(0)
#环境重置
env.reset()
#初始化
env.set_init_state(init_states[0])import numpy as np
#运动机械臂更新环境
obs, _, _, _ env.step([0.] * 7)
#获取手外相机视角图片
agentview_image (obs[agentview_image])
robot0_eye_in_hand_image (obs[robot0_eye_in_hand_image])
agentview_depth (obs[agentview_depth])
robot0_eye_in_hand_depth (obs[robot0_eye_in_hand_depth])
#深度图第三个维度是1还是归一化后的所以要把第三个维度去掉再把值扩大到0-255化为整数才能显示
#https://www.coder.work/article/7752795
agentview_depth (agentview_depth.squeeze() * 255) .astype(np.uint8)
robot0_eye_in_hand_depth (robot0_eye_in_hand_depth.squeeze() * 255) .astype(np.uint8)
display(Image.fromarray(agentview_image))
display(Image.fromarray(agentview_depth))
display(Image.fromarray(robot0_eye_in_hand_image))
display(Image.fromarray(robot0_eye_in_hand_depth)) 关闭环境
env.close()