Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HITL - Add object state manipulation utility. #2042

Merged
merged 2 commits into from
Aug 28, 2024

Conversation

0mdc
Copy link
Contributor

@0mdc 0mdc commented Aug 27, 2024

Motivation and Context

This changeset introduces an utility to manipulate object states.

How Has This Been Tested

Tested with habitat-llm.

Types of changes

  • [Development]

Checklist

  • My code follows the code style of this project.
  • I have updated the documentation if required.
  • I have read the CONTRIBUTING document.
  • I have completed my CLA (see CONTRIBUTING)
  • I have added tests to cover my changes if required.

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Aug 27, 2024
@0mdc 0mdc marked this pull request as ready for review August 27, 2024 15:29
True: OraclePowerOnInPlaceSkill,
False: OraclePowerOffInPlaceSkill,
},
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aclegg3 , @MatthewChang

Would you happen to know whether we already have this information? It would be great to have a single source of truth and avoid drift here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you would reverse engineer the ObjectStateMachine instance by checking each active ObjectStateSpec for it's name:

Could be a helper function to do this in that class if it would be useful.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like what we want. That may require some habitat_llm changes for skill auto-discovery.
I'll refactor this in a later pass.

Copy link
Contributor

@zephirefaith zephirefaith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Confusing maps and variable-types can use some rewording/documentation

self, state_name: str, target_value: bool
) -> Optional[OracleObjectStateInPlaceSkill]:
"""
Return a boolean action that allows for changing 'state_name' to 'target_value'.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actions are not boolean, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah you mean BooleanAction type. Got it. Reword the comment?

Comment on lines +162 to +170
actions.append(
BooleanAction(
state_spec=spec,
current_value=state.value,
target_value=target_value,
available=action_available,
enabled=action_enabled,
error=error,
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you cache the actions available in the world for all objects and then pass these to the UI to populate with based on user's clicks?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct!

@0mdc 0mdc merged commit f29be5b into main Aug 28, 2024
3 of 4 checks passed
@0mdc 0mdc deleted the 0mdc/hitl_object_state_manipulator branch August 28, 2024 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants