=== Instruction 1 ===
Is Correct: False
Syntax Pass: False
Code Function: The code defines a function to run a simulation task involving a robotic gripper. It begins by setting up the environment and resetting the task to its initial state. It optionally initializes video recording for the simulation. The function retrieves the positions of various objects in the environment, including a drawer and rubbish.

The task consists of several key steps: first, the gripper rotates to a specific angle; then it moves to the side position of a bottom drawer, followed by moving to the anchor position of the drawer. Next, the gripper picks up the drawer and pulls it open. After that, it picks up rubbish from a table and finally places the rubbish into a bin. 

At each step, the function checks if the task is completed and prints a message indicating the status. The environment is ensured to be properly shut down at the end of the task, regardless of whether it completed successfully or not.
Similarity: {'ok': False, 'reason': 'LLM JSON parsing failed.'}
Differences: 1. **Nature of Content**: 
   - TASK is a formal representation of a planning problem using PDDL (Planning Domain Definition Language), while CODE_FUNC describes a procedural function for simulating a robotic task in a programming context.

2. **Structure**: 
   - TASK is structured in terms of actions, predicates, and parameters defined in a domain and problem format, whereas CODE_FUNC is structured as a sequence of procedural steps in a programming function.

3. **Purpose**: 
   - TASK is designed for automated planning and reasoning about actions in a defined domain, while CODE_FUNC is intended for executing a simulation of a task in a programming environment.

4. **Level of Abstraction**: 
   - TASK operates at a higher level of abstraction, focusing on the logical relationships and conditions for actions, while CODE_FUNC operates at a lower level, detailing specific steps and operations to be performed by a robot.

5. **Execution Context**: 
   - TASK is meant to be interpreted by a planner or a reasoning engine, while CODE_FUNC is meant to be executed in a programming environment, likely involving a robot simulation framework.

6. **Error Handling**: 
   - TASK does not explicitly handle errors or exceptions; it defines preconditions and effects for actions. CODE_FUNC includes checks for task completion and ensures proper shutdown of the environment, indicating a focus on robustness in execution.

7. **Output**: 
   - TASK does not produce output messages; it defines the state changes resulting from actions. CODE_FUNC includes print statements to indicate the status of the task at various steps.

8. **Initialization**: 
   - TASK initializes the state of the world through the `:init` section, while CODE_FUNC initializes the environment and may include optional video recording setup.

9. **Object Interaction**: 
   - TASK defines interactions in terms of predicates and actions (e.g., `holding`, `at`), while CODE_FUNC describes interactions in a procedural manner (e.g., moving to positions, picking up objects).

10. **Focus on Specific Actions**: 
    - TASK includes a detailed definition of actions like `pick`, `place`, `rotate`, etc., while CODE_FUNC focuses on a specific sequence of actions to complete a task without detailing the underlying logic of each action.

In summary, the semantic differences between TASK and CODE_FUNC are significant, reflecting their distinct purposes, structures, and contexts of use.

Refined Code Generated:
-------------------
import numpy as np
from pyrep.objects.shape import Shape
from pyrep.objects.proximity_sensor import ProximitySensor

from env import setup_environment, shutdown_environment
from skill_code import *
from video import init_video_writers, recording_step, recording_get_observation
from object_positions import get_object_positions

