=== Instruction 1 ===
Is Correct: False
Syntax Pass: False
Code Function: This code controls a robot to perform a two-step task involving a drawer. First, the robot picks up the bottom handle of a drawer from the floor by approaching it along the x-axis. Second, the robot pulls the drawer open using the same handle, moving it a specified distance. If any errors occur during these actions, they are caught and printed.
Similarity: {'ok': True, 'reason': 'The code achieves the task by picking up a handle associated with an unlocked, closed drawer and then pulling to open it, which matches the requirements for opening one drawer in the given domain and initial state.'}
Differences: 1. **Scope of Action**  
   - **TASK**: The instruction is to "Open one drawer," which is abstract and does not specify *how* the drawer should be opened, nor which drawer or handle to use.
   - **CODE_FUNC**: The code specifically opens the *bottom* drawer by first picking up the *bottom handle* from the floor and then pulling the drawer open using that handle.

2. **Object Selection**  
   - **TASK**: The drawer to be opened is unspecified; any drawer could be chosen.
   - **CODE_FUNC**: The code always selects the *bottom* drawer and its corresponding handle.

3. **Precondition Handling**  
   - **TASK**: The instruction does not mention any preconditions (e.g., lighting conditions, drawer lock state, robot location, hand state).
   - **CODE_FUNC**: The code implicitly assumes the robot can approach the handle and perform the actions, but does not explicitly check or handle conditions like lighting, lock state, or whether the robot's hand is empty.

4. **Lighting Condition**  
   - **TASK**: The domain requires the room to be bright for picking and pulling actions, but the instruction does not mention this.
   - **CODE_FUNC**: The code does not check or ensure the room is bright before acting.

5. **Drawer Lock State**  
   - **TASK**: The domain requires the drawer to be unlocked before opening, but the instruction does not specify this.
   - **CODE_FUNC**: The code does not check or unlock the drawer; it assumes the bottom drawer is already unlocked.

6. **Error Handling**  
   - **TASK**: The instruction does not mention error handling.
   - **CODE_FUNC**: The code includes error catching and prints errors if they occur.

7. **Action Granularity**  
   - **TASK**: The instruction is high-level and does not specify the sequence of actions (e.g., pick handle, pull drawer).
   - **CODE_FUNC**: The code explicitly performs two low-level actions: picking up the handle and pulling the drawer.

8. **Generalization**  
   - **TASK**: The instruction is general and could apply to any drawer in the environment.
   - **CODE_FUNC**: The code is hardcoded for a specific drawer and handle.

9. **Object Manipulation**  
   - **TASK**: The instruction does not specify whether the handle needs to be picked up from the floor.
   - **CODE_FUNC**: The code always picks up the handle from the floor before opening the drawer.

10. **Location Handling**  
    - **TASK**: The instruction does not specify the robot's starting or ending location.
    - **CODE_FUNC**: The code explicitly moves the robot along the x-axis to approach the handle.

11. **Output/Feedback**  
    - **TASK**: The instruction does not specify any output or feedback.
    - **CODE_FUNC**: The code prints errors if they occur.

---

**Summary:**  
The main semantic differences are that the TASK is abstract, general, and underspecified, while the CODE_FUNC is concrete, specific, and assumes certain preconditions (e.g., which drawer, handle, and that the environment is ready). The code also includes error handling and explicit action sequencing, which the instruction does not.

Refined Code Generated:
-------------------
"""Module to open one drawer in a general, abstract way."""
from Object_list import Object
from skill_mapping import RobotController

def open_one_drawer():
    """Open any available drawer."""
    robot = RobotController()

    # Ensure the room is bright
    if not robot.is_room_bright():
        switch = next((obj for obj in Object.values() if obj.type == "switch"), None)
        if switch is not None:
            robot.execute_push_switch(switch)
    
    # Find an unlocked, closed drawer and its handle
    for drawer_name, drawer in Object.items():
        if drawer.type == "drawer" and robot.is_drawer_unlocked(drawer) and robot.is_drawer_closed(drawer):
            # Find the handle for this drawer
            handle = next((obj for obj in Object.values() if obj.type == "object" and robot.is_handle_of(obj, drawer)), None)
            if handle is not None:
                # If handle is not held, pick it up
                if not robot.is_holding(handle):
                    if robot.is_on_floor(handle):
                        robot.execute_pick(handle)
                # Pull the drawer open
                robot.execute_pull(drawer, handle)
                break

def main():
    open_one_drawer()

