# Open-loop trajectory-fit action2code policy generated from the RoboCasa GT EE trajectory
# Task: TurnOnToasterOven
# Episode: episode_000000

from primitives import moveJoint, moveLinear, moveC, moveA, moveWholeBodyPath, moveActionSequence, grasp, release, wait

SCENE_ARTIFACT = '../../../artifacts/20260324/TurnOnToasterOven/20260324_205349_turn-on-toaster-oven_episode_000000_action2code-open-loop-joint_initial-scene.json'
POLICY_METADATA = {
    'policy_kind': 'open_loop_joint',
    'policy_variant': 'open-loop-joint',
    'task_name': 'TurnOnToasterOven',
    'episode_id': 'episode_000000',
    'scene_artifact_path': '../../../artifacts/20260324/TurnOnToasterOven/20260324_205349_turn-on-toaster-oven_episode_000000_action2code-open-loop-joint_initial-scene.json',
    'fitting_summary_path': '../../../artifacts/20260324/TurnOnToasterOven/20260324_205349_turn-on-toaster-oven_episode_000000_action2code-open-loop-joint_fitting-summary.json',
    'extracted_pose_metadata_path': '../../../artifacts/20260324/TurnOnToasterOven/20260324_205349_turn-on-toaster-oven_episode_000000_action2code-open-loop-joint_extracted-pose-metadata.json',
    'stable_grasp_contact_t': 255,
    'stable_release_contact_loss_t': 255,
    'uses_moveC': False,
    'controller_mode': 'whole_body_ik',
}

OBJ_POSE_T0 = pose(x=float('nan'), y=float('nan'), z=float('nan'), qw=float('nan'), qx=float('nan'), qy=float('nan'), qz=float('nan'))
GOAL_RECEPTACLE_POSE = pose(x=float('nan'), y=float('nan'), z=float('nan'), qw=float('nan'), qx=float('nan'), qy=float('nan'), qz=float('nan'))