def run_skeleton_task():
    '''Generic skeleton for running any task in your simulation.'''
    print("===== Starting Skeleton Task =====")
    
    # === Environment Setup ===
    env, task = setup_environment()
    try:
        # Reset the task to its initial state
        descriptions, obs = task.reset()

        # (Optional) Initialize video writers for capturing your simulation
        init_video_writers(obs)

        # Wrap the task steps for recording (if needed)
        original_step = task.step
        task.step = recording_step(original_step)
        original_get_obs = task.get_observation
        task.get_observation = recording_get_observation(original_get_obs)

        # === Retrieve Object Positions ===
        positions = get_object_positions()

        # Define object positions
        bottom_anchor_pos = positions['bottom_anchor_pos']
        bottom_side_pos = positions['bottom_side_pos']
        rubbish_pos = positions['rubbish']
        bin_pos = positions['bin']

        # === Execute the Plan ===
        # Step 1: Rotate the gripper to ninety degrees
        obs, reward, done = rotate(env, task, target_quat=np.array([0, 0, 1, 0]), max_steps=100, threshold=0.05, timeout=10.0)
        if done:
            print("[Task] Task ended after rotating!")
            return

        # Step 2: Move to the side position of the bottom drawer
        obs, reward, done = move(env, task, target_pos=bottom_side_pos, max_steps=100, threshold=0.01, timeout=10.0)
        if done:
            print("[Task] Task ended after moving to side position!")
            return

        # Step 3: Move to the anchor position of the bottom drawer
        obs, reward, done = move(env, task, target_pos=bottom_anchor_pos, max_steps=100, threshold=0.01, timeout=10.0)
        if done:
            print("[Task] Task ended after moving to anchor position!")
            return

        # Step 4: Pick the bottom drawer
        obs, reward, done = pick_drawer(env, task, gripper='gripper', d='bottom', p=bottom_anchor_pos)
        if done:
            print("[Task] Task ended after picking the drawer!")
            return

        # Step 5: Pull the bottom drawer open
        obs, reward, done = pull(env, task, pull_distance=0.1, pull_axis='x', max_steps=100, threshold=0.01, timeout=10.0)
        if done:
            print("[Task] Task ended after pulling the drawer!")
            return

        # Step 6: Pick the rubbish from the table
        obs, reward, done = pick(env, task, target_pos=rubbish_pos, approach_distance=0.15, max_steps=100, threshold=0.01, approach_axis='z', timeout=10.0)
        if done:
            print("[Task] Task ended after picking the rubbish!")
            return

        # Step 7: Place the rubbish in the bin
        obs, reward, done = place(env, task, target_pos=bin_pos, approach_distance=0.15, max_steps=100, threshold=0.01, approach_axis='z', timeout=10.0)
        if done:
            print("[Task] Task completed successfully! Reward:", reward)
        else:
            print("[Task] Task not completed yet (done=False).")

    finally:
        # Always ensure the environment is properly shutdown
        shutdown_environment(env)

    print("===== End of Skeleton Task =====")

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

=== Instruction 2 ===
Is Correct: False
Syntax Pass: False
Code Function: The code defines a function to run a simulation task involving a robotic gripper. It begins by setting up the environment and resetting the task to its initial state. It optionally initializes video recording for the simulation. The function retrieves the positions of various objects, including a drawer, rubbish, and a bin. 

The robot then follows a series of steps: it moves to the side of the bottom drawer, then to the anchor position of the drawer, picks up the drawer, and pulls it open. Next, it picks up rubbish from a table and places it into the bin. Finally, the environment is shut down properly after the task is completed. The function prints messages indicating the start and end of the task.
Similarity: {'ok': False, 'reason': 'LLM JSON parsing failed.'}
Differences: 1. **Purpose**: 
   - **TASK**: Describes a specific sequence of actions to be performed by a robot (pulling open a drawer and dropping rubbish into a bin).
   - **CODE_FUNC**: Describes a function that implements a simulation of the task, including setup, execution, and shutdown.

2. **Level of Abstraction**:
   - **TASK**: High-level instruction focused on the desired outcome.
   - **CODE_FUNC**: Low-level implementation detailing the steps taken by the robot, including environment setup and state management.

3. **Components**:
   - **TASK**: Contains a single instruction with no details on how to achieve it.
   - **CODE_FUNC**: Includes multiple components such as environment initialization, object retrieval, action sequences, and shutdown procedures.

4. **Execution Context**:
   - **TASK**: Assumes a context where a robot can perform actions based on the instruction.
   - **CODE_FUNC**: Operates within a programming environment, requiring a defined function structure and possibly a simulation framework.

5. **Output**:
   - **TASK**: Does not specify any output or feedback mechanism.
   - **CODE_FUNC**: Includes print statements to indicate the start and end of the task, providing feedback on execution.

6. **Action Sequence**:
   - **TASK**: Specifies a general action sequence (pulling a drawer and dropping rubbish).
   - **CODE_FUNC**: Details a specific sequence of actions, including moving to positions, picking up the drawer, and placing rubbish in the bin.

7. **Error Handling**:
   - **TASK**: Does not account for potential errors or conditions (e.g., locked drawers).
   - **CODE_FUNC**: Implies a structured approach to handling the task, which may include checks for conditions (though not explicitly stated).

8. **State Management**:
   - **TASK**: Does not manage or track the state of objects or the environment.
   - **CODE_FUNC**: Involves state management, including resetting the environment and tracking the positions of objects.