if __name__ == "__main__":
    main()
-------------------

=== Instruction 2 ===
Is Correct: False
Syntax Pass: False
Code Function: The code defines a sequence for a robot to interact with a bottom drawer. First, the robot moves to pick the handle of the bottom drawer. Next, the robot pulls the handle to open the drawer by a specified distance. If any error occurs during these actions, it is caught and printed. The sequence is executed when the script is run directly.
Similarity: {'ok': False, 'reason': "The code does not account for turning on the light, which is required before picking up the handle or pulling the drawer according to the domain's preconditions."}
Differences: 1. **Explicitness of Drawer Selection**  
   - TASK: "Pull open a single drawer" is generic; it does not specify which drawer to open.
   - CODE_FUNC: The code specifically interacts with the *bottom* drawer.

2. **Handle Manipulation**  
   - TASK: Does not mention the need to pick up or manipulate a handle.
   - CODE_FUNC: The robot explicitly picks up the handle of the bottom drawer before pulling.

3. **Partial vs. Full Opening**  
   - TASK: "Pull open" is ambiguous about how far to open the drawer.
   - CODE_FUNC: The drawer is pulled open by a *specified distance*, implying partial or controlled opening.

4. **Error Handling**  
   - TASK: No mention of error handling or what to do if the action fails.
   - CODE_FUNC: Includes error catching and printing if any step fails.

5. **Lighting/Preconditions**  
   - TASK: Does not mention environmental preconditions (e.g., room brightness).
   - CODE_FUNC: The summary does not mention checking or ensuring the room is bright, which is a precondition in the PDDL domain.

6. **Execution Context**  
   - TASK: Is an instruction, not tied to code execution context.
   - CODE_FUNC: The sequence is executed only if the script is run directly (i.e., `if __name__ == "__main__":`).

7. **Sequence of Actions**  
   - TASK: Only specifies the end goal (drawer open), not the steps.
   - CODE_FUNC: Specifies a sequence: move to handle, pick handle, pull handle.

8. **Drawer State Assumptions**  
   - TASK: Does not specify if the drawer is locked/unlocked, open/closed, or empty/full.
   - CODE_FUNC: Assumes the drawer can be opened (i.e., is unlocked and closed).

9. **Object-Oriented Focus**  
   - TASK: Focuses on the drawer as the object of action.
   - CODE_FUNC: Focuses on both the handle and the drawer, treating the handle as a necessary intermediary.

10. **Robot Location**  
    - TASK: Does not specify where the robot should be.
    - CODE_FUNC: Implies the robot must move to the handle's location before acting.

11. **Single vs. Multiple Drawers**  
    - TASK: "a single drawer" could refer to any drawer.
    - CODE_FUNC: Only the bottom drawer is considered.

12. **Action Granularity**  
    - TASK: High-level instruction.
    - CODE_FUNC: Low-level, stepwise procedure.

13. **Physical Manipulation Details**  
    - TASK: No mention of how the drawer is to be opened (e.g., by handle, by pushing/pulling).
    - CODE_FUNC: Specifies pulling the handle as the method.

14. **Result Verification**  
    - TASK: No mention of verifying the drawer is open.
    - CODE_FUNC: No explicit verification step, but the sequence assumes success unless an error is caught.

15. **Parameterization**  
    - TASK: No parameters.
    - CODE_FUNC: The distance to pull is parameterized.

16. **Generalization**  
    - TASK: General instruction, could apply to any drawer.
    - CODE_FUNC: Hardcoded to a specific drawer and handle.

17. **Language/Format**  
    - TASK: Natural language instruction.
    - CODE_FUNC: Programmatic description of actions.

18. **Implicit vs. Explicit Preconditions**  
    - TASK: Implicitly assumes all preconditions are met.
    - CODE_FUNC: May or may not check preconditions (not specified in summary).

19. **Error Recovery**  
    - TASK: No mention of what to do if the action fails.
    - CODE_FUNC: Catches and prints errors, but does not attempt recovery.

20. **Action Initiation**  
    - TASK: Passive instruction.
    - CODE_FUNC: Active execution when script is run.

---

**Summary:**  
The TASK is a high-level, generic instruction, while CODE_FUNC is a specific, stepwise, and error-aware implementation for a particular drawer and handle, with additional details about manipulation, error handling, and execution context.

Refined Code Generated:
-------------------
"""Module to pull open a single drawer with necessary preconditions."""
from Object_list import Object
from skill_mapping import RobotController

