allenai / allenai/Holodeck

unable to move agent

オープン
#87 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
570
フォーク
66
PR マージ指標
30日以内にマージされた PR はありません

説明

Hello, I am trying to get depth frame using `controller.last_event.depth_frame` and this needs me to first move agent to proper position and rotate the agent. However, I used the api `teleport` but it did not work, the agent stay in the original position. Btw, when I modify the scene json file, more specifically, modify 'agentposes.default.position', the agent successfully changed the position. I wonder what's happening here. Thanks! My codes are as follows:

args = parser.parse_args()

scene = compress_json.load(args.scene_path)
scene["objects"] = scene["floor_objects"] + scene["wall_objects"] + scene["small_objects"]

os.makedirs(args.save_dir, exist_ok=True)

controller = Controller(
commit_id=THOR_COMMIT_ID,
agentMode="default",
makeAgentsVisible=False,
visibilityDistance=2,
scene=scene,
renderDepthImage=True,
width=int(args.width),
height=int(args.height),
fieldOfView=90,
action_hook_runner=ProceduralAssetHookRunner(
asset_directory=args.objaverse_asset_dir,
asset_symlink=True,
verbose=True,
),
)

wall_height = max([point["y"] for point in scene["walls"][0]["polygon"]])

room = scene["rooms"][0]
# TODO: modify camera height
camera_height = wall_height - 0.2
print("camera height: ", camera_height)

room_vertices = [[point["x"], point["z"]] for point in room["floorPolygon"]]

room_center = np.mean(room_vertices, axis=0)
floor_center = np.array([room_center[0], 0, room_center[1]])
camera_center = np.array([room_center[0], camera_height, room_center[1]])
corners = np.array(
[[point["x"], point["y"], point["z"]] for point in room["floorPolygon"]]
)
farest_corner = corners[
np.argmax(np.linalg.norm(corners - camera_center, axis=1))
]

vector_1 = floor_center - camera_center
vector_2 = farest_corner - camera_center
x_angle = (
90
- np.arccos(
np.dot(vector_1, vector_2)
/ (np.linalg.norm(vector_1) * np.linalg.norm(vector_2))
)
* 180
/ np.pi
)

print(camera_center)

event = controller.step(
action="Teleport",
position=dict(
x=camera_center[0], y=camera_center[1], z=camera_center[2]
),
rotation=dict(x=0, y=0, z=0),
horizon=0,
standing=True
)

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。