9. **Simulation Aspect**:
   - **TASK**: Does not mention simulation or any form of virtual execution.
   - **CODE_FUNC**: Clearly indicates that it is part of a simulation, including optional video recording.

10. **Complexity**:
    - **TASK**: Simple and straightforward instruction.
    - **CODE_FUNC**: More complex, involving multiple steps and considerations for execution.

In summary, the semantic differences between TASK and CODE_FUNC are significant, as TASK is a high-level instruction while CODE_FUNC is a detailed implementation of that instruction within a simulation context.

Refined Code Generated:
-------------------
import numpy as np
from pyrep.objects.shape import Shape
from pyrep.objects.proximity_sensor import ProximitySensor

from env import setup_environment, shutdown_environment
from skill_code import *
from video import init_video_writers, recording_step, recording_get_observation
from object_positions import get_object_positions

def run_skeleton_task():
    '''Generic skeleton for running any task in your simulation.'''
    print("===== Starting Skeleton Task =====")
    
    # === Environment Setup ===
    env, task = setup_environment()
    try:
        # Reset the task to its initial state
        _, obs = task.reset()

        # (Optional) Initialize video writers for capturing your simulation
        init_video_writers(obs)

        # Wrap the task steps for recording (if needed)
        original_step = task.step
        task.step = recording_step(original_step)
        original_get_obs = task.get_observation
        task.get_observation = recording_get_observation(original_get_obs)

        # === Retrieve Object Positions ===
        positions = get_object_positions()

        # Define positions for the drawers and rubbish
        bottom_anchor_pos = positions['bottom_anchor_pos']
        bottom_side_pos = positions['bottom_side_pos']
        rubbish_pos = positions['rubbish']
        bin_pos = positions['bin']

        # === Execute the Plan ===
        # Step 1: Move to the side position of the bottom drawer
        move(env, task, bottom_side_pos)

        # Step 2: Move to the anchor position of the bottom drawer
        move(env, task, bottom_anchor_pos)

        # Step 3: Pick the bottom drawer
        pick_drawing(env, task, 'gripper', 'bottom', bottom_anchor_pos)

        # Step 4: Pull open the bottom drawer
        pull(env, task, 'gripper', 'bottom')

        # Step 5: Pick the rubbish
        pick(env, task, 'rubbish', 'table')

        # Step 6: Place the rubbish into the bin
        place(env, task, 'rubbish', 'bin')

    finally:
        # Always ensure the environment is properly shutdown
        shutdown_environment(env)

    print("===== End of Skeleton Task =====")

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

=== Instruction 3 ===
Is Correct: False
Syntax Pass: False
Code Function: The code defines a function that simulates a robotic task in an environment. It begins by setting up the environment and resetting the task to its initial state. It optionally initializes video recording for the simulation. The function retrieves the positions of various objects, including rubbish and a bin.

The task consists of a series of steps: first, the robot rotates its gripper, then moves to the side and anchor positions of a bottom drawer. Next, it picks up the drawer and pulls it out. After that, the robot picks up rubbish and finally places it in the bin. Each step checks if the task is completed, and if so, it exits early. The function ensures that the environment is properly shut down at the end of the task.
Similarity: {'ok': False, 'reason': 'LLM JSON parsing failed.'}
Differences: 1. **Nature of Content**: 
   - TASK is a detailed instruction set for a robotic action, while CODE_FUNC describes a function that simulates a robotic task in a programming context.

2. **Format**: 
   - TASK is presented in a structured format (PDDL) that defines actions, predicates, and the environment, whereas CODE_FUNC is a narrative description of a function's behavior.

3. **Level of Detail**: 
   - TASK includes specific actions, preconditions, and effects related to the robotic task, while CODE_FUNC provides a high-level overview of the task without detailing the underlying actions or conditions.

4. **Purpose**: 
   - TASK is designed to define a domain and problem for planning in AI, while CODE_FUNC is intended to describe the implementation of a simulation function.

5. **Execution Context**: 
   - TASK is meant for a planning system that interprets PDDL, while CODE_FUNC is likely intended for a programming environment that executes the function.

6. **Action Specification**: 
   - TASK specifies actions like "pick-drawer" and "pull" with their parameters and effects, while CODE_FUNC describes the sequence of actions in a more abstract manner without specifying parameters or effects.

7. **State Management**: 
   - TASK explicitly defines the initial state and the effects of actions on that state, while CODE_FUNC mentions checking if the task is completed but does not detail state transitions.