def long_horizon_task2_oracle_seq():
    """Sequence to pull open a single drawer, ensuring all preconditions are met."""
    robot = RobotController()
    try:
        # Step 1: If the room is dark, turn on the light
        if robot.is_room_dark():
            robot.execute_push_switch(Object["light_switch"], Object["ready-pose"])

        # Step 2: Move to the handle of a closed, unlocked drawer (choose any available)
        drawer_to_open = None
        handle_to_use = None
        for drawer_name, drawer in Object.items():
            if getattr(drawer, "type", None) == "drawer":
                if robot.is_drawer_unlocked(drawer_name) and robot.is_drawer_closed(drawer_name):
                    drawer_to_open = drawer_name
                    # Find corresponding handle
                    for handle_name, handle in Object.items():
                        if getattr(handle, "type", None) == "object":
                            if robot.is_handle_of(handle_name, drawer_name):
                                handle_to_use = handle_name
                                break
                    if handle_to_use:
                        break
        if not drawer_to_open or not handle_to_use:
            print("No suitable drawer and handle found to open.")
            return

        # Step 3: Pick the handle
        robot.execute_movement(Object[handle_to_use], mode=1, axis=0)

        # Step 4: Pull to open the drawer
        robot.execute_movement(Object[handle_to_use], mode=4, axis=0, distance=0.1)

    except Exception as error:
        print(f"Error during task execution: {error}")

def main():
    """Main entry point to execute the drawer opening task."""
    long_horizon_task2_oracle_seq()

if __name__ == "__main__":
    main()
-------------------

=== Instruction 3 ===
Is Correct: False
Syntax Pass: False
Code Function: This code defines a sequence for a robot to interact with a drawer. First, the robot attempts to pick the bottom handle of the drawer by approaching it along the x-axis. Next, the robot tries to pull the drawer open by using the same handle, again approaching along the x-axis and pulling it by a specified distance. If any errors occur during these actions, they are caught and printed. The sequence is executed when the script is run directly.
Similarity: {'ok': False, 'reason': 'The code does not turn on the light before attempting to pick the handle, but the domain requires the room to be bright for picking actions.'}
Differences: 1. **Lighting Condition**:  
   - TASK (PDDL) requires the room to be bright (i.e., the light must be switched on) before the robot can pick the handle or pull the drawer open.  
   - CODE_FUNC does not mention or handle the lighting condition; it assumes the robot can act regardless of room brightness.

2. **Precondition Satisfaction**:  
   - TASK explicitly checks for and requires preconditions such as the robot being at the correct location, the drawer being unlocked and closed, the robot's hand being empty, and the robot being free.  
   - CODE_FUNC does not explicitly check or ensure these preconditions; it assumes the robot is in the correct state and location.

3. **Handle Acquisition**:  
   - TASK requires the robot to pick up the handle object before pulling the drawer.  
   - CODE_FUNC describes picking the handle, but the details of how the handle is picked (e.g., checking if the hand is empty, if the handle is on the floor, etc.) are not specified.

4. **Drawer State**:  
   - TASK requires the drawer to be unlocked and closed before pulling.  
   - CODE_FUNC does not specify or check the drawer's locked or closed state before attempting to pull.

5. **Error Handling**:  
   - CODE_FUNC includes error catching and printing if actions fail.  
   - TASK (PDDL) does not specify error handling; actions simply do not execute if preconditions are not met.

6. **Domain Generality**:  
   - TASK is defined in a general, declarative way using PDDL, allowing for multiple drawers, handles, and objects.  
   - CODE_FUNC is specific to a single drawer and handle (the bottom one).

7. **Action Granularity**:  
   - TASK separates actions into atomic steps (pick, pull, etc.) with explicit preconditions and effects.  
   - CODE_FUNC combines these into a procedural sequence, possibly omitting intermediate checks or state updates.

8. **Environmental Feedback**:  
   - TASK updates the world state after each action (e.g., hand becomes empty after pulling).  
   - CODE_FUNC does not specify state updates beyond the procedural steps.

9. **Switch/Light Handling**:  
   - TASK includes the possibility of needing to push a switch to turn on the light if the room is dark.  
   - CODE_FUNC does not include any action to turn on the light.

10. **Multiple Drawers/Handles**:  
    - TASK supports multiple drawers and handles via parameters.  
    - CODE_FUNC is hardcoded for the bottom drawer and handle.

