Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ Watch a full successful flight of our Aerial ObjectNav Agent in action:
1.First, you should launch the AirSim environment server.

```bash
python airsim_plugin/AirVLNSimulatorServerTool.py --port=30000 --root_path= "your workspace path"
python airsim_plugin/AirVLNSimulatorServerTool.py --port=30000 --root_path= "path to TRAIN_ENVS or TEST_ENVS"
```

2.Then, you can execute the bash script to run the simulator
2.Then, you can execute the bash script to run the simulator. Make sure
the `dataset_path` and `eval_save_path` args in the scripts point to correct paths.

```bash
#AOA-F/V
Expand All @@ -98,6 +99,7 @@ Watch a full successful flight of our Aerial ObjectNav Agent in action:
#CLIP-H
bash scripts/eval_cliph.sh

# To compute metrics
bash scripts/metric.sh
```

Expand Down
12 changes: 9 additions & 3 deletions airsim_plugin/AirVLNSimulatorServerTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,12 @@ def _open_scenes(self, ip: str , scen_id_gpu_list: list):
if choose_env_exe_paths[index] is None:
p_s.append(None)
continue
elif not os.path.exists(choose_env_exe_paths[index]):
print(f"{choose_env_exe_paths[index]} not found ! failed to open scene.")
p_s.append(None)
continue
else:
subprocess_execute = "bash {} -RenderOffscreen -NoSound -NoVSync -GraphicsAdapter={} --settings={}".format(
subprocess_execute = "bash '{}' -RenderOffscreen -NoSound -NoVSync -GraphicsAdapter={} --settings='{}'".format(
choose_env_exe_paths[index],
gpu_id,
str(CWD_DIR / 'settings' / str(ports[index]) / 'settings.json'),
Expand Down Expand Up @@ -480,9 +484,11 @@ def reopen_scene_from_port(self, port):
scene_id, gpu_id = self.port_to_scene[port]
env_info = env_exec_path_dict.get(scene_id)
env_path = os.path.join(args.root_path, env_info['exec_path'], env_info['bash_name'] + '.sh')

if not os.path.exists(env_path):
print(f"{env_path} not found ! failed to reopen scene.")
return

subprocess_execute = "bash {} -RenderOffscreen -NoSound -NoVSync -GraphicsAdapter={} -settings={} ".format(
subprocess_execute = "bash '{}' -RenderOffscreen -NoSound -NoVSync -GraphicsAdapter={} -settings='{}'".format(
env_path,
gpu_id,
str(CWD_DIR / 'settings' / str(port) / 'settings.json'),
Expand Down
5 changes: 3 additions & 2 deletions scripts/eval_cliph.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
cd "$(dirname "$0")/.."
root_dir=.
workspace_dir=..
echo $PWD

CUDA_VISIBLE_DEVICES=0 python -u $root_dir/src/eval_cliph.py \
--maxActions 150 \
--eval_save_path $root_dir/CLIP_logs/scene \
--dataset_path your/dataset/path \
--eval_save_path $workspace_dir/CLIP_logs/DownTown \
--dataset_path $workspace_dir/DATASET/UAV-ON-data/valset/DownTown.json \
--is_fixed true\
--gpu_id 0 \
--batchSize 1 \
Expand Down
5 changes: 3 additions & 2 deletions scripts/eval_fixed.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
cd "$(dirname "$0")/.."
root_dir=.
workspace_dir=..
echo $PWD

CUDA_VISIBLE_DEVICES=0 python -u $root_dir/src/eval_2.py \
--maxActions 150 \
--eval_save_path $root_dir/logs/scene \
--dataset_path your/dataset/path \
--eval_save_path $workspace_dir/fixed_logs/DownTown \
--dataset_path $workspace_dir/DATASET/UAV-ON-data/valset/DownTown.json \
--is_fixed true\
--gpu_id 0 \
--batchSize 1 \
Expand Down
5 changes: 3 additions & 2 deletions scripts/eval_unfixed.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
cd "$(dirname "$0")/.."
root_dir=.
workspace_dir=..
echo $PWD

CUDA_VISIBLE_DEVICES=0 python -u $root_dir/src/eval_2.py \
--maxActions 150 \
--eval_save_path $root_dir/unfixed_logs/scene \
--dataset_path your/dataset/path \
--eval_save_path $workspace_dir/unfixed_logs/DownTown \
--dataset_path $workspace_dir/DATASET/UAV-ON-data/valset/DownTown.json \
--is_fixed false\
--gpu_id 0 \
--batchSize 1 \
Expand Down
3 changes: 2 additions & 1 deletion scripts/metric.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
cd "$(dirname "$0")/.."
root_dir=.
workspace_dir=..
echo $PWD

python -u $root_dir/utils/classify_metric.py \
--base_path $root_dir/logs
--base_root $workspace_dir/CLIP_logs
3 changes: 1 addition & 2 deletions src/env_uav.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import tqdm
from src.common.param import args
from utils.logger import logger
from airsim_plugin.airsim_settings import AirsimActions
sys.path.append(str(Path(str(os.getcwd())).resolve()))
from airsim_plugin.AirVLNSimulatorClientTool import AirVLNSimulatorClientTool
from utils.env_utils_uav import SimState, getNextPosition
Expand Down Expand Up @@ -417,4 +416,4 @@ def _update_distance_to_target(self):
distance = float(np.linalg.norm(curr - coords))

print(f'batch[{idx}/{len(self.batch)}]| distance: {round(distance, 2)}, position: {curr[0]}, {curr[1]}, {curr[2]}, target: {coords}')


13 changes: 13 additions & 0 deletions utils/classify_metric.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -233,17 +233,30 @@ def get_termination_type(task_folder):

if os.path.exists(success_dir):
all_success_dirs.append(success_dir)
else:
print(f"Did not find success directory '{success_dir}' for scene '{scene}'")
if os.path.exists(oracle_dir):
all_oracle_dirs.append(oracle_dir)
else:
print(f"Did not find oracle directory '{oracle_dir}' for scene '{scene}'")
if os.path.exists(fail_dir):
all_fail_dirs.append(fail_dir)
else:
print(f"Did not find fail directory '{fail_dir}' for scene '{scene}'")




# ===== Task Count Statistics =====
success_tasks = sum(count_task_folder(d) for d in all_success_dirs)
oracle_tasks = sum(count_task_folder(d) for d in all_oracle_dirs)
fail_tasks = sum(count_task_folder(d) for d in all_fail_dirs)
total_tasks = success_tasks + oracle_tasks + fail_tasks

if total_tasks == 0:
print(f"No tasks found. Make sure you have your log paths set up correctly.")
exit(1)

# ===== SR & OSR =====
sr = success_tasks / total_tasks if total_tasks > 0 else 0
osr = (oracle_tasks + success_tasks) / total_tasks if total_tasks > 0 else 0
Expand Down
4 changes: 2 additions & 2 deletions utils/env_utils_uav.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import copy

from src.common.param import args
from airsim_plugin.airsim_settings import AirsimActions, AirsimActionSettings
from airsim_plugin.airsim_settings import AirsimActionSettings
from utils.logger import logger


Expand Down Expand Up @@ -188,4 +188,4 @@ def getNextPosition(current_pose: airsim.Pose, action, step_size, is_fixed):
airsim.Vector3r(new_position[0], new_position[1], new_position[2]),
airsim.Quaternionr(x_val=new_orientation.x_val, y_val=new_orientation.y_val, z_val=new_orientation.z_val, w_val=new_orientation.w_val)
)
return (new_pose, fly_type)
return (new_pose, fly_type)