8. **Environment Interaction**: 
   - TASK includes predicates that define the relationships and states of objects in the environment, while CODE_FUNC focuses on the sequence of actions without detailing the relationships.

9. **Error Handling**: 
   - TASK does not mention error handling or conditions for failure, while CODE_FUNC implies that the function checks for task completion and may exit early.

10. **Output**: 
    - TASK does not specify an output, as it is focused on the planning aspect, while CODE_FUNC implies an output in terms of task completion and environment shutdown.

11. **Language**: 
    - TASK uses a formal language (PDDL) for defining actions and states, while CODE_FUNC uses natural language to describe the function's behavior.

12. **Initialization**: 
    - TASK initializes the environment through PDDL constructs, while CODE_FUNC describes an initialization process in a programming context.

13. **Recording**: 
    - CODE_FUNC mentions optional video recording for the simulation, which is not present in TASK.

14. **Task Steps**: 
    - TASK outlines specific actions with preconditions and effects, while CODE_FUNC summarizes the steps without detailing the conditions for each action.

15. **Focus on Simulation**: 
    - CODE_FUNC emphasizes the simulation aspect of the task, while TASK focuses on the planning and execution of actions in a defined domain.

16. **Terminology**: 
    - TASK uses specific terminology related to PDDL and robotics, while CODE_FUNC uses more general programming and simulation terminology.

17. **Completeness**: 
    - TASK is complete in terms of defining a planning problem, while CODE_FUNC may not cover all aspects of the task execution in detail.

18. **Robotic Actions**: 
    - TASK defines robotic actions in terms of predicates and effects, while CODE_FUNC describes them in a procedural manner.

19. **Task Complexity**: 
    - TASK may imply a more complex interaction of actions and states, while CODE_FUNC simplifies the task into a linear sequence of steps.

20. **User Interaction**: 
    - TASK does not involve user interaction, while CODE_FUNC may imply user interaction through the simulation interface.

21. **Implementation Detail**: 
    - TASK is abstract and does not concern itself with implementation details, while CODE_FUNC may involve specific programming constructs and logic.

22. **Domain Specificity**: 
    - TASK is specific to a defined domain (robotic manipulation), while CODE_FUNC is more general and could apply to various robotic tasks.

23. **Task Completion**: 
    - TASK does not explicitly define what constitutes task completion, while CODE_FUNC mentions checking for task completion as part of its logic.

24. **Action Order**: 
    - TASK defines the order of actions through preconditions and effects, while CODE_FUNC describes the order in a narrative format without formal constraints.

25. **State Representation**: 
    - TASK uses predicates to represent the state of the environment, while CODE_FUNC may use variables and data structures typical in programming.

26. **Action Parameters**: 
    - TASK specifies parameters for actions in a formal way, while CODE_FUNC describes actions without detailing their parameters.

27. **Logical Structure**: 
    - TASK has a logical structure based on planning, while CODE_FUNC has a procedural structure typical of programming functions.

28. **Focus on Planning vs. Execution**: 
    - TASK focuses on planning and defining actions, while CODE_FUNC focuses on executing a sequence of actions in a simulation.

29. **Use of Conditions**: 
    - TASK uses logical conditions to define preconditions and effects, while CODE_FUNC describes conditions in a more informal manner.

30. **Simulation Context**: 
    - CODE_FUNC is explicitly set in a simulation context, while TASK is set in a planning context.

31. **Action Effects**: 
    - TASK defines the effects of actions in terms of state changes, while CODE_FUNC describes the outcome of actions in a more abstract way.

32. **Robotic Manipulation**: 
    - TASK includes specific actions related to robotic manipulation, while CODE_FUNC describes the manipulation in a more general sense.

33. **Task Resetting**: 
    - CODE_FUNC mentions resetting the task to its initial state, which is not addressed in TASK.

34. **Shutdown Procedures**: 
    - CODE_FUNC includes a shutdown procedure for the environment, which is not mentioned in TASK.

35. **Object Interaction**: 
    - TASK defines how objects interact through predicates, while CODE_FUNC describes interactions in a more narrative form.

36. **Task Initialization**: 
    - TASK initializes the environment through PDDL constructs, while CODE_FUNC describes an initialization process in a programming context.

37. **Action Descriptions**: 
    - TASK provides detailed descriptions of actions, while CODE_FUNC provides a high-level overview of the task steps.