APPROACH_002_JOINTS = [-0.014275, -1.037088, -0.051844, -2.290239, 0.034445, 1.527374, 0.690802]  # t=2
APPROACH_004_JOINTS = [-0.015865, -1.038252, -0.066546, -2.290465, 0.024704, 1.533886, 0.673867]  # t=4
APPROACH_005_JOINTS = [-0.016956, -1.042308, -0.077730, -2.292885, 0.018540, 1.545247, 0.660075]  # t=5
APPROACH_010_JOINTS = [-0.026548, -1.154420, -0.140355, -2.373455, -0.031011, 1.673531, 0.543180]  # t=10
APPROACH_013_JOINTS = [-0.038653, -1.296740, -0.165128, -2.485525, -0.076984, 1.784688, 0.469339]  # t=13
APPROACH_015_JOINTS = [-0.049424, -1.409092, -0.184919, -2.575799, -0.106318, 1.854359, 0.422264]  # t=15
APPROACH_017_JOINTS = [-0.061592, -1.519742, -0.208646, -2.658687, -0.129199, 1.911309, 0.384691]  # t=17
APPROACH_020_JOINTS = [-0.084664, -1.653837, -0.276450, -2.756124, -0.170654, 1.987330, 0.341792]  # t=20
APPROACH_024_JOINTS = [-0.125114, -1.765625, -0.406645, -2.832545, -0.246353, 2.073028, 0.281878]  # t=24
APPROACH_025_JOINTS = [-0.135443, -1.763536, -0.440164, -2.832278, -0.256834, 2.086807, 0.265299]  # t=25
APPROACH_028_JOINTS = [-0.162744, -1.760210, -0.530146, -2.820507, -0.270346, 2.106962, 0.216851]  # t=28
APPROACH_030_JOINTS = [-0.177473, -1.752575, -0.577547, -2.812278, -0.271731, 2.115731, 0.190522]  # t=30
APPROACH_031_JOINTS = [-0.183672, -1.746714, -0.595847, -2.808338, -0.269980, 2.119323, 0.180030]  # t=31
APPROACH_035_JOINTS = [-0.200588, -1.709398, -0.648590, -2.792200, -0.246872, 2.138766, 0.154674]  # t=35
APPROACH_040_JOINTS = [-0.205694, -1.634081, -0.678083, -2.745821, -0.193663, 2.133689, 0.156194]  # t=40
APPROACH_045_JOINTS = [-0.195319, -1.543175, -0.680672, -2.670778, -0.131836, 2.096507, 0.171479]  # t=45
APPROACH_050_JOINTS = [-0.180530, -1.465252, -0.688645, -2.591660, -0.077515, 2.049061, 0.181778]  # t=50
APPROACH_051_JOINTS = [-0.177024, -1.450429, -0.691306, -2.577647, -0.068661, 2.041547, 0.184107]  # t=51
APPROACH_054_JOINTS = [-0.164313, -1.404658, -0.696478, -2.545129, -0.050074, 2.036351, 0.186816]  # t=54
APPROACH_055_JOINTS = [-0.160444, -1.391133, -0.695187, -2.539421, -0.046640, 2.041473, 0.187442]  # t=55
APPROACH_056_JOINTS = [-0.157204, -1.379398, -0.693157, -2.536127, -0.045508, 2.047558, 0.185285]  # t=56
APPROACH_059_JOINTS = [-0.155243, -1.359766, -0.691412, -2.537085, -0.060446, 2.060744, 0.157272]  # t=59
APPROACH_060_JOINTS = [-0.157715, -1.356847, -0.691862, -2.541758, -0.075065, 2.062203, 0.144479]  # t=60
APPROACH_063_JOINTS = [-0.171603, -1.360028, -0.695986, -2.565846, -0.125017, 2.066646, 0.109157]  # t=63
APPROACH_065_JOINTS = [-0.186737, -1.375882, -0.702741, -2.592082, -0.157322, 2.067880, 0.085077]  # t=65
APPROACH_067_JOINTS = [-0.207012, -1.398749, -0.719557, -2.625391, -0.191454, 2.066488, 0.066363]  # t=67
APPROACH_070_JOINTS = [-0.233125, -1.424124, -0.761238, -2.691499, -0.230067, 2.092696, 0.045455]  # t=70
APPROACH_072_JOINTS = [-0.256140, -1.462081, -0.793059, -2.746025, -0.230728, 2.122928, 0.018994]  # t=72
APPROACH_075_JOINTS = [-0.301134, -1.525427, -0.875527, -2.829797, -0.229174, 2.202062, -0.050639]  # t=75
APPROACH_076_JOINTS = [-0.317763, -1.541272, -0.900978, -2.856900, -0.233299, 2.224702, -0.073279]  # t=76
APPROACH_079_JOINTS = [-0.358059, -1.568443, -0.952047, -2.919070, -0.229746, 2.285097, -0.130453]  # t=79
APPROACH_080_JOINTS = [-0.367233, -1.569763, -0.958014, -2.934596, -0.225459, 2.301514, -0.142914]  # t=80
APPROACH_082_JOINTS = [-0.376456, -1.560774, -0.959644, -2.963446, -0.212004, 2.345351, -0.160559]  # t=82
APPROACH_085_JOINTS = [-0.373406, -1.537752, -0.960212, -2.996745, -0.161957, 2.423956, -0.183426]  # t=85
APPROACH_090_JOINTS = [-0.348792, -1.513958, -1.060527, -2.998502, 0.006594, 2.517763, -0.346333]  # t=90
APPROACH_093_JOINTS = [-0.318822, -1.491908, -1.103679, -2.985133, 0.112298, 2.540860, -0.435834]  # t=93
APPROACH_095_JOINTS = [-0.284524, -1.468817, -1.110857, -2.983125, 0.175735, 2.557389, -0.483353]  # t=95
APPROACH_097_JOINTS = [-0.235460, -1.437959, -1.111525, -2.976452, 0.235309, 2.575744, -0.531752]  # t=97
APPROACH_100_JOINTS = [-0.173818, -1.394773, -1.104952, -2.950336, 0.305802, 2.591693, -0.582554]  # t=100
APPROACH_105_JOINTS = [-0.118103, -1.339765, -1.107014, -2.900056, 0.372526, 2.586653, -0.643309]  # t=105
APPROACH_110_JOINTS = [-0.091378, -1.308921, -1.106197, -2.874565, 0.412623, 2.581175, -0.677380]  # t=110
APPROACH_112_JOINTS = [-0.082442, -1.299806, -1.103534, -2.869362, 0.425566, 2.584318, -0.686086]  # t=112
APPROACH_115_JOINTS = [-0.054272, -1.282688, -1.095597, -2.862206, 0.452140, 2.607372, -0.699546]  # t=115
APPROACH_120_JOINTS = [-0.002051, -1.257356, -1.089025, -2.848849, 0.493987, 2.649352, -0.723431]  # t=120
APPROACH_125_JOINTS = [0.063077, -1.232805, -1.086232, -2.831515, 0.535643, 2.698977, -0.746782]  # t=125
APPROACH_126_JOINTS = [0.073988, -1.229418, -1.087406, -2.828086, 0.541982, 2.707185, -0.751268]  # t=126
APPROACH_130_JOINTS = [0.114024, -1.216518, -1.096583, -2.810511, 0.558767, 2.733375, -0.765978]  # t=130
APPROACH_133_JOINTS = [0.141044, -1.208649, -1.105368, -2.796323, 0.564849, 2.747089, -0.773099]  # t=133
APPROACH_135_JOINTS = [0.155996, -1.205086, -1.112617, -2.786930, 0.565832, 2.753334, -0.776415]  # t=135
APPROACH_140_JOINTS = [0.186795, -1.197531, -1.134362, -2.764509, 0.560787, 2.761594, -0.781871]  # t=140
APPROACH_145_JOINTS = [0.211551, -1.195826, -1.156182, -2.752519, 0.552757, 2.766852, -0.788045]  # t=145
APPROACH_150_JOINTS = [0.251534, -1.191310, -1.171004, -2.740350, 0.551221, 2.789793, -0.790776]  # t=150
APPROACH_155_JOINTS = [0.292154, -1.191410, -1.191477, -2.732700, 0.548523, 2.818604, -0.797091]  # t=155
APPROACH_160_JOINTS = [0.318796, -1.200047, -1.247557, -2.733719, 0.531727, 2.840173, -0.826329]  # t=160
APPROACH_165_JOINTS = [0.348061, -1.216543, -1.302863, -2.729119, 0.504481, 2.856030, -0.851322]  # t=165
APPROACH_170_JOINTS = [0.376822, -1.231479, -1.329819, -2.714672, 0.466947, 2.866667, -0.839880]  # t=170
APPROACH_175_JOINTS = [0.411519, -1.242859, -1.344340, -2.702992, 0.429712, 2.886060, -0.813952]  # t=175
APPROACH_180_JOINTS = [0.473032, -1.251148, -1.360742, -2.680690, 0.397027, 2.921980, -0.787335]  # t=180
APPROACH_185_JOINTS = [0.537764, -1.261634, -1.380454, -2.658417, 0.358699, 2.962866, -0.758358]  # t=185
APPROACH_190_JOINTS = [0.586317, -1.277051, -1.412838, -2.638535, 0.308361, 2.993254, -0.732601]  # t=190
APPROACH_195_JOINTS = [0.633179, -1.293921, -1.447456, -2.615994, 0.251404, 3.014608, -0.705910]  # t=195
APPROACH_200_JOINTS = [0.680104, -1.312201, -1.483380, -2.596218, 0.194325, 3.037105, -0.680805]  # t=200
APPROACH_205_JOINTS = [0.720713, -1.332082, -1.519619, -2.581650, 0.138614, 3.060360, -0.659229]  # t=205
APPROACH_209_JOINTS = [0.749348, -1.347559, -1.543826, -2.570012, 0.095851, 3.078469, -0.641877]  # t=209
PRESS_211_JOINTS = [0.757626, -1.353259, -1.551427, -2.561964, 0.075066, 3.089289, -0.631008]  # t=211
PRESS_213_JOINTS = [0.764294, -1.357733, -1.558137, -2.554502, 0.055178, 3.097487, -0.619290]  # t=213
PRESS_214_JOINTS = [0.767454, -1.359725, -1.561284, -2.550908, 0.045636, 3.101290, -0.613447]  # t=214
PRESS_215_JOINTS = [0.770499, -1.361610, -1.564379, -2.547199, 0.036392, 3.105021, -0.607721]  # t=215
PRESS_217_JOINTS = [0.778062, -1.365193, -1.571045, -2.536583, 0.018919, 3.111789, -0.596769]  # t=217
PRESS_219_JOINTS = [0.783731, -1.368850, -1.577033, -2.526500, 0.002495, 3.115190, -0.586846]  # t=219
PRESS_221_JOINTS = [0.785204, -1.371933, -1.580209, -2.525581, -0.012222, 3.118722, -0.575471]  # t=221
PRESS_223_JOINTS = [0.784631, -1.374010, -1.582053, -2.528898, -0.025695, 3.122458, -0.564594]  # t=223
PRESS_225_JOINTS = [0.784318, -1.375511, -1.583819, -2.531243, -0.037608, 3.125839, -0.554800]  # t=225
PRESS_227_JOINTS = [0.784180, -1.377053, -1.585489, -2.532778, -0.047979, 3.128415, -0.546455]  # t=227
PRESS_229_JOINTS = [0.783842, -1.379210, -1.586973, -2.534648, -0.056905, 3.131098, -0.539729]  # t=229
PRESS_231_JOINTS = [0.782878, -1.380894, -1.587969, -2.537990, -0.064414, 3.134489, -0.533286]  # t=231
PRESS_233_JOINTS = [0.780443, -1.385888, -1.588403, -2.544627, -0.068577, 3.139304, -0.524647]  # t=233
PRESS_235_JOINTS = [0.775378, -1.394994, -1.587435, -2.556639, -0.067542, 3.145066, -0.507837]  # t=235
PRESS_237_JOINTS = [0.769840, -1.406124, -1.585458, -2.568200, -0.062168, 3.147855, -0.483060]  # t=237
PRESS_239_JOINTS = [0.765967, -1.414781, -1.583523, -2.573932, -0.055451, 3.145897, -0.456428]  # t=239
PRESS_241_JOINTS = [0.764151, -1.417896, -1.581779, -2.574301, -0.048096, 3.142137, -0.428673]  # t=241
PRESS_243_JOINTS = [0.762000, -1.416457, -1.578987, -2.573665, -0.040021, 3.134760, -0.399486]  # t=243
PRESS_245_JOINTS = [0.759410, -1.412521, -1.575285, -2.573596, -0.030722, 3.127264, -0.368996]  # t=245
PRESS_247_JOINTS = [0.756928, -1.405086, -1.570864, -2.571896, -0.020049, 3.116594, -0.336341]  # t=247
PRESS_249_JOINTS = [0.754501, -1.393746, -1.565773, -2.567942, -0.008121, 3.101229, -0.301410]  # t=249
PRESS_250_JOINTS = [0.753188, -1.387273, -1.562991, -2.565545, -0.001620, 3.092316, -0.283345]  # t=250
PRESS_251_JOINTS = [0.751663, -1.380503, -1.559978, -2.563012, 0.005233, 3.082305, -0.265011]  # t=251
PRESS_253_JOINTS = [0.748170, -1.366894, -1.553462, -2.558058, 0.020168, 3.061234, -0.227925]  # t=253
PRESS_255_JOINTS = [0.744683, -1.355804, -1.547026, -2.552822, 0.037438, 3.039613, -0.191633]  # t=255
PRESS_257_JOINTS = [0.741084, -1.349029, -1.540724, -2.547471, 0.057789, 3.017091, -0.156873]  # t=257
PRESS_259_JOINTS = [0.737380, -1.351097, -1.534988, -2.543198, 0.083448, 2.996825, -0.125502]  # t=259
PRESS_261_JOINTS = [0.733655, -1.358679, -1.530040, -2.539712, 0.112717, 2.979843, -0.098029]  # t=261
PRESS_262_JOINTS = [0.731016, -1.364416, -1.527110, -2.539236, 0.128563, 2.972561, -0.085734]  # t=262
PRESS_263_JOINTS = [0.728966, -1.370289, -1.525119, -2.537607, 0.144543, 2.964938, -0.074483]  # t=263
PRESS_264_JOINTS = [0.727243, -1.376553, -1.523723, -2.535397, 0.160739, 2.957311, -0.064413]  # t=264
PRESS_265_JOINTS = [0.725965, -1.382761, -1.522790, -2.533237, 0.177004, 2.951369, -0.055141]  # t=265
PRESS_267_JOINTS = [0.724625, -1.393247, -1.521642, -2.528750, 0.209022, 2.942474, -0.036460]  # t=267
PRESS_269_JOINTS = [0.724919, -1.399250, -1.521994, -2.522824, 0.238403, 2.934651, -0.017084]  # t=269
PRESS_270_JOINTS = [0.725315, -1.400681, -1.522395, -2.519662, 0.251931, 2.930772, -0.007091]  # t=270
APPROACH_000_JOINTS = [-0.013751, -1.037136, -0.048939, -2.290316, 0.037213, 1.527349, 0.693090]  # t=1

