GibsonEnv
GibsonEnv copied to clipboard
Extract RGB-D images directly as robot navigates?
Hello,
Is there a provision to extract and store RGBD images (and corresponding pose) at desirable locations as the robot navigates through the environment?
Thanks.
Yes, you can use the following code snippet to do this (HuskyNavigateEnv
for example):
from gibson.envs.husky_env import HuskyNavigateEnv
from gibson.utils.play import play
import os
config_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'configs', 'play', 'play_husky_camera.yaml')
print(config_file)
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--config', type=str, default=config_file)
parser.add_argument('--gpu', type=int, default=0)
args = parser.parse_args()
env = HuskyNavigateEnv(config=args.config, gpu_idx = args.gpu)
env.reset()
for i in range(100): # number of steps
# generate your action somehow, either by using keyboard control, or from some kind of policy
obs, rew, env_done, info = env.step(action)
pose = [env.robot.get_position(), env.robot.get_orientation()]
## pose contains position and orientation of the robot, and RGBD information is stored in obs
@fxia22 Thank you for your reply. I could extract the images.
Also, I want to know the camera parameters (namely f and cx,cy) when launching Turtlebot (play_turtlebot_camera.py
). Is the default camera Kinect or ASUS Xtion PRO? In this URDF file, some camera params are mentioned but it's not clear which one is default camera (there's no such parameter in YAML file). Please let me know the f and cx,cy values when launching play_turtlebot_camera.py
in default mode.
Thanks.
@fxia22 Thank you for your reply. I could extract the images.
Also, I want to know the camera parameters (namely f and cx,cy) when launching Turtlebot (
play_turtlebot_camera.py
). Is the default camera Kinect or ASUS Xtion PRO? In this URDF file, some camera params are mentioned but it's not clear which one is default camera (there's no such parameter in YAML file). Please let me know the f and cx,cy values when launchingplay_turtlebot_camera.py
in default mode.Thanks.
Hi Shubodh, Did you get that? The camera intrinsic matrix