38. **Focus on Implementation**: 
    - CODE_FUNC emphasizes the implementation of the task, while TASK emphasizes the planning and definition of the task.

39. **Task Flow**: 
    - TASK defines a flow of actions based on logical conditions, while CODE_FUNC describes a linear flow of actions.

40. **Use of Variables**: 
    - CODE_FUNC likely uses variables to manage state and actions, while TASK uses predicates to represent state.

41. **Task Abstraction**: 
    - TASK is more abstract in terms of planning, while CODE_FUNC is more concrete in terms of implementation.

42. **Error Checking**: 
    - CODE_FUNC implies error checking for task completion, while TASK does not mention error handling.

43. **Task Representation**: 
    - TASK represents the task in a formal language, while CODE_FUNC represents it in a programming context.

44. **Action Preconditions**: 
    - TASK specifies preconditions for actions, while CODE_FUNC does not detail preconditions in the same way.

45. **Task Description Style**: 
    - TASK uses a formal, structured style, while CODE_FUNC uses a descriptive, narrative style.

46. **Focus on Robotics**: 
    - TASK is specifically focused on robotic actions and planning, while CODE_FUNC is focused on the simulation of those actions.

47. **Task Execution Logic**: 
    - TASK defines the logic of task execution through PDDL, while CODE_FUNC describes it in a procedural manner.

48. **State Transition**: 
    - TASK explicitly defines state transitions through effects, while CODE_FUNC implies transitions without detailing them.

49. **Action Sequencing**: 
    - TASK defines the sequence of actions through logical dependencies, while CODE_FUNC describes the sequence in a linear narrative.

50. **Task Completion Criteria**: 
    - TASK does not define criteria for task completion, while CODE_FUNC implies checking for completion as part of its logic.

Refined Code Generated:
-------------------
import numpy as np
from pyrep.objects.shape import Shape
from pyrep.objects.proximity_sensor import ProximitySensor

from env import setup_environment, shutdown_environment
from skill_code import *
from video import init_video_writers, recording_step, recording_get_observation
from object_positions import get_object_positions

def run_skeleton_task():
    '''Generic skeleton for running any task in your simulation.'''
    print("===== Starting Skeleton Task =====")
    
    # === Environment Setup ===
    env, task = setup_environment()
    try:
        # Reset the task to its initial state
        _, obs = task.reset()

        # (Optional) Initialize video writers for capturing your simulation
        init_video_writers(obs)

        # Wrap the task steps for recording (if needed)
        original_step = task.step
        task.step = recording_step(original_step)
        original_get_obs = task.get_observation
        task.get_observation = recording_get_observation(original_get_obs)

        # === Retrieve Object Positions ===
        positions = get_object_positions()

        # Define object positions
        rubbish_pos = positions['rubbish']
        bin_pos = positions['bin']
        bottom_anchor_pos = positions['bottom_anchor_pos']

        # === Execute the Plan ===
        # Step 1: Rotate the gripper to ninety degrees
        print("[Task] Rotating gripper to ninety degrees.")
        obs, reward, done = rotate(env, task, target_quat=np.array([0, 0, 1, 0]), max_steps=100, threshold=0.05, timeout=10.0)
        if done:
            print("[Task] Task ended after rotating gripper!")
            return

        # Step 2: Move to the side position of the bottom drawer
        print("[Task] Moving to side position of the bottom drawer.")
        obs, reward, done = move(env, task, target_pos=bottom_anchor_pos, max_steps=100, threshold=0.01, timeout=10.0)
        if done:
            print("[Task] Task ended after moving to side position!")
            return

        # Step 3: Move to the anchor position of the bottom drawer
        print("[Task] Moving to anchor position of the bottom drawer.")
        obs, reward, done = move(env, task, target_pos=bottom_anchor_pos, max_steps=100, threshold=0.01, timeout=10.0)
        if done:
            print("[Task] Task ended after moving to anchor position!")
            return

        # Step 4: Pick the bottom drawer
        print("[Task] Picking the bottom drawer.")
        obs, reward, done = pick(env, task, target_pos=bottom_anchor_pos, approach_distance=0.15, max_steps=100, threshold=0.01, approach_axis='z', timeout=10.0)
        if done:
            print("[Task] Task ended after picking the drawer!")
            return

        # Step 5: Pull the bottom drawer
        print("[Task] Pulling the bottom drawer.")
        obs, reward, done = pull(env, task, pull_distance=0.2, pull_axis='x', max_steps=100, threshold=0.01, timeout=10.0)
        if done:
            print("[Task] Task ended after pulling the drawer!")
            return

        # Step 6: Pick up the rubbish
        print("[Task] Picking up the rubbish.")
        obs, reward, done = pick(env, task, target_pos=rubbish_pos, approach_distance=0.15, max_steps=100, threshold=0.01, approach_axis='z', timeout=10.0)
        if done:
            print("[Task] Task ended after picking up the rubbish!")
            return

        # Step 7: Place the rubbish in the bin
        print("[Task] Placing the rubbish in the bin.")
        obs, reward, done = place(env, task, target_pos=bin_pos, approach_distance=0.15, max_steps=100, threshold=0.01, approach_axis='z', timeout=10.0)
        if done:
            print("[Task] Task completed successfully! Reward:", reward)
        else:
            print("[Task] Task not completed yet (done=False).")

    finally:
        # Always ensure the environment is properly shutdown
        shutdown_environment(env)

    print("===== End of Skeleton Task =====")

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