11. **Object Types and Typing**:  
    - TASK uses explicit typing for objects, drawers, locations, and switches.  
    - CODE_FUNC does not specify types.

12. **Conditional Effects**:  
    - TASK uses conditional effects (e.g., updating drawer fullness).  
    - CODE_FUNC does not mention or handle such effects.

13. **Robot Location**:  
    - TASK requires the robot to be at a specific location for each action.  
    - CODE_FUNC mentions approaching along the x-axis but does not explicitly manage or check the robot's location state.

14. **Room State**:  
    - TASK tracks room state (dark/bright).  
    - CODE_FUNC does not.

15. **Concurrency/Atomicity**:  
    - TASK actions are atomic and non-concurrent.  
    - CODE_FUNC does not specify concurrency but is sequential.

16. **Action Success Criteria**:  
    - TASK actions only succeed if all preconditions are met.  
    - CODE_FUNC may attempt actions regardless of preconditions, relying on error catching.

17. **Effect on Other Objects**:  
    - TASK can affect other objects (e.g., fullness of drawer).  
    - CODE_FUNC does not mention such effects.

18. **Explicitness of Preconditions/Effects**:  
    - TASK is explicit about all preconditions and effects.  
    - CODE_FUNC is implicit or omits many.

19. **Initial State Handling**:  
    - TASK defines and uses an initial state.  
    - CODE_FUNC does not.

20. **Language/Paradigm**:  
    - TASK is declarative (PDDL).  
    - CODE_FUNC is imperative/procedural (code).

---

These are the semantic differences between TASK and CODE_FUNC.

Refined Code Generated:
-------------------
"""Module to slide one drawer open, following PDDL task requirements."""

from Object_list import Object
from skill_mapping import RobotController

def long_horizon_task2_oracle_seq():
    """Sequence to slide one drawer open, ensuring all PDDL preconditions are met."""
    robot = RobotController()

    # Step 1: Ensure robot is at ready-pose; if not, move there
    if not robot.is_at_location("ready-pose"):
        robot.execute_go(current_location=robot.get_current_location(), target_location="ready-pose")

    # Step 2: If the room is dark, turn on the light
    if robot.is_room_dark():
        robot.execute_push_switch(Object["light_switch"], location="ready-pose")

    # Step 3: Ensure hand is empty and robot is free
    if not robot.is_hand_empty():
        robot.release_held_object()
    if not robot.is_robot_free():
        robot.set_robot_free()

    # Step 4: Ensure handle_bottom is on the floor at ready-pose
    if not robot.is_object_on_floor("handle_bottom"):
        robot.place_object_on_floor("handle_bottom", location="ready-pose")

    # Step 5: Pick up the handle_bottom at ready-pose
    robot.execute_pick(Object["handle_bottom"], location="ready-pose")

    # Step 6: Ensure drawer_bottom is unlocked and closed
    if not robot.is_drawer_unlocked("drawer_bottom"):
        robot.unlock_drawer("drawer_bottom")
    if not robot.is_drawer_closed("drawer_bottom"):
        robot.close_drawer("drawer_bottom")

    # Step 7: Pull the drawer_bottom using handle_bottom at ready-pose
    robot.execute_pull(drawer=Object["drawer_bottom"], handle=Object["handle_bottom"], location="ready-pose")

def main():
    """Main entry point to execute the drawer opening sequence."""
    long_horizon_task2_oracle_seq()

if __name__ == "__main__":
    main()
-------------------

=== Instruction 4 ===
Is Correct: False
Syntax Pass: False
Code Function: This code defines a sequence for a robot to open a drawer. First, the robot approaches and grasps the bottom handle of the drawer by moving along the x-axis. Next, the robot pulls the drawer open by moving the handle a specified distance along the same axis. If any errors occur during these actions, they are caught and printed. The sequence is executed when the script is run directly.
Similarity: {'ok': False, 'reason': "The code description does not mention turning on the light, which is required before opening the drawer according to the domain's preconditions."}
Differences: 1. TASK is a high-level, natural language instruction ("Open up one of the drawers.") that is underspecified: it does not specify which drawer, nor does it mention any constraints or required preconditions (e.g., whether the room is dark, whether the drawer is locked, etc.).
2. CODE_FUNC describes a specific, low-level sequence for a robot to open a drawer, including:
   - Approaching and grasping the bottom handle (implying a specific drawer: the bottom one).
   - Moving along the x-axis to reach and pull the handle.
   - Pulling the drawer open by moving the handle a specified distance.
   - Error handling (catching and printing errors).
   - The sequence is executed as a script (when run directly).
