Closed HLinChen closed 1 year ago
Yes, for the manually generated path I just implement very simple keybindings in python to control the agent within the environment. Here's a code snippet to reproduce:
import cv2
import habitat_sim
class ExplorationPath():
def __init__(self,
sim: habitat_sim.Simulator):
self.sim=sim
def create_manually():
positions = []
rotations = []
actions = []
while True:
observations = self.sim.get_sensor_observations()
rgb = observations["color_sensor"]
rgb = cv2.cvtColor(rgb, cv2.COLOR_RGB2BGR)
cv2.imshow("window", rgb)
key = cv2.waitKey(0)
if key == 27 or key == ord('q'): #esc
self.positions = positions
self.rotations = rotations
self.actions = actions
break
elif key == ord('w'):
self.sim.step('move_forward')
action = 0
elif key == ord('a'):
self.sim.step('turn_left')
action = 1
elif key == ord('d'):
self.sim.step('turn_right')
action = 2
else:
print("Unknown key:", key)
continue
agent_state = self.sim.agents[0].state
position = agent_state.position
rotation = agent_state.rotation
positions.append(position)
rotations.append(rotation)
actions.append(action)
Thanks for your help!
Hey @vincentcartillier,
I have read #7, the tutorial of Habitat and known how to generate path. But I'm still confused about recording manually.
Do you write function/script to control the agent and record path?
If possible, can you share the script so that I can learn from it and reuse it to generate path from other datasets?
Looking forward to your reply. Thanks.