=== Instruction 4 ===
Is Correct: False
Syntax Pass: False
Code Function: The code defines a function to run a simulation task involving a robotic gripper. It begins by setting up the environment and resetting the task to its initial state. It optionally initializes video recording for the simulation. The function retrieves the positions of various objects in the environment, including a drawer and a bin.

The task consists of several key steps: first, the gripper rotates to a specific orientation. Next, it moves to the side position of a bottom drawer, followed by moving to the anchor position of the drawer. The gripper then picks up the drawer and pulls it open. After that, it picks up some rubbish and finally places the rubbish into a bin. 

Throughout the process, the function checks if each step is completed successfully and prints messages indicating the status of the task. At the end, it ensures that the environment is properly shut down. The function is executed when the script is run as the main program.
Similarity: {'ok': False, 'reason': 'LLM JSON parsing failed.'}
Differences: 1. **Purpose**: 
   - TASK describes a high-level instruction for a robotic task involving unlocking a cabinet and disposing of trash.
   - CODE_FUNC outlines a specific implementation of a simulation task for a robotic gripper, detailing the steps and checks involved in executing the task.

2. **Level of Abstraction**:
   - TASK is an abstract instruction that does not specify how the actions are to be performed.
   - CODE_FUNC provides a concrete implementation with specific actions, checks, and environment setup.

3. **Detailing of Actions**:
   - TASK mentions actions like "unlocking the cabinet" and "throwing away the trash" without detailing how these actions are executed.
   - CODE_FUNC breaks down the actions into specific steps, such as rotating the gripper, moving to positions, picking up the drawer, and placing rubbish into a bin.

4. **Environment Setup**:
   - TASK does not describe the initial state or setup of the environment.
   - CODE_FUNC includes details about initializing the environment, resetting the task, and optionally starting video recording.

5. **Feedback Mechanism**:
   - TASK does not include any feedback or status checking during the execution of the actions.
   - CODE_FUNC includes checks for successful completion of each step and prints messages indicating the status of the task.

6. **Execution Context**:
   - TASK is a standalone instruction that can be interpreted in various contexts.
   - CODE_FUNC is designed to be executed within a specific programming environment, particularly when the script is run as the main program.

7. **Error Handling**:
   - TASK does not address error handling or contingencies.
   - CODE_FUNC implies a structured approach to ensure that each step is completed successfully, suggesting a form of error handling through status checks.

8. **Output**:
   - TASK does not specify any output or result from the actions taken.
   - CODE_FUNC may produce output in the form of printed messages indicating the status of the task and the successful execution of steps.

9. **Focus on Implementation**:
   - TASK focuses on what needs to be done without detailing how.
   - CODE_FUNC focuses on how to implement the task, including specific functions and methods to achieve the desired outcome.

10. **Programming Constructs**:
    - TASK does not use any programming constructs or syntax.
    - CODE_FUNC uses programming constructs such as functions, parameters, and control flow to define the task execution.

In summary, the semantic differences between TASK and CODE_FUNC are significant, as TASK provides a high-level overview of a task while CODE_FUNC details the implementation and execution of that task in a programming context.

Refined Code Generated:
-------------------
import numpy as np
from env import setup_environment, shutdown_environment
from skill_code import *
from video import init_video_writers, recording_step, recording_get_observation
from object_positions import get_object_positions

