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

Not detecting microwave during data generation #121

Closed
RishiHazra opened this issue Aug 12, 2022 · 3 comments
Closed

Not detecting microwave during data generation #121

RishiHazra opened this issue Aug 12, 2022 · 3 comments

Comments

@RishiHazra
Copy link

RishiHazra commented Aug 12, 2022

Hi,

I'm trying to generate data with new goal definitions. I've updated the code to work on the AI2Thor 4.2.0. While it's able to generate new data for goal pertaining to pick, place, clean and cool -- when it comes to heat sub-goal, it no longer works. While trying to narrow down the issue, I realized that self.env.last_event.metadata["objects"] (in gen/game_states/task_game_state_full_knowledge.py) does not show "Microwave" even though it is present in the scene and in clear view. It can detect "StoveBurner" & "Fridge" though.

As such the planner keeps failing with the error:

ff: goal can simplified to FALSE. No plan will solve it

Any help is appreciated. Thanks !!!

@askforalfred
Copy link
Owner

askforalfred commented Aug 12, 2022 via email

@RishiHazra
Copy link
Author

RishiHazra commented Aug 12, 2022

Thanks for the quick response. I can confirm that Microwave hasn't been renamed in the new version of AI2Thor.

On digging further, I was able to trace it to the function in alfred/env/thor_env.py

def restore_scene(self, object_poses, object_toggles, dirty_and_empty):
        '''
        restore object locations and states
        '''
        super().step(dict(
            action='Initialize',
            gridSize=constants.AGENT_STEP_SIZE / constants.RECORD_SMOOTHING_FACTOR,
            renderImage=constants.RENDER_IMAGE,
            renderDepthImage=constants.RENDER_DEPTH_IMAGE,
            renderClassImage=constants.RENDER_CLASS_IMAGE,
            renderObjectImage=constants.RENDER_OBJECT_IMAGE,
            visibility_distance=constants.VISIBILITY_DISTANCE,
            makeAgentsVisible=False,
        ))

        

        if len(object_toggles) > 0:
            # TODO: problem here: the API has change on these two attributes.
            for o in object_toggles:
                super().step((dict(action='SetObjectStates', 
                                SetObjectStates=o)))
        
        if dirty_and_empty:
            # TODO: problem here: the API also change on these two attributes.
            for o in object_poses:
                super().step(dict(action='SetObjectStates',
                    SetObjectStates={'objectType': o['objectName'].split('_')[0], 'stateChange': 'dirtyable', 'isDirty': True}))

                super().step(dict(action='SetObjectStates',
                    SetObjectStates={'objectType': o['objectName'].split('_')[0], 'stateChange': 'canFillWithLiquid', 'isFilledWithLiquid': False}))
        
        super().step((dict(action='SetObjectPoses', objectPoses=object_poses)))

It seems like running this function with action='SetObjectPoses' leads to the discarding of certain objects -- as in Microwave is detected initially in the list of objects in the event metadata (last_event.metadata["objects"]), however on running this function, it gets discarded. Moreover, it also discards objects like GarbageCan, Shelf, etc all of which are initially detected in the event metadata. This happens irrespective of the FloorPlan. I can see a couple of TODO marked there which sort of resembles my problem.

I've opened an issue on AI2Thor repo too.

@RishiHazra
Copy link
Author

Update: I was able to figure out the error. By editing the object_poses, to include 'moveable' objects as well as 'pickupable' objects, I was able to resolve the issue. Apparently, objects like Microwave, CoffeeMachine, GarbageCan, etc. have moveable=True property and while performing the action='SetObjectPoses', AI2Thor drops all objects that aren't moveable or pickupable (see documentation)

object_poses = [{'objectName': obj['name'].split('(Clone)')[0],
                                        'position': obj['position'],
                                        'rotation': obj['rotation']}
                                        for obj in env.last_event.metadata['objects'] if obj['pickupable'] or obj['moveable']]

Going ahead and closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants