Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
89b02c3
open and close skill
wmcclinton Feb 25, 2025
20a4661
minor change to check that topaz works on simple env in LIS room
NishanthJKumar Mar 12, 2025
ae5021c
fix time sync
NishanthJKumar Mar 12, 2025
318027b
good progress for the day; close to a useful domain with spot skills
NishanthJKumar Mar 12, 2025
8ee7a0e
simple demo working!
NishanthJKumar Mar 13, 2025
7493a25
fix chex
NishanthJKumar Mar 17, 2025
b714829
task creation works!
NishanthJKumar Mar 17, 2025
90ef740
making progress!
NishanthJKumar Mar 18, 2025
8d674b5
started env
wmcclinton Mar 18, 2025
a56da3e
yay! initial demo working!
NishanthJKumar Mar 18, 2025
bf92c26
progress
NishanthJKumar Mar 20, 2025
e51c5c4
saving demonstrations done!
NishanthJKumar Mar 21, 2025
2f352db
progress!
NishanthJKumar Mar 25, 2025
e6fb77f
progress! need to fix trajectories though...
NishanthJKumar Mar 27, 2025
6665785
works!
NishanthJKumar Mar 27, 2025
e56ed59
formatting
NishanthJKumar Mar 27, 2025
6ccca1e
things work finally!
NishanthJKumar Apr 1, 2025
3492ccf
slow but steady progress
NishanthJKumar Apr 2, 2025
cbe013e
get a basic thing working
NishanthJKumar Apr 3, 2025
bb7a8b8
making more progress - almost have everything necessary for table wip…
NishanthJKumar Apr 5, 2025
ff61612
cleanup task WORKING! YASSS!
NishanthJKumar Apr 7, 2025
d066e9d
minor change
NishanthJKumar Apr 7, 2025
2cd2a03
wiping skill implemented!
NishanthJKumar Apr 7, 2025
8e9461f
minor fix to dumping
NishanthJKumar Apr 8, 2025
9521c76
ready to try move and pick option on the robot!
NishanthJKumar Apr 9, 2025
b8e7ffb
works well for picking and placing - done with those skills!
NishanthJKumar Apr 11, 2025
022c81e
dumping accomplished! should be ready for full task now! (worth testi…
NishanthJKumar Apr 12, 2025
498f224
yessss - got vila-fewshot working!
NishanthJKumar Apr 14, 2025
9186027
yas! 1/5 demo testing tasks got-em!
NishanthJKumar Apr 15, 2025
5783307
minor
NishanthJKumar Apr 16, 2025
023cf37
got pick-place task working with learned ops
NishanthJKumar Apr 17, 2025
b009f0c
done with getting data on robot!
NishanthJKumar Apr 17, 2025
3f436b3
added thesis tasks
wmcclinton Feb 19, 2026
6c8ed89
Merge commit 'b009f0cf9be7229b9d70a845a7279bec0fcd5d43' into wmcclint…
wmcclinton Feb 19, 2026
80e33ac
merged VLM Predicates
wmcclinton Feb 19, 2026
547591b
added pix2pred for thesis envs
wmcclinton Mar 9, 2026
cbf79e3
slight fix
wmcclinton Mar 13, 2026
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
Binary file added hand_image_failed_detection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions predicators/approaches/bilevel_planning_approach.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ def _solve(self, task: Task, timeout: int) -> Callable[[State], Action]:
for act in nsrt_plan:
logging.debug(act)

for act in nsrt_plan:
print(act)
import ipdb
ipdb.set_trace()

# Run full bilevel planning.
else:
option_plan, nsrt_plan, metrics = self._run_sesame_plan(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ apple_coring__vlm_demos__456__2
| options.txt

### Running predicate invention using these image demos
To use the Gemini VLM, you need to set the `GOOGLE_API_KEY` environment variable in your terminal. You can make/get an API key [here](https://aistudio.google.com/app/apikey).
To use the Gemini VLM, you need to set the `GOOGLE_API_KEY` environment variable in your terminal. You can make/get an API key [here](https://aistudio.google.com/app/apikey). To use an Open AI VLM, the `OPENAI_API_KEY` variable needs to be set.

Example command: `python predicators/main.py --env apple_coring --seed 456 --approach grammar_search_invention --excluded_predicates all --num_train_tasks 1 --num_test_tasks 0 --offline_data_method saved_vlm_img_demos_folder --vlm_trajs_folder_name apple_coring__vlm_demos__456__1`

Expand Down
5 changes: 2 additions & 3 deletions predicators/approaches/grammar_search_invention_approach.py
Original file line number Diff line number Diff line change
Expand Up @@ -1021,9 +1021,8 @@ def _parse_atom_dataset_from_annotated_dataset(
for ground_atom in ground_atom_state:
assert isinstance(ground_atom, GroundAtom)
if ground_atom.predicate not in candidates:
# The cost of this predicate is simply its arity.
candidates[ground_atom.predicate] = float(
len(ground_atom.objects))
candidates[ground_atom.predicate] = float(
len(ground_atom.objects))
logging.debug(f"All candidate predicates: {candidates.keys()}")
return (atom_dataset, candidates)

Expand Down
36 changes: 19 additions & 17 deletions predicators/approaches/spot_wrapper_approach.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from predicators import utils
from predicators.approaches import BaseApproach, BaseApproachWrapper
from predicators.envs.spot_env import get_detection_id_for_object, get_robot
from predicators.settings import CFG
from predicators.spot_utils.skills.spot_find_objects import find_objects
from predicators.spot_utils.skills.spot_stow_arm import stow_arm
from predicators.spot_utils.utils import get_allowed_map_regions
Expand Down Expand Up @@ -66,23 +67,24 @@ def _policy(state: State) -> Action:
state.get(obj, "lost") > 0.5:
lost_objects.add(obj)
# Need to find the objects.
if lost_objects:
logging.info(f"[Spot Wrapper] Lost objects: {lost_objects}")
# Reset the base approach policy.
base_approach_policy = None
need_stow = True
self._base_approach_has_control = False
robot, localizer, lease_client = get_robot()
lost_object_ids = {
get_detection_id_for_object(o)
for o in lost_objects
}
allowed_regions = self._allowed_regions
extra_info = SpotActionExtraInfo(
"find-objects", [], find_objects,
(state, self._rng, robot, localizer, lease_client,
lost_object_ids, allowed_regions), None, tuple())
return utils.create_spot_env_action(extra_info)
# NOTE: HACK: commenting out for now - just for some robot testing!
# if lost_objects and len(CFG.spot_vlm_teleop_demo_folderpath) == 0:
# logging.info(f"[Spot Wrapper] Lost objects: {lost_objects}")
# # Reset the base approach policy.
# base_approach_policy = None
# need_stow = True
# self._base_approach_has_control = False
# robot, localizer, lease_client = get_robot()
# lost_object_ids = {
# get_detection_id_for_object(o)
# for o in lost_objects
# }
# allowed_regions = self._allowed_regions
# extra_info = SpotActionExtraInfo(
# "find-objects", [], find_objects,
# (state, self._rng, robot, localizer, lease_client,
# lost_object_ids, allowed_regions), None, tuple())
# return utils.create_spot_env_action(extra_info)
# Found the objects. Stow the arm before replanning.
if need_stow:
logging.info("[Spot Wrapper] Lost objects found, stowing.")
Expand Down
62 changes: 54 additions & 8 deletions predicators/approaches/vlm_open_loop_approach.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,39 @@ def get_name(cls) -> str:
def is_learning_based(self) -> bool:
return True

def get_goals_for_specific_datasets(self, train_task_idx: int) -> str:
"""HACK to get the goals for specific datasets.

Used for spot envs because the invention env is different from
the actual execution env.
"""
if CFG.vlm_trajs_folder_name == "spot_vlm_table_wiping_execution_env__vlm_demos__3__8":
if train_task_idx in [0, 2, 3]:
return "TableWiped(child_play_table:table)"
elif train_task_idx in [1, 4]:
return "VLMIn(apple:movable, seethru_plastic_dustbin:movable), TableWiped(child_play_table:table)"
elif train_task_idx == 5:
return "VLMIn(green_block: movable, cardboard_recycling_bin:movable)"
elif train_task_idx == 6:
return "VLMIn(orange_block: movable, cardboard_recycling_bin:movable)"
elif train_task_idx == 7:
return "VLMIn(spam_tin:movable, cardboard_recycling_bin:movable)"
else:
raise NotImplementedError(
"Shouldn't be getting here! i = {}".format(i))
elif CFG.vlm_trajs_folder_name == "spot_vlm_table_wiping_human_execution_env__vlm_demos__3__6":
if train_task_idx in [0, 1, 2]:
return "TableWiped(child_play_table:table)"
elif train_task_idx in [3]:
return "VLMIn(apple:movable, seethru_plastic_dustbin:movable), TableWiped(child_play_table:table)"
elif train_task_idx == 4:
return "VLMIn(green_block: movable, cardboard_recycling_bin:movable)"
elif train_task_idx == 5:
return "VLMIn(spam_tin:movable, cardboard_recycling_bin:movable)"
else:
raise NotImplementedError(
"Shouldn't be getting here! i = {}".format(i))

def learn_from_offline_dataset(self, dataset: Dataset) -> None:
"""Adds the images and plans from the training dataset to the base
prompt for use at test time!"""
Expand All @@ -77,7 +110,7 @@ def _append_to_prompt_state_imgs_list(state: State) -> None:
for img_num, img in enumerate(state.simulator_state["images"]):
pil_img = PIL.Image.fromarray(img) # type: ignore
width, height = pil_img.size
font_size = 15
font_size = 6
text = f"Demonstration {traj_num}, " + \
f"State {state_num}, Image {img_num}"
draw = ImageDraw.Draw(pil_img)
Expand Down Expand Up @@ -119,9 +152,16 @@ def _append_to_prompt_state_imgs_list(state: State) -> None:
segment_traj, ll_traj = seg_traj
if not ll_traj.is_demo:
continue
traj_goal = self._train_tasks[ll_traj.train_task_idx].goal

# Get the goal string depending on the env.
if "spot" not in CFG.env:
traj_goal = self._train_tasks[ll_traj.train_task_idx].goal
traj_goal_str = str(sorted(traj_goal))
else:
traj_goal_str = self.get_goals_for_specific_datasets(traj_num)

self._prompt_demos_str += f"Demonstration {traj_num}, " + \
f"Goal: {str(sorted(traj_goal))}\n"
f"Goal: {traj_goal_str}\n"
assert len(segment_traj) > 0
for state_num, seg in enumerate(segment_traj):
state = seg.states[0]
Expand Down Expand Up @@ -162,14 +202,20 @@ def _query_vlm_for_option_plan(self, task: Task) -> Sequence[_Option]:
assert isinstance(init_state.simulator_state["images"], List)
curr_options = sorted(self._initial_options)
imgs = init_state.simulator_state["images"]
pil_imgs = [
PIL.Image.fromarray(img_arr) # type: ignore
for img_arr in imgs
]
if isinstance(imgs[0], np.ndarray):
pil_imgs = [
PIL.Image.fromarray(img_arr) # type: ignore
for img_arr in imgs
]
elif isinstance(imgs[0], PIL.Image.Image):
pil_imgs = imgs
else:
raise ValueError(
"Simulator state images are not in a recognized format!")
imgs_for_vlm = []
for img_num, pil_img in enumerate(pil_imgs):
draw = ImageDraw.Draw(pil_img)
img_font = utils.get_scaled_default_font(draw, 10)
img_font = utils.get_scaled_default_font(draw, 6)
img_with_txt = utils.add_text_to_draw_img(
draw, (50, 50), f"Initial state to plan from, Image {img_num}",
img_font)
Expand Down
8 changes: 6 additions & 2 deletions predicators/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
from predicators.datasets.generate_atom_trajs_with_vlm import \
create_ground_atom_data_from_generated_demos, \
create_ground_atom_data_from_labelled_txt, \
create_ground_atom_data_from_saved_img_trajs
create_ground_atom_data_from_saved_img_trajs, \
create_low_level_trajs_from_saved_img_trajs
from predicators.datasets.ground_atom_data import create_ground_atom_data
from predicators.envs import BaseEnv
from predicators.settings import CFG
Expand Down Expand Up @@ -77,7 +78,7 @@ def create_dataset(env: BaseEnv, train_tasks: List[Task],
"demo+labelled_atoms", "geo_and_demo+labelled_atoms"
]:
return create_ground_atom_data_from_labelled_txt(
env, train_tasks, known_options)
env, train_tasks, known_options, known_predicates=known_predicates)
if CFG.offline_data_method in [
"saved_vlm_img_demos_folder", "geo_and_saved_vlm_img_demos_folder"
]: # pragma: no cover.
Expand All @@ -87,6 +88,9 @@ def create_dataset(env: BaseEnv, train_tasks: List[Task],
# we want to instantiate our own 'dummy' VLM.
return create_ground_atom_data_from_saved_img_trajs(
env, train_tasks, known_predicates, known_options)
if CFG.offline_data_method == "saved_vlm_img_demos_folder_nolabel":
return create_low_level_trajs_from_saved_img_trajs(
env, train_tasks, known_predicates, known_options)
if CFG.offline_data_method == "empty":
return Dataset([])
raise NotImplementedError("Unrecognized dataset method.")
Loading
Loading