def run_skeleton_task():
    '''Generic skeleton for running any task in your simulation.'''
    print("===== Starting Skeleton Task =====")
    
    # === Environment Setup ===
    env, task = setup_environment()
    try:
        # Reset the task to its initial state
        _, obs = task.reset()

        # (Optional) Initialize video writers for capturing your simulation
        init_video_writers(obs)

        # Wrap the task steps for recording (if needed)
        original_step = task.step
        task.step = recording_step(original_step)
        original_get_obs = task.get_observation
        task.get_observation = recording_get_observation(original_get_obs)

        # === Retrieve Object Positions ===
        positions = get_object_positions()

        # Define object positions
        bottom_anchor_pos = positions['bottom_anchor_pos']
        bottom_side_pos = positions['bottom_side_pos']
        rubbish_pos = positions['rubbish']
        bin_pos = positions['bin']

        # === Execute the Plan ===
        # Step 1: Rotate the gripper to the correct orientation (90 degrees)
        obs, reward, done = rotate(env, task, target_quat=np.array([0, 0, 1, 0]), 
                                   max_steps=100, threshold=0.05, timeout=10.0)
        if done:
            print("[Task] Task ended after rotating!")
            return

        # Step 2: Move to the side position of the bottom drawer
        obs, reward, done = move(env, task, bottom_side_pos, 
                                 max_steps=100, threshold=0.01, timeout=10.0)
        if done:
            print("[Task] Task ended after moving to side position!")
            return

        # Step 3: Move to the anchor position of the bottom drawer
        obs, reward, done = move(env, task, bottom_anchor_pos, 
                                 max_steps=100, threshold=0.01, timeout=10.0)
        if done:
            print("[Task] Task ended after moving to anchor position!")
            return

        # Step 4: Pick the bottom drawer
        obs, reward, done = pick_drawer(env, task, 'gripper', 'bottom', bottom_anchor_pos)
        if done:
            print("[Task] Task ended after picking the drawer!")
            return

        # Step 5: Pull the drawer to open it
        obs, reward, done = pull(env, task, pull_distance=0.1, pull_axis='x', 
                                 max_steps=100, threshold=0.01, timeout=10.0)
        if done:
            print("[Task] Task ended after pulling the drawer!")
            return

        # Step 6: Pick the rubbish
        obs, reward, done = pick(env, task, rubbish_pos, 'gripper')
        if done:
            print("[Task] Task ended after picking the rubbish!")
            return

        # Step 7: Place the rubbish in the bin
        obs, reward, done = place(env, task, bin_pos, 'gripper')
        if done:
            print("[Task] Task completed successfully! Reward:", reward)
            return

    finally:
        # Always ensure the environment is properly shutdown
        shutdown_environment(env)

    print("===== End of Skeleton Task =====")

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

=== Instruction 5 ===
Is Correct: False
Syntax Pass: False
Code Function: The code defines a function to run a simulation task involving a robotic gripper. It begins by setting up the environment and resetting the task to its initial state. It optionally initializes video recording for the simulation. The function retrieves the positions of various objects in the environment, including a drawer and rubbish.

The task consists of several key steps: first, the gripper is rotated to a specified orientation. Next, the gripper moves to the side position of a bottom drawer, followed by moving to the anchor position of the drawer. The gripper then picks up the bottom drawer and pulls it open. After that, the gripper picks up rubbish from a table and finally places the rubbish into a bin.

Throughout the process, the function checks if each step is completed successfully, printing messages to indicate the status of the task. At the end of the task, the environment is properly shut down. The function concludes by indicating the end of the task execution.
Similarity: {'ok': False, 'reason': 'LLM JSON parsing failed.'}
Differences: 1. **Purpose**: 
   - **TASK**: Describes a specific instruction for a robot to perform a sequence of actions involving a drawer and rubbish.
   - **CODE_FUNC**: Describes a function that implements a simulation of the task, detailing the setup, execution, and completion of the task.

2. **Level of Detail**:
   - **TASK**: Provides a high-level overview of the actions to be performed without implementation specifics.
   - **CODE_FUNC**: Includes detailed steps of the implementation, such as initializing the environment, checking the status of actions, and managing video recording.

3. **Context**:
   - **TASK**: Focuses on the actions to be taken in a physical or simulated environment.
   - **CODE_FUNC**: Focuses on the programming and simulation aspects, including function definitions and environment management.