# Phase-level helper functions keep the open-loop policy readable while preserving
# the exact primitive execution order used at runtime.

def move_to_control_panel():
    """Approach the appliance control region."""
    moveJoint(APPROACH_000_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_002_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_004_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_005_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_010_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_013_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_015_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_017_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_020_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_024_JOINTS, input_type='joint', steps=4, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_025_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_028_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_030_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_031_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_035_JOINTS, input_type='joint', steps=4, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_040_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_045_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_050_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_051_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_054_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_055_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_056_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_059_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_060_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_063_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_065_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_067_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_070_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_072_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_075_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_076_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_079_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_080_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_082_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_085_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_090_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_093_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_095_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_097_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_100_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_105_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_110_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_112_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_115_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_120_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_125_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_126_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_130_JOINTS, input_type='joint', steps=4, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_133_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_135_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_140_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_145_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_150_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_155_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_160_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_165_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_170_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_175_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_180_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_185_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_190_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_195_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_200_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_205_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_209_JOINTS, input_type='joint', steps=4, settle_steps=0, gripper=-1.000)

def press_control():
    """Execute the short interaction path that actuates the control."""
    moveJoint(PRESS_211_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_213_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_214_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_215_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_217_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_219_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_221_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_223_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_225_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_227_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_229_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_231_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_233_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_235_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_237_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_239_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_241_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_243_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_245_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_247_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_249_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_250_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_251_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_253_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_255_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_257_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_259_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_261_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_262_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_263_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_264_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_265_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_267_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_269_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_270_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)