3. TASK does not specify which drawer to open, while CODE_FUNC targets the bottom drawer specifically.
4. TASK does not specify how to open the drawer (e.g., which handle to use, which axis to move along, or how far to pull), while CODE_FUNC specifies these details.
5. TASK does not mention error handling or execution context, while CODE_FUNC includes both.
6. TASK is agnostic to the robot's initial state (e.g., room brightness, robot location, hand state), while CODE_FUNC assumes the robot can immediately approach and grasp the handle.
7. TASK is compatible with any drawer that is possible to open, while CODE_FUNC is only applicable to the bottom drawer (as per the handle grasping step).
8. TASK does not specify the need to turn on the light or unlock the drawer, while CODE_FUNC assumes these preconditions are already satisfied or does not address them.
9. TASK is declarative (what to do), while CODE_FUNC is procedural (how to do it).
10. TASK is abstract and could be mapped to multiple possible action sequences depending on the environment state, while CODE_FUNC is a concrete, fixed sequence.

Refined Code Generated:
-------------------
"""Module to open one of the drawers using the robot controller."""

from Object_list import Object
from skill_mapping import RobotController

def long_horizon_task2_oracle_seq():
    """Sequence to open one of the drawers (bottom drawer) with all required preconditions."""
    robot = RobotController()

    try:
        # Step 1: Move to the light switch location and turn on the light if the room is dark
        robot.execute_movement(Object["light_switch"], mode=1)
        robot.execute_push_switch(Object["light_switch"])

        # Step 2: Move to the bottom drawer handle and pick it
        robot.execute_movement(Object["drawer_bottom_handle"], mode=1, axis=0)
        robot.execute_pick(Object["drawer_bottom_handle"])

        # Step 3: Pull the bottom drawer using the handle
        robot.execute_movement(Object["drawer_bottom_handle"], mode=4, distance=0.1)

    except Exception as error:
        print(f"Error during task execution: {error}")

def main():
    """Main entry point to execute the drawer opening task."""
    long_horizon_task2_oracle_seq()

if __name__ == "__main__":
    main()
-------------------

=== Instruction 5 ===
Is Correct: False
Syntax Pass: False
Code Function: This code defines a sequence for a robot to interact with a drawer. First, the robot moves to grasp the bottom handle of the drawer by approaching along the x-axis. Next, the robot pulls the handle along the same axis to open the drawer by a specified distance. If any error occurs during these actions, it is caught and printed. The sequence is executed when the script is run directly.
Similarity: {'ok': False, 'reason': "The code does not account for turning on the light before interacting with the drawer, which is required for opening the drawer according to the domain's preconditions."}
Differences: 1. **Lighting Condition**  
   - **TASK**: Requires the room to be bright before opening the drawer (i.e., the robot must turn on the light if the room is dark).
   - **CODE_FUNC**: No mention of checking or changing the room's lighting condition before opening the drawer.

2. **Handle Grasping**  
   - **TASK**: The robot must pick up the handle object (e.g., `handle_bottom`) before pulling to open the drawer.
   - **CODE_FUNC**: The robot "grasps" the handle, but it is not specified whether this involves picking up a separate handle object or simply grasping an attached handle.

3. **Drawer Lock State**  
   - **TASK**: The drawer must be unlocked before it can be opened.
   - **CODE_FUNC**: No mention of checking or unlocking the drawer before attempting to open it.

4. **Drawer State Precondition**  
   - **TASK**: The drawer must be closed before it can be opened.
   - **CODE_FUNC**: No explicit check for the drawer's closed state before opening.

5. **Error Handling**  
   - **TASK**: No explicit error handling described.
   - **CODE_FUNC**: Includes error catching and printing if an error occurs during the sequence.

6. **Location/Positioning**  
   - **TASK**: The robot must be at a specific location (e.g., `robot-at ?p`) before interacting with the drawer.
   - **CODE_FUNC**: The robot "approaches along the x-axis," but does not specify checking or ensuring a particular named location.

7. **Action Granularity**  
   - **TASK**: Opening the drawer is decomposed into primitive actions (e.g., pick handle, pull handle, etc.).
   - **CODE_FUNC**: The sequence is described at a higher level (approach, grasp, pull), possibly abstracting away some lower-level actions.

8. **Postconditions**  
   - **TASK**: After opening, the robot releases the handle and its hand becomes empty.
   - **CODE_FUNC**: No mention of releasing the handle or the robot's hand state after opening.