4. **Action Sequence**:
   - **TASK**: Lists actions in a straightforward manner (slide open drawer, chuck away rubbish).
   - **CODE_FUNC**: Describes a more complex sequence of actions, including rotations, movements to specific positions, and checks for successful completion.

5. **Output**:
   - **TASK**: Does not specify any output or feedback mechanism.
   - **CODE_FUNC**: Mentions printing messages to indicate the status of the task, providing feedback during execution.

6. **Initialization**:
   - **TASK**: Assumes the environment is already set up and does not mention initialization.
   - **CODE_FUNC**: Explicitly includes steps for setting up the environment and resetting the task state.

7. **Error Handling**:
   - **TASK**: Does not address error handling or success checks.
   - **CODE_FUNC**: Implies checks for successful completion of each step, indicating a focus on robustness in execution.

8. **End of Execution**:
   - **TASK**: Does not mention how the task concludes.
   - **CODE_FUNC**: Specifies that the environment is properly shut down at the end of the task.

9. **Simulation Aspect**:
   - **TASK**: Does not indicate whether the actions are to be performed in a real or simulated environment.
   - **CODE_FUNC**: Clearly states that it is running a simulation task.

10. **Functionality**:
    - **TASK**: Focuses solely on the actions to be performed.
    - **CODE_FUNC**: Encompasses the entire functionality of setting up, executing, and concluding a simulation task.

In summary, the semantic differences between TASK and CODE_FUNC are significant, as TASK is an abstract instruction set while CODE_FUNC is a detailed implementation of those instructions in a programming context.

Refined Code Generated:
-------------------
import numpy as np
from pyrep.objects.shape import Shape
from pyrep.objects.proximity_sensor import ProximitySensor

from env import setup_environment, shutdown_environment

from skill_code import *
from video import init_video_writers, recording_step, recording_get_observation
from object_positions import get_object_positions

def run_skeleton_task():
    '''Generic skeleton for running any task in your simulation.'''
    print("===== Starting Skeleton Task =====")
    
    # === Environment Setup ===
    env, task = setup_environment()
    try:
        # Reset the task to its initial state
        _, obs = task.reset()

        # (Optional) Initialize video writers for capturing your simulation
        init_video_writers(obs)

        # Wrap the task steps for recording (if needed)
        original_step = task.step
        task.step = recording_step(original_step)
        original_get_obs = task.get_observation
        task.get_observation = recording_get_observation(original_get_obs)

        # === Retrieve Object Positions ===
        positions = get_object_positions()

        # Define object positions
        bottom_anchor_pos = positions['bottom_anchor_pos']
        bottom_side_pos = positions['bottom_side_pos']
        rubbish_pos = positions['rubbish']
        bin_pos = positions['bin']

        # === Execute the Plan ===
        # Step 1: Rotate the gripper to the correct orientation (not specified, assuming zero_deg)
        obs, reward, done = rotate(env, task, target_quat=np.array([0, 0, 0, 1]))  # Assuming no rotation needed
        if done:
            print("[Task] Task ended after rotating!")
            return

        # Step 2: Move to the side position of the bottom drawer
        obs, reward, done = move(env, task, target_pos=bottom_side_pos)
        if done:
            print("[Task] Task ended after moving to side position!")
            return

        # Step 3: Move to the anchor position of the bottom drawer
        obs, reward, done = move(env, task, target_pos=bottom_anchor_pos)
        if done:
            print("[Task] Task ended after moving to anchor position!")
            return

        # Step 4: Pick the bottom drawer
        obs, reward, done = pick_drawing(env, task, gripper='gripper', d='bottom', p=bottom_anchor_pos)
        if done:
            print("[Task] Task ended after picking the drawer!")
            return

        # Step 5: Pull the bottom drawer open
        obs, reward, done = pull(env, task, pull_distance=0.1)  # Assuming a pull distance of 0.1
        if done:
            print("[Task] Task ended after pulling the drawer!")
            return

        # Step 6: Pick the rubbish from the table
        obs, reward, done = pick(env, task, target_pos=rubbish_pos)
        if done:
            print("[Task] Task ended after picking rubbish!")
            return

        # Step 7: Place the rubbish in the bin
        obs, reward, done = place(env, task, target_pos=bin_pos)
        if done:
            print("[Task] Task completed successfully! Reward:", reward)
        else:
            print("[Task] Task not completed yet (done=False).")

    finally:
        # Always ensure the environment is properly shutdown
        shutdown_environment(env)

    print("===== End of Skeleton Task =====")

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