move_to_control_panel()
press_control()

# Fitting strategy:
# - adaptive per-phase waypoint selection on EE position + quaternion error
# - tight tolerances near descend / lift / place, looser tolerances in transport
# - optional moveC / moveA / segmented moveLinear chains / moveActionSequence when a segment is better represented by a smooth or constrained path
# - GT used only during generation; runtime execution uses this saved policy plus scene artifact

Turn on the toaster oven by setting the timer.


# Open-loop trajectory-fit action2code policy generated from the RoboCasa GT EE trajectory
# Task: TurnSinkSpout
# Episode: episode_000000

from primitives import moveJoint, moveLinear, moveC, moveA, moveWholeBodyPath, moveActionSequence, grasp, release, wait

SCENE_ARTIFACT = '../../../artifacts/20260324/TurnSinkSpout/20260324_205350_turn-sink-spout_episode_000000_action2code-open-loop-joint_initial-scene.json'
POLICY_METADATA = {
    'policy_kind': 'open_loop_joint',
    'policy_variant': 'open-loop-joint',
    'task_name': 'TurnSinkSpout',
    'episode_id': 'episode_000000',
    'scene_artifact_path': '../../../artifacts/20260324/TurnSinkSpout/20260324_205350_turn-sink-spout_episode_000000_action2code-open-loop-joint_initial-scene.json',
    'fitting_summary_path': '../../../artifacts/20260324/TurnSinkSpout/20260324_205350_turn-sink-spout_episode_000000_action2code-open-loop-joint_fitting-summary.json',
    'extracted_pose_metadata_path': '../../../artifacts/20260324/TurnSinkSpout/20260324_205350_turn-sink-spout_episode_000000_action2code-open-loop-joint_extracted-pose-metadata.json',
    'stable_grasp_contact_t': 87,
    'stable_release_contact_loss_t': 87,
    'uses_moveC': False,
    'controller_mode': 'whole_body_ik',
}