9. **Multiple Drawers/Handles**  
   - **TASK**: The domain supports multiple drawers and handles, requiring the correct association.
   - **CODE_FUNC**: Only refers to "the bottom handle" and "the drawer," without explicit mapping or selection logic.

10. **Switch/Light Interaction**  
    - **TASK**: May require interacting with a switch to turn on the light.
    - **CODE_FUNC**: No mention of interacting with a switch.

11. **Object Typing and Constraints**  
    - **TASK**: Enforces types and constraints (e.g., only certain objects can be handles, drawers, etc.).
    - **CODE_FUNC**: No explicit typing or constraint enforcement.

12. **Room State Awareness**  
    - **TASK**: The robot is aware of and acts based on the room's state (dark/bright).
    - **CODE_FUNC**: No awareness or action based on room state.

13. **Script Execution Context**  
    - **TASK**: Not specified.
    - **CODE_FUNC**: The sequence is executed only if the script is run directly (`if __name__ == "__main__":`).

14. **Partial/Full Drawer States**  
    - **TASK**: The domain tracks whether drawers are empty, partially filled, or full.
    - **CODE_FUNC**: No mention of drawer content state.

15. **Robot State (Free/Busy)**  
    - **TASK**: The robot must be free (not holding anything, not busy) before certain actions.
    - **CODE_FUNC**: No mention of checking or updating the robot's free/busy state.

16. **Action Preconditions and Effects**  
    - **TASK**: Each action has explicit preconditions and effects.
    - **CODE_FUNC**: Preconditions and effects are implicit or not specified.

17. **Conditional Effects**  
    - **TASK**: Some actions have conditional effects (e.g., placing an object may change the drawer's fullness state).
    - **CODE_FUNC**: No conditional effects described.

18. **Error Recovery**  
    - **TASK**: No error recovery described.
    - **CODE_FUNC**: Errors are caught and printed, but no recovery is attempted.

19. **Explicitness of Steps**  
    - **TASK**: Steps are explicitly defined and ordered.
    - **CODE_FUNC**: Steps are described at a higher level, possibly omitting some details.

20. **Domain Generality**  
    - **TASK**: The domain is general and supports multiple objects, drawers, and handles.
    - **CODE_FUNC**: The code is specific to a single drawer and handle.

---

**Summary:**  
The main semantic differences are that the TASK is more explicit, formal, and general, with detailed preconditions, effects, and state tracking, while the CODE_FUNC is more abstract, specific, and omits many environmental and state checks required by the TASK.

Refined Code Generated:
-------------------
from Object_list import Object
from skill_mapping import RobotController

def long_horizon_task2_oracle_seq():
    """
    Uncover a drawer by opening it, following all domain preconditions.
    """
    robot = RobotController()

    try:
        # Step 1: Move to the light switch location if not already there
        if not robot.is_at_location(Object["light_switch_location"]):
            robot.execute_movement(Object["light_switch_location"], mode=0)
        # Step 2: If the room is dark, turn on the light
        if robot.is_room_dark():
            robot.execute_push_switch(Object["light_switch"])
        # Step 3: Move to the drawer area if not already there
        if not robot.is_at_location(Object["drawer-area"]):
            robot.execute_movement(Object["drawer-area"], mode=0)
        # Step 4: Ensure the drawer is unlocked
        if robot.is_drawer_locked(Object["drawer_bottom"]):
            raise Exception("Drawer is locked and cannot be opened.")
        # Step 5: Ensure the drawer is closed
        if not robot.is_drawer_closed(Object["drawer_bottom"]):
            raise Exception("Drawer must be closed before opening.")
        # Step 6: Pick up the correct handle (handle_bottom)
        if not robot.is_holding(Object["handle_bottom"]):
            if not robot.is_on_floor(Object["handle_bottom"]):
                raise Exception("Handle_bottom is not accessible for picking.")
            robot.execute_pick(Object["handle_bottom"])
        # Step 7: Pull the handle to open the drawer
        robot.execute_pull(Object["drawer_bottom"], Object["handle_bottom"])
        # Step 8: Release the handle after opening
        robot.execute_release(Object["handle_bottom"])
    except Exception as error:
        print(f"Error during task execution: {error}")

def main():
    """
    Main entry point for the drawer opening task.
    """
    long_horizon_task2_oracle_seq()

if __name__ == "__main__":
    main()
-------------------