OBJ_POSE_T0 = pose(x=float('nan'), y=float('nan'), z=float('nan'), qw=float('nan'), qx=float('nan'), qy=float('nan'), qz=float('nan'))
GOAL_RECEPTACLE_POSE = pose(x=3.518606, y=-2.154615, z=0.945387, qw=0.446282, qx=-0.014680, qy=0.047569, qz=-0.893507)

APPROACH_002_JOINTS = [0.021817, -1.023278, -0.007162, -2.278152, 0.037389, 1.558019, 0.700498]  # t=2
APPROACH_003_JOINTS = [0.021010, -1.025053, -0.000117, -2.273938, 0.043399, 1.562177, 0.703289]  # t=3
APPROACH_004_JOINTS = [0.020243, -1.029154, 0.009532, -2.266018, 0.050681, 1.570403, 0.707843]  # t=4
APPROACH_007_JOINTS = [0.019865, -1.044065, 0.055238, -2.234205, 0.091524, 1.617211, 0.734227]  # t=7
APPROACH_008_JOINTS = [0.020163, -1.048889, 0.075840, -2.223166, 0.109354, 1.638786, 0.748233]  # t=8
APPROACH_010_JOINTS = [0.020482, -1.057370, 0.120878, -2.205329, 0.142574, 1.686864, 0.781491]  # t=10
APPROACH_012_JOINTS = [0.019895, -1.066187, 0.160698, -2.194778, 0.163820, 1.728395, 0.812001]  # t=12
APPROACH_013_JOINTS = [0.019560, -1.068830, 0.179220, -2.193687, 0.172221, 1.745579, 0.824715]  # t=13
APPROACH_016_JOINTS = [0.018571, -1.070055, 0.238319, -2.195329, 0.195033, 1.784893, 0.867614]  # t=16
APPROACH_020_JOINTS = [0.015524, -1.056266, 0.309818, -2.195766, 0.217557, 1.841611, 0.922989]  # t=20
APPROACH_021_JOINTS = [0.014546, -1.050753, 0.325044, -2.198442, 0.224147, 1.860815, 0.936620]  # t=21
APPROACH_024_JOINTS = [0.012451, -1.036887, 0.363788, -2.220629, 0.246776, 1.932409, 0.972770]  # t=24
APPROACH_027_JOINTS = [0.010233, -1.019717, 0.382143, -2.253500, 0.265413, 2.020101, 0.980403]  # t=27
APPROACH_028_JOINTS = [0.011402, -1.016861, 0.382523, -2.261760, 0.272247, 2.038832, 0.969491]  # t=28
APPROACH_030_JOINTS = [0.012715, -1.005034, 0.378153, -2.272919, 0.285823, 2.074734, 0.942766]  # t=30
APPROACH_032_JOINTS = [0.009061, -0.970750, 0.379160, -2.268737, 0.301048, 2.128746, 0.935696]  # t=32
APPROACH_036_JOINTS = [-0.003585, -0.883776, 0.403082, -2.219786, 0.302420, 2.196500, 0.949551]  # t=36
APPROACH_040_JOINTS = [-0.024258, -0.770526, 0.436306, -2.164777, 0.276797, 2.237090, 0.982403]  # t=40
APPROACH_042_JOINTS = [-0.031899, -0.741702, 0.444468, -2.154462, 0.253382, 2.228471, 1.011669]  # t=42
APPROACH_044_JOINTS = [-0.036921, -0.737280, 0.445108, -2.164764, 0.226061, 2.216351, 1.049625]  # t=44
APPROACH_048_JOINTS = [-0.046668, -0.720416, 0.460116, -2.212314, 0.177380, 2.249408, 1.133621]  # t=48
APPROACH_050_JOINTS = [-0.055266, -0.692056, 0.475419, -2.228621, 0.149074, 2.297838, 1.177566]  # t=50
APPROACH_052_JOINTS = [-0.063889, -0.653144, 0.495414, -2.228342, 0.122509, 2.347302, 1.215511]  # t=52
APPROACH_056_JOINTS = [-0.083918, -0.554466, 0.533892, -2.191420, 0.061056, 2.424093, 1.280319]  # t=56
APPROACH_060_JOINTS = [-0.104293, -0.451134, 0.565326, -2.148811, -0.018911, 2.470109, 1.350021]  # t=60
APPROACH_064_JOINTS = [-0.123545, -0.332157, 0.595258, -2.102318, -0.128763, 2.534935, 1.440308]  # t=64
APPROACH_068_JOINTS = [-0.130382, -0.210097, 0.620838, -1.996633, -0.258434, 2.538833, 1.538824]  # t=68
APPROACH_069_JOINTS = [-0.127880, -0.183119, 0.626699, -1.969794, -0.289268, 2.529912, 1.562428]  # t=69
APPROACH_072_JOINTS = [-0.106199, -0.138295, 0.644253, -1.913412, -0.348384, 2.470224, 1.637117]  # t=72
PRESS_074_JOINTS = [-0.086923, -0.115242, 0.645240, -1.886423, -0.363558, 2.444320, 1.666554]  # t=74
PRESS_076_JOINTS = [-0.065741, -0.104454, 0.638509, -1.878477, -0.359623, 2.437022, 1.679686]  # t=76
PRESS_078_JOINTS = [-0.045071, -0.092121, 0.627365, -1.871341, -0.347432, 2.453251, 1.684132]  # t=78
PRESS_079_JOINTS = [-0.034939, -0.083444, 0.623115, -1.866984, -0.344493, 2.467433, 1.691605]  # t=79
PRESS_080_JOINTS = [-0.025133, -0.073668, 0.619286, -1.863977, -0.345341, 2.484969, 1.703343]  # t=80
PRESS_081_JOINTS = [-0.015680, -0.064727, 0.615437, -1.862956, -0.350149, 2.508559, 1.719014]  # t=81
PRESS_082_JOINTS = [-0.006614, -0.057521, 0.611034, -1.867061, -0.357396, 2.538390, 1.737048]  # t=82
PRESS_084_JOINTS = [0.010102, -0.045763, 0.599974, -1.885616, -0.376530, 2.618599, 1.774431]  # t=84
PRESS_086_JOINTS = [0.024610, -0.035336, 0.585609, -1.904890, -0.394659, 2.710345, 1.818562]  # t=86
PRESS_087_JOINTS = [0.031275, -0.027554, 0.578430, -1.913289, -0.405220, 2.755105, 1.840897]  # t=87
PRESS_088_JOINTS = [0.037730, -0.017050, 0.571736, -1.918319, -0.417251, 2.798504, 1.864591]  # t=88
PRESS_090_JOINTS = [0.050678, 0.011544, 0.559648, -1.915875, -0.446681, 2.875777, 1.918560]  # t=90
PRESS_091_JOINTS = [0.057390, 0.028036, 0.553176, -1.911293, -0.466579, 2.910120, 1.946430]  # t=91
PRESS_092_JOINTS = [0.064534, 0.045307, 0.545916, -1.905097, -0.490527, 2.941826, 1.974538]  # t=92
PRESS_094_JOINTS = [0.081349, 0.081848, 0.529004, -1.885578, -0.547130, 2.997437, 2.033016]  # t=94
PRESS_096_JOINTS = [0.103007, 0.120855, 0.506952, -1.857579, -0.612256, 3.043134, 2.094216]  # t=96
PRESS_097_JOINTS = [0.116191, 0.140570, 0.493675, -1.840353, -0.646275, 3.060951, 2.126072]  # t=97
PRESS_098_JOINTS = [0.130815, 0.157112, 0.478731, -1.824069, -0.679725, 3.074367, 2.159088]  # t=98
PRESS_100_JOINTS = [0.163841, 0.183927, 0.445731, -1.791966, -0.741240, 3.087348, 2.225500]  # t=100
PRESS_101_JOINTS = [0.181314, 0.193423, 0.428377, -1.778165, -0.768702, 3.088173, 2.256908]  # t=101
PRESS_102_JOINTS = [0.198816, 0.200417, 0.411054, -1.765900, -0.793678, 3.086582, 2.286972]  # t=102
APPROACH_000_JOINTS = [0.022622, -1.023282, -0.011191, -2.278173, 0.033250, 1.557661, 0.699607]  # t=1

# Phase-level helper functions keep the open-loop policy readable while preserving
# the exact primitive execution order used at runtime.

def move_to_control_panel():
    """Approach the appliance control region."""
    moveJoint(APPROACH_000_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_002_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_003_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_004_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_007_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_008_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_010_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_012_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_013_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_016_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_020_JOINTS, input_type='joint', steps=4, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_021_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_024_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_027_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_028_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_030_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_032_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_036_JOINTS, input_type='joint', steps=4, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_040_JOINTS, input_type='joint', steps=4, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_042_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_044_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_048_JOINTS, input_type='joint', steps=4, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_050_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_052_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_056_JOINTS, input_type='joint', steps=4, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_060_JOINTS, input_type='joint', steps=4, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_064_JOINTS, input_type='joint', steps=4, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_068_JOINTS, input_type='joint', steps=4, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_069_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_072_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)

def press_control():
    """Execute the short interaction path that actuates the control."""
    moveJoint(PRESS_074_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_076_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_078_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_079_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_080_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_081_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_082_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_084_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_086_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_087_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_088_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_090_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_091_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_092_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_094_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_096_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_097_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_098_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_100_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_101_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_102_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)

move_to_control_panel()
press_control()

# Fitting strategy:
# - adaptive per-phase waypoint selection on EE position + quaternion error
# - tight tolerances near descend / lift / place, looser tolerances in transport
# - optional moveC / moveA / segmented moveLinear chains / moveActionSequence when a segment is better represented by a smooth or constrained path
# - GT used only during generation; runtime execution uses this saved policy plus scene artifact

all yogurt dairy packaged_food food in_container