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

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

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

OBJ_POSE_T0 = pose(x=3.149128, y=-0.265473, z=1.478171, qw=0.978128, qx=0.000644, qy=0.000257, qz=0.208002)
GOAL_RECEPTACLE_POSE = pose(x=4.047079, y=-1.508697, z=0.944131, qw=0.614641, qx=-0.000818, qy=0.002092, qz=-0.788804)

APPROACH_003_JOINTS = [-0.026157, -1.046815, -0.003491, -2.278298, 0.056282, 1.529987, 0.691812]  # t=3
APPROACH_004_JOINTS = [-0.025581, -1.063107, -0.004295, -2.277727, 0.056162, 1.531249, 0.691426]  # t=4
APPROACH_008_JOINTS = [-0.023377, -1.167921, -0.007226, -2.305562, 0.055946, 1.565481, 0.689100]  # t=8
APPROACH_010_JOINTS = [-0.022698, -1.234018, -0.009864, -2.321905, 0.054804, 1.605574, 0.685906]  # t=10
APPROACH_012_JOINTS = [-0.023433, -1.307223, -0.024229, -2.331334, 0.045580, 1.653901, 0.673787]  # t=12
APPROACH_015_JOINTS = [-0.024768, -1.379317, -0.056670, -2.313524, 0.032601, 1.729451, 0.643398]  # t=15
APPROACH_016_JOINTS = [-0.024895, -1.387941, -0.069625, -2.301228, 0.029851, 1.760798, 0.632108]  # t=16
APPROACH_018_JOINTS = [-0.024328, -1.392354, -0.104359, -2.271783, 0.030256, 1.832640, 0.609463]  # t=18
APPROACH_020_JOINTS = [-0.022083, -1.387383, -0.151189, -2.239280, 0.037492, 1.912805, 0.579216]  # t=20
APPROACH_023_JOINTS = [-0.013228, -1.375710, -0.230325, -2.185190, 0.070610, 2.034224, 0.504479]  # t=23
APPROACH_024_JOINTS = [-0.008656, -1.368864, -0.256368, -2.171720, 0.087808, 2.079069, 0.475362]  # t=24
APPROACH_025_JOINTS = [-0.003558, -1.361887, -0.281378, -2.166134, 0.106595, 2.126996, 0.444647]  # t=25
APPROACH_026_JOINTS = [0.001901, -1.354381, -0.304597, -2.167805, 0.126069, 2.175263, 0.413246]  # t=26
APPROACH_028_JOINTS = [0.012003, -1.339125, -0.342055, -2.184011, 0.161833, 2.253148, 0.356244]  # t=28
APPROACH_029_JOINTS = [0.016089, -1.331302, -0.354936, -2.194242, 0.176527, 2.282989, 0.332638]  # t=29
APPROACH_031_JOINTS = [0.024441, -1.305977, -0.369330, -2.211221, 0.201061, 2.332787, 0.296381]  # t=31
APPROACH_032_JOINTS = [0.029674, -1.290877, -0.373817, -2.216401, 0.215006, 2.354576, 0.279736]  # t=32
APPROACH_035_JOINTS = [0.049518, -1.242798, -0.387233, -2.222229, 0.264728, 2.416262, 0.224473]  # t=35
APPROACH_036_JOINTS = [0.056388, -1.225889, -0.390564, -2.222747, 0.280720, 2.434630, 0.207061]  # t=36
APPROACH_040_JOINTS = [0.079477, -1.150378, -0.393242, -2.217001, 0.327367, 2.506033, 0.162821]  # t=40
APPROACH_044_JOINTS = [0.104046, -1.061858, -0.392657, -2.201119, 0.367052, 2.572956, 0.132575]  # t=44
APPROACH_048_JOINTS = [0.129230, -0.977080, -0.393640, -2.172568, 0.407256, 2.625767, 0.104479]  # t=48
APPROACH_052_JOINTS = [0.156966, -0.887228, -0.397454, -2.136129, 0.452588, 2.676773, 0.072609]  # t=52
APPROACH_056_JOINTS = [0.183186, -0.812135, -0.410485, -2.091723, 0.502961, 2.694281, 0.032857]  # t=56
APPROACH_060_JOINTS = [0.217550, -0.730114, -0.439021, -2.025110, 0.580000, 2.685147, -0.034818]  # t=60
APPROACH_061_JOINTS = [0.224580, -0.716645, -0.452905, -2.009551, 0.602759, 2.677573, -0.056607]  # t=61
PRESS_062_JOINTS = [0.228944, -0.711371, -0.465695, -1.999340, 0.622984, 2.666460, -0.078137]  # t=62
PRESS_063_JOINTS = [0.230578, -0.711512, -0.468526, -1.996865, 0.638022, 2.658775, -0.093165]  # t=63
PRESS_065_JOINTS = [0.227962, -0.711824, -0.465064, -2.000045, 0.655728, 2.665211, -0.106101]  # t=65
PRESS_067_JOINTS = [0.222575, -0.711570, -0.457670, -2.006491, 0.666877, 2.682447, -0.110484]  # t=67
PRESS_068_JOINTS = [0.219646, -0.711095, -0.453635, -2.009918, 0.671314, 2.692745, -0.111338]  # t=68
PRESS_069_JOINTS = [0.216470, -0.710783, -0.449266, -2.013686, 0.674646, 2.703729, -0.111137]  # t=69
PRESS_070_JOINTS = [0.213187, -0.710549, -0.444712, -2.017519, 0.677041, 2.714653, -0.110088]  # t=70
PRESS_071_JOINTS = [0.209960, -0.710913, -0.440317, -2.021285, 0.678883, 2.723792, -0.108904]  # t=71
PRESS_073_JOINTS = [0.204440, -0.712155, -0.432846, -2.026941, 0.681787, 2.734529, -0.107263]  # t=73
PRESS_074_JOINTS = [0.202149, -0.712756, -0.429148, -2.029085, 0.682714, 2.737466, -0.106692]  # t=74
PRESS_075_JOINTS = [0.200310, -0.712847, -0.424096, -2.031027, 0.683449, 2.739639, -0.105462]  # t=75
PRESS_076_JOINTS = [0.198408, -0.713423, -0.418986, -2.033342, 0.683655, 2.741965, -0.103747]  # t=76
PRESS_077_JOINTS = [0.195810, -0.717268, -0.413496, -2.037734, 0.683052, 2.743043, -0.101584]  # t=77
PRESS_079_JOINTS = [0.186760, -0.738936, -0.400040, -2.056047, 0.675950, 2.742507, -0.093880]  # t=79
PRESS_081_JOINTS = [0.172113, -0.777532, -0.386900, -2.084956, 0.658580, 2.739869, -0.081878]  # t=81
PRESS_083_JOINTS = [0.154703, -0.827398, -0.372936, -2.120387, 0.635357, 2.735330, -0.066332]  # t=83
PRESS_085_JOINTS = [0.137543, -0.879241, -0.358567, -2.156323, 0.610335, 2.732124, -0.048240]  # t=85
PRESS_087_JOINTS = [0.122597, -0.928948, -0.345564, -2.190032, 0.586952, 2.731127, -0.031024]  # t=87
PRESS_089_JOINTS = [0.108931, -0.973927, -0.334052, -2.218796, 0.561699, 2.728141, -0.010857]  # t=89
PRESS_091_JOINTS = [0.095514, -1.013590, -0.324067, -2.242853, 0.533616, 2.722221, 0.016464]  # t=91
PRESS_093_JOINTS = [0.080623, -1.047829, -0.313139, -2.265138, 0.500657, 2.721437, 0.053109]  # t=93
PRESS_095_JOINTS = [0.064062, -1.080534, -0.300861, -2.287162, 0.463389, 2.723213, 0.095485]  # t=95
PRESS_097_JOINTS = [0.046852, -1.112368, -0.288368, -2.308189, 0.423970, 2.724660, 0.140424]  # t=97
PRESS_099_JOINTS = [0.029763, -1.143315, -0.276183, -2.327673, 0.384040, 2.724544, 0.186106]  # t=99
PRESS_101_JOINTS = [0.012905, -1.173225, -0.264773, -2.344503, 0.343931, 2.720184, 0.231360]  # t=101
PRESS_103_JOINTS = [-0.004233, -1.201968, -0.254340, -2.356310, 0.302825, 2.705245, 0.275429]  # t=103
PRESS_105_JOINTS = [-0.023094, -1.229190, -0.243757, -2.361486, 0.257664, 2.675882, 0.320757]  # t=105
PRESS_107_JOINTS = [-0.043701, -1.255233, -0.231236, -2.360180, 0.208190, 2.632785, 0.371492]  # t=107
PRESS_108_JOINTS = [-0.054201, -1.268041, -0.224032, -2.357355, 0.182563, 2.606945, 0.398971]  # t=108
PRESS_109_JOINTS = [-0.064678, -1.280631, -0.215773, -2.353050, 0.156281, 2.578205, 0.427793]  # t=109
PRESS_110_JOINTS = [-0.074829, -1.293029, -0.206073, -2.346158, 0.129833, 2.546865, 0.457819]  # t=110
PRESS_111_JOINTS = [-0.083870, -1.304427, -0.194508, -2.334183, 0.104543, 2.512679, 0.488239]  # t=111
PRESS_112_JOINTS = [-0.091645, -1.314064, -0.181566, -2.315063, 0.080095, 2.476032, 0.517434]  # t=112
PRESS_113_JOINTS = [-0.098115, -1.320649, -0.167327, -2.287939, 0.056406, 2.435226, 0.545713]  # t=113
PRESS_115_JOINTS = [-0.106938, -1.326568, -0.139036, -2.216579, 0.013552, 2.341036, 0.596677]  # t=115
PRESS_117_JOINTS = [-0.111025, -1.340781, -0.118486, -2.146292, -0.022702, 2.227784, 0.627609]  # t=117
PRESS_119_JOINTS = [-0.109555, -1.364722, -0.110931, -2.089461, -0.046533, 2.121501, 0.635103]  # t=119
PRESS_121_JOINTS = [-0.104410, -1.393943, -0.111622, -2.044998, -0.058602, 2.035094, 0.632988]  # t=121
PRESS_123_JOINTS = [-0.098815, -1.426844, -0.114382, -2.010526, -0.068027, 1.960761, 0.628726]  # t=123
PRESS_125_JOINTS = [-0.093559, -1.463213, -0.125038, -1.984337, -0.079740, 1.891873, 0.621248]  # t=125
PRESS_127_JOINTS = [-0.088354, -1.506431, -0.147561, -1.967986, -0.094472, 1.825066, 0.603318]  # t=127
PRESS_129_JOINTS = [-0.083726, -1.552637, -0.174942, -1.956853, -0.110063, 1.767686, 0.578269]  # t=129
PRESS_131_JOINTS = [-0.078031, -1.581542, -0.211193, -1.932952, -0.123780, 1.743399, 0.561490]  # t=131
PRESS_133_JOINTS = [-0.070801, -1.585832, -0.247860, -1.890477, -0.130337, 1.732165, 0.552235]  # t=133
PRESS_135_JOINTS = [-0.061070, -1.563395, -0.272802, -1.842604, -0.119449, 1.717790, 0.549220]  # t=135
PRESS_136_JOINTS = [-0.055360, -1.549316, -0.280667, -1.822996, -0.105055, 1.706676, 0.545464]  # t=136
PRESS_137_JOINTS = [-0.049951, -1.533215, -0.286540, -1.807230, -0.092508, 1.690001, 0.539042]  # t=137
PRESS_139_JOINTS = [-0.040609, -1.488353, -0.296466, -1.775978, -0.077879, 1.647799, 0.540007]  # t=139
PRESS_141_JOINTS = [-0.035008, -1.434240, -0.304274, -1.732428, -0.074199, 1.578104, 0.571854]  # t=141
PRESS_143_JOINTS = [-0.031327, -1.378237, -0.312712, -1.675167, -0.065450, 1.481778, 0.635979]  # t=143
PRESS_145_JOINTS = [-0.025819, -1.327889, -0.329778, -1.614079, -0.034713, 1.385061, 0.720218]  # t=145
PRESS_146_JOINTS = [-0.022050, -1.306560, -0.342786, -1.584707, -0.009808, 1.343430, 0.767389]  # t=146
PRESS_147_JOINTS = [-0.017999, -1.288459, -0.359142, -1.557464, 0.019339, 1.307874, 0.817188]  # t=147
PRESS_149_JOINTS = [-0.010350, -1.260826, -0.397801, -1.513950, 0.082959, 1.259442, 0.923506]  # t=149
PRESS_151_JOINTS = [-0.005091, -1.242708, -0.440171, -1.483604, 0.143841, 1.233633, 1.034797]  # t=151
PRESS_153_JOINTS = [-0.004835, -1.243134, -0.479440, -1.469681, 0.198875, 1.206704, 1.148605]  # t=153
PRESS_155_JOINTS = [-0.006846, -1.258569, -0.513965, -1.479566, 0.253312, 1.190374, 1.258726]  # t=155
PRESS_156_JOINTS = [-0.008295, -1.268634, -0.527886, -1.491890, 0.278620, 1.196697, 1.303372]  # t=156
PRESS_157_JOINTS = [-0.010086, -1.277315, -0.536910, -1.510138, 0.298374, 1.212351, 1.337464]  # t=157
PRESS_159_JOINTS = [-0.015536, -1.294397, -0.546152, -1.565987, 0.318180, 1.243362, 1.381483]  # t=159
PRESS_161_JOINTS = [-0.023935, -1.314832, -0.550274, -1.642121, 0.335201, 1.288401, 1.415331]  # t=161
PRESS_163_JOINTS = [-0.031154, -1.325489, -0.548803, -1.724694, 0.353153, 1.362228, 1.434042]  # t=163
PRESS_165_JOINTS = [-0.037242, -1.329313, -0.544630, -1.802042, 0.365089, 1.438119, 1.435596]  # t=165
PRESS_167_JOINTS = [-0.042080, -1.328375, -0.540644, -1.870924, 0.380115, 1.512355, 1.435031]  # t=167
PRESS_169_JOINTS = [-0.044862, -1.322701, -0.539110, -1.930916, 0.401429, 1.579576, 1.435729]  # t=169
PRESS_171_JOINTS = [-0.045135, -1.310449, -0.538188, -1.981392, 0.427736, 1.638613, 1.438385]  # t=171
PRESS_173_JOINTS = [-0.042563, -1.292031, -0.538419, -2.019463, 0.459354, 1.678360, 1.446895]  # t=173
PRESS_175_JOINTS = [-0.035469, -1.265432, -0.545356, -2.044469, 0.498412, 1.694556, 1.464329]  # t=175
PRESS_177_JOINTS = [-0.023510, -1.229238, -0.557611, -2.058791, 0.547665, 1.698378, 1.490357]  # t=177
PRESS_179_JOINTS = [-0.007601, -1.185182, -0.571330, -2.065303, 0.601796, 1.700061, 1.510689]  # t=179
PRESS_181_JOINTS = [0.011250, -1.135859, -0.584611, -2.064735, 0.656653, 1.704030, 1.516045]  # t=181
PRESS_183_JOINTS = [0.030832, -1.090652, -0.600680, -2.058385, 0.712508, 1.699708, 1.506208]  # t=183
PRESS_185_JOINTS = [0.050194, -1.049520, -0.619299, -2.050395, 0.765856, 1.688541, 1.487260]  # t=185
PRESS_187_JOINTS = [0.068726, -1.010291, -0.635172, -2.042346, 0.814072, 1.669385, 1.475841]  # t=187
PRESS_189_JOINTS = [0.083503, -0.981183, -0.646666, -2.033260, 0.853771, 1.632458, 1.475525]  # t=189
PRESS_191_JOINTS = [0.094367, -0.961364, -0.652985, -2.024655, 0.884764, 1.584311, 1.481982]  # t=191
PRESS_193_JOINTS = [0.103064, -0.945249, -0.649186, -2.020057, 0.911781, 1.537192, 1.492223]  # t=193
PRESS_195_JOINTS = [0.109982, -0.931974, -0.635697, -2.019641, 0.936578, 1.493380, 1.502487]  # t=195
PRESS_197_JOINTS = [0.114408, -0.924539, -0.619648, -2.022626, 0.962618, 1.448620, 1.515322]  # t=197
PRESS_199_JOINTS = [0.116919, -0.923504, -0.603354, -2.028424, 0.989019, 1.397929, 1.522020]  # t=199
PRESS_201_JOINTS = [0.118978, -0.925036, -0.590737, -2.032550, 1.014808, 1.339393, 1.522690]  # t=201
PRESS_203_JOINTS = [0.120788, -0.929755, -0.578945, -2.032151, 1.044001, 1.272668, 1.525405]  # t=203
PRESS_205_JOINTS = [0.121632, -0.940669, -0.570503, -2.025151, 1.076603, 1.196229, 1.535819]  # t=205
PRESS_207_JOINTS = [0.123179, -0.952309, -0.562033, -2.012110, 1.117689, 1.117976, 1.558883]  # t=207
PRESS_209_JOINTS = [0.124750, -0.963586, -0.538322, -2.007836, 1.172211, 1.057686, 1.588915]  # t=209
PRESS_211_JOINTS = [0.123611, -0.977585, -0.493823, -2.016835, 1.229609, 1.030556, 1.618953]  # t=211
PRESS_213_JOINTS = [0.119805, -0.997773, -0.442949, -2.033156, 1.279230, 1.022446, 1.645750]  # t=213
PRESS_215_JOINTS = [0.114266, -1.019645, -0.389010, -2.057017, 1.318831, 1.034572, 1.665524]  # t=215
PRESS_217_JOINTS = [0.107909, -1.036384, -0.333092, -2.084927, 1.347644, 1.073703, 1.671612]  # t=217
PRESS_219_JOINTS = [0.102306, -1.052166, -0.276864, -2.111103, 1.373696, 1.119896, 1.672586]  # t=219
PRESS_221_JOINTS = [0.098016, -1.067842, -0.221787, -2.137724, 1.400065, 1.166542, 1.671710]  # t=221
PRESS_223_JOINTS = [0.095110, -1.079904, -0.165771, -2.161949, 1.428846, 1.218213, 1.667838]  # t=223
PRESS_225_JOINTS = [0.093661, -1.085127, -0.108709, -2.181835, 1.458792, 1.274403, 1.660064]  # t=225
PRESS_227_JOINTS = [0.093612, -1.084817, -0.051857, -2.197168, 1.489123, 1.329920, 1.649093]  # t=227
PRESS_229_JOINTS = [0.094340, -1.080065, 0.005110, -2.207085, 1.520425, 1.385837, 1.637022]  # t=229
PRESS_231_JOINTS = [0.095044, -1.069935, 0.063053, -2.206837, 1.550775, 1.446002, 1.627770]  # t=231
PRESS_233_JOINTS = [0.094725, -1.056145, 0.122246, -2.194655, 1.569126, 1.509760, 1.626710]  # t=233
PRESS_235_JOINTS = [0.093338, -1.040745, 0.182061, -2.169705, 1.570327, 1.570336, 1.637916]  # t=235
PRESS_237_JOINTS = [0.090054, -1.021974, 0.242815, -2.131919, 1.553766, 1.627981, 1.656256]  # t=237
PRESS_238_JOINTS = [0.087375, -1.013694, 0.254030, -2.107807, 1.538663, 1.655663, 1.670214]  # t=238
PRESS_239_JOINTS = [0.085225, -1.006355, 0.256889, -2.085682, 1.519908, 1.672542, 1.687266]  # t=239
PRESS_240_JOINTS = [0.084895, -1.001207, 0.256189, -2.072698, 1.505513, 1.674782, 1.700625]  # t=240
PRESS_241_JOINTS = [0.085722, -0.997851, 0.253706, -2.066238, 1.497528, 1.671088, 1.707655]  # t=241
PRESS_243_JOINTS = [0.087722, -0.993448, 0.249703, -2.060179, 1.489700, 1.665420, 1.712474]  # t=243
PRESS_245_JOINTS = [0.089570, -0.991572, 0.247232, -2.058593, 1.486209, 1.662656, 1.712947]  # t=245
PRESS_247_JOINTS = [0.091120, -0.991251, 0.245822, -2.058802, 1.484501, 1.661819, 1.712941]  # t=247
PRESS_249_JOINTS = [0.092499, -0.990749, 0.245427, -2.059135, 1.485250, 1.661436, 1.717150]  # t=249
APPROACH_000_JOINTS = [-0.027125, -1.035315, -0.002610, -2.280738, 0.056623, 1.531858, 0.691949]  # 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_003_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_004_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_008_JOINTS, input_type='joint', steps=4, 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_015_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_016_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_018_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_020_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_023_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_024_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_025_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_026_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_028_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_029_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_031_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_032_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_035_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_036_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_040_JOINTS, input_type='joint', steps=4, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_044_JOINTS, input_type='joint', steps=4, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_048_JOINTS, input_type='joint', steps=4, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_052_JOINTS, input_type='joint', steps=4, 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_061_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)

def press_control():
    """Execute the short interaction path that actuates the control."""
    moveJoint(PRESS_062_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_063_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_065_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_067_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_068_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_069_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_070_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_071_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_073_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_074_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_075_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_076_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_077_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_079_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_081_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_083_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_085_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_087_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_089_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_091_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_093_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_095_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_097_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_099_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_101_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_103_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_105_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_107_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_108_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_109_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_110_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_111_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_112_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_113_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_115_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_117_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_119_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_121_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_123_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_125_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_127_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_129_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_131_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_133_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_135_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_136_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_137_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_139_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_141_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_143_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_145_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_146_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_147_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_149_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_151_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_153_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_155_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_156_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_157_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_159_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_161_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_163_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_165_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_167_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_169_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_171_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_173_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_175_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_177_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_179_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_181_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_183_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_185_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_187_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_189_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_191_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_193_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_195_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_197_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_199_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_201_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_203_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_205_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_207_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_209_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    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_215_JOINTS, input_type='joint', steps=2, 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_238_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_239_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_240_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_241_JOINTS, input_type='joint', steps=1, 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)

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 egg dairy food in_container food_set1


all pan receptacle cookware pots_and_pans


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

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

SCENE_ARTIFACT = '../../../artifacts/20260324/OpenStandMixerHead/20260324_205314_open-stand-mixer-head_episode_000000_action2code-open-loop-joint_initial-scene.json'
POLICY_METADATA = {
    'policy_kind': 'open_loop_joint',
    'policy_variant': 'open-loop-joint',
    'task_name': 'OpenStandMixerHead',
    'episode_id': 'episode_000000',
    'scene_artifact_path': '../../../artifacts/20260324/OpenStandMixerHead/20260324_205314_open-stand-mixer-head_episode_000000_action2code-open-loop-joint_initial-scene.json',
    'fitting_summary_path': '../../../artifacts/20260324/OpenStandMixerHead/20260324_205314_open-stand-mixer-head_episode_000000_action2code-open-loop-joint_fitting-summary.json',
    'extracted_pose_metadata_path': '../../../artifacts/20260324/OpenStandMixerHead/20260324_205314_open-stand-mixer-head_episode_000000_action2code-open-loop-joint_extracted-pose-metadata.json',
    'stable_grasp_contact_t': 84,
    'stable_release_contact_loss_t': 84,
    '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.003034, -1.062297, -0.023091, -2.277745, 0.068876, 1.502904, 0.710816]  # t=2
APPROACH_004_JOINTS = [-0.003375, -1.074526, -0.017210, -2.277071, 0.074335, 1.482744, 0.714556]  # t=4
APPROACH_006_JOINTS = [-0.003928, -1.099856, 0.000031, -2.281022, 0.085627, 1.453683, 0.738522]  # t=6
APPROACH_007_JOINTS = [-0.004538, -1.116622, 0.012583, -2.286695, 0.092182, 1.439174, 0.760443]  # t=7
APPROACH_008_JOINTS = [-0.005287, -1.135890, 0.027043, -2.294506, 0.099104, 1.425171, 0.787433]  # t=8
APPROACH_010_JOINTS = [-0.008929, -1.178917, 0.054166, -2.321209, 0.104789, 1.404096, 0.862495]  # t=10
APPROACH_012_JOINTS = [-0.013353, -1.224751, 0.084300, -2.363117, 0.113831, 1.398467, 0.958887]  # t=12
APPROACH_014_JOINTS = [-0.017014, -1.273139, 0.120401, -2.411617, 0.123806, 1.406712, 1.061930]  # t=14
APPROACH_015_JOINTS = [-0.018375, -1.297746, 0.140507, -2.437517, 0.128034, 1.415839, 1.113693]  # t=15
APPROACH_016_JOINTS = [-0.019180, -1.322171, 0.160266, -2.464198, 0.132088, 1.425934, 1.162281]  # t=16
APPROACH_018_JOINTS = [-0.019380, -1.366211, 0.199976, -2.519293, 0.142613, 1.453196, 1.252877]  # t=18
APPROACH_020_JOINTS = [-0.017862, -1.406606, 0.242211, -2.571261, 0.154862, 1.484077, 1.342812]  # t=20
APPROACH_021_JOINTS = [-0.016371, -1.426557, 0.264685, -2.595331, 0.160490, 1.499622, 1.388709]  # t=21
APPROACH_022_JOINTS = [-0.014655, -1.444378, 0.288661, -2.620593, 0.163096, 1.519554, 1.432197]  # t=22
APPROACH_024_JOINTS = [-0.010948, -1.468122, 0.343884, -2.676142, 0.160311, 1.577765, 1.508865]  # t=24
APPROACH_026_JOINTS = [-0.006125, -1.482367, 0.387541, -2.725832, 0.157887, 1.637160, 1.571176]  # t=26
APPROACH_027_JOINTS = [-0.003867, -1.485159, 0.404044, -2.748812, 0.156135, 1.672405, 1.596515]  # t=27
APPROACH_028_JOINTS = [-0.002072, -1.483867, 0.418863, -2.771191, 0.153387, 1.711977, 1.618580]  # t=28
APPROACH_030_JOINTS = [-0.000295, -1.468583, 0.444023, -2.813396, 0.147488, 1.799600, 1.655930]  # t=30
APPROACH_032_JOINTS = [-0.001546, -1.435662, 0.463408, -2.852789, 0.143113, 1.894696, 1.686080]  # t=32
APPROACH_034_JOINTS = [-0.008287, -1.383494, 0.479083, -2.885699, 0.130352, 2.000225, 1.707654]  # t=34
APPROACH_035_JOINTS = [-0.013635, -1.352615, 0.486692, -2.893358, 0.119730, 2.048359, 1.719990]  # t=35
PRESS_037_JOINTS = [-0.026219, -1.299265, 0.501707, -2.860072, 0.089372, 2.016332, 1.768486]  # t=37
PRESS_038_JOINTS = [-0.036552, -1.263465, 0.506904, -2.834661, 0.073896, 1.987860, 1.787184]  # t=38
PRESS_039_JOINTS = [-0.048129, -1.223522, 0.511299, -2.806560, 0.059735, 1.961534, 1.803571]  # t=39
PRESS_040_JOINTS = [-0.059661, -1.182875, 0.515317, -2.776852, 0.046721, 1.935658, 1.819521]  # t=40
PRESS_041_JOINTS = [-0.071517, -1.141633, 0.517848, -2.744973, 0.031374, 1.926530, 1.832861]  # t=41
PRESS_042_JOINTS = [-0.082613, -1.103210, 0.519196, -2.717930, 0.013682, 1.930191, 1.845630]  # t=42
PRESS_043_JOINTS = [-0.091885, -1.072774, 0.518354, -2.693467, -0.006818, 1.932553, 1.859107]  # t=43
PRESS_045_JOINTS = [-0.105945, -1.032662, 0.505744, -2.656323, -0.051506, 1.939711, 1.881878]  # t=45
PRESS_047_JOINTS = [-0.109524, -1.024179, 0.496537, -2.641545, -0.085588, 1.933422, 1.920442]  # t=47
PRESS_049_JOINTS = [-0.110762, -1.024994, 0.489945, -2.634964, -0.127195, 1.935326, 1.954758]  # t=49
PRESS_051_JOINTS = [-0.115557, -1.015913, 0.484455, -2.621904, -0.166999, 1.924116, 1.993690]  # t=51
PRESS_053_JOINTS = [-0.124345, -1.000670, 0.475606, -2.598044, -0.208504, 1.897401, 2.037166]  # t=53
PRESS_054_JOINTS = [-0.129042, -0.993217, 0.471175, -2.581296, -0.229164, 1.876196, 2.059009]  # t=54
PRESS_055_JOINTS = [-0.134048, -0.984844, 0.465370, -2.561593, -0.249789, 1.853958, 2.077932]  # t=55
PRESS_057_JOINTS = [-0.144865, -0.963961, 0.451227, -2.518106, -0.290352, 1.809160, 2.109008]  # t=57
PRESS_059_JOINTS = [-0.155820, -0.936697, 0.433106, -2.469658, -0.324337, 1.769572, 2.130325]  # t=59
PRESS_061_JOINTS = [-0.166182, -0.904660, 0.408741, -2.415472, -0.351853, 1.733428, 2.136210]  # t=61
PRESS_063_JOINTS = [-0.173421, -0.879218, 0.380075, -2.365036, -0.376172, 1.692254, 2.127315]  # t=63
PRESS_065_JOINTS = [-0.176736, -0.861053, 0.349537, -2.324204, -0.394993, 1.662448, 2.111173]  # t=65
PRESS_067_JOINTS = [-0.178134, -0.845827, 0.318252, -2.287527, -0.412199, 1.639663, 2.093436]  # t=67
PRESS_069_JOINTS = [-0.178011, -0.834497, 0.286065, -2.255447, -0.429490, 1.621265, 2.072098]  # t=69
PRESS_070_JOINTS = [-0.177446, -0.829741, 0.269379, -2.240579, -0.435493, 1.613118, 2.060077]  # t=70
PRESS_071_JOINTS = [-0.176691, -0.825213, 0.251884, -2.225597, -0.438754, 1.604728, 2.047928]  # t=71
PRESS_073_JOINTS = [-0.174878, -0.815757, 0.213925, -2.193816, -0.438068, 1.587522, 2.022866]  # t=73
PRESS_075_JOINTS = [-0.172841, -0.804049, 0.172212, -2.158629, -0.430348, 1.571456, 1.995053]  # t=75
PRESS_076_JOINTS = [-0.171803, -0.796458, 0.150059, -2.139147, -0.424022, 1.564187, 1.980176]  # t=76
PRESS_077_JOINTS = [-0.170834, -0.787429, 0.127445, -2.118452, -0.417676, 1.557364, 1.964754]  # t=77
PRESS_079_JOINTS = [-0.168906, -0.765235, 0.080208, -2.073207, -0.402658, 1.543784, 1.932309]  # t=79
PRESS_080_JOINTS = [-0.167889, -0.752381, 0.055440, -2.048837, -0.394121, 1.536512, 1.915063]  # t=80
PRESS_081_JOINTS = [-0.166793, -0.738333, 0.030000, -2.023522, -0.385387, 1.529376, 1.897090]  # t=81
PRESS_082_JOINTS = [-0.165582, -0.723109, 0.003946, -1.997365, -0.376616, 1.522404, 1.878413]  # t=82
PRESS_083_JOINTS = [-0.164226, -0.706854, -0.022717, -1.970556, -0.367913, 1.515505, 1.858989]  # t=83
PRESS_084_JOINTS = [-0.162706, -0.689690, -0.049846, -1.943422, -0.359874, 1.508896, 1.838742]  # t=84
PRESS_085_JOINTS = [-0.160985, -0.671756, -0.077455, -1.916235, -0.352266, 1.502585, 1.817746]  # t=85
PRESS_086_JOINTS = [-0.159110, -0.653248, -0.106482, -1.891328, -0.344805, 1.497201, 1.796133]  # t=86
PRESS_087_JOINTS = [-0.157055, -0.634682, -0.136635, -1.869236, -0.337983, 1.494100, 1.773900]  # t=87
PRESS_088_JOINTS = [-0.154779, -0.616510, -0.166762, -1.848665, -0.332647, 1.493334, 1.751126]  # t=88
RETREAT_090_JOINTS = [-0.149613, -0.581350, -0.224845, -1.810292, -0.328556, 1.496559, 1.704728]  # t=90
RETREAT_092_JOINTS = [-0.143856, -0.548012, -0.280319, -1.774446, -0.330411, 1.503671, 1.658124]  # t=92
RETREAT_094_JOINTS = [-0.137911, -0.519194, -0.335029, -1.740686, -0.333788, 1.509454, 1.606652]  # t=94
RETREAT_096_JOINTS = [-0.132785, -0.502527, -0.392336, -1.709245, -0.336064, 1.506318, 1.539451]  # t=96
RETREAT_098_JOINTS = [-0.128761, -0.508345, -0.450968, -1.683511, -0.328960, 1.495848, 1.452139]  # t=98
RETREAT_100_JOINTS = [-0.124459, -0.533261, -0.500053, -1.669333, -0.308357, 1.468950, 1.360643]  # t=100
RETREAT_102_JOINTS = [-0.120004, -0.568590, -0.534578, -1.661353, -0.292495, 1.427488, 1.274042]  # t=102
RETREAT_104_JOINTS = [-0.115652, -0.609389, -0.559608, -1.658938, -0.289573, 1.383792, 1.188571]  # t=104
RETREAT_106_JOINTS = [-0.111601, -0.654380, -0.580868, -1.665574, -0.286830, 1.333074, 1.111454]  # t=106
RETREAT_107_JOINTS = [-0.109548, -0.676630, -0.588267, -1.671651, -0.284261, 1.307192, 1.083041]  # t=107
APPROACH_000_JOINTS = [-0.002770, -1.060588, -0.023759, -2.278174, 0.068107, 1.506477, 0.710727]  # 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_006_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_007_JOINTS, input_type='joint', steps=1, 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_014_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_015_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_016_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_018_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_020_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_021_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_022_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_024_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_026_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_027_JOINTS, input_type='joint', steps=1, 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_034_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_035_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)

def press_control():
    """Execute the short interaction path that actuates the control."""
    moveJoint(PRESS_037_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_038_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_039_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_040_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_041_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_042_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_043_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_045_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_047_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_049_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_051_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_053_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_054_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_055_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_057_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_059_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_061_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_063_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_065_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_067_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_069_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_070_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_071_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_073_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_075_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_076_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_077_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_079_JOINTS, input_type='joint', steps=2, 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_083_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_084_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_085_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_086_JOINTS, input_type='joint', steps=1, 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)

def retreat_after_press():
    """Retreat away after the button press interaction."""
    moveJoint(RETREAT_090_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(RETREAT_092_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(RETREAT_094_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(RETREAT_096_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(RETREAT_098_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(RETREAT_100_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(RETREAT_102_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(RETREAT_104_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(RETREAT_106_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(RETREAT_107_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)

move_to_control_panel()
press_control()
retreat_after_press()

# 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


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

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

SCENE_ARTIFACT = '../../../artifacts/20260324/OpenToasterOvenDoor/20260324_205315_open-toaster-oven-door_episode_000000_action2code-open-loop-joint_initial-scene.json'
POLICY_METADATA = {
    'policy_kind': 'open_loop_joint',
    'policy_variant': 'open-loop-joint',
    'task_name': 'OpenToasterOvenDoor',
    'episode_id': 'episode_000000',
    'scene_artifact_path': '../../../artifacts/20260324/OpenToasterOvenDoor/20260324_205315_open-toaster-oven-door_episode_000000_action2code-open-loop-joint_initial-scene.json',
    'fitting_summary_path': '../../../artifacts/20260324/OpenToasterOvenDoor/20260324_205315_open-toaster-oven-door_episode_000000_action2code-open-loop-joint_fitting-summary.json',
    'extracted_pose_metadata_path': '../../../artifacts/20260324/OpenToasterOvenDoor/20260324_205315_open-toaster-oven-door_episode_000000_action2code-open-loop-joint_extracted-pose-metadata.json',
    'stable_grasp_contact_t': 118,
    'stable_release_contact_loss_t': 118,
    '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.045780, -1.037240, -0.057827, -2.315620, 0.046868, 1.509955, 0.686366]  # t=2
APPROACH_003_JOINTS = [-0.044932, -1.045570, -0.061581, -2.316807, 0.049188, 1.497719, 0.687082]  # t=3
APPROACH_004_JOINTS = [-0.044675, -1.055167, -0.073075, -2.318419, 0.052329, 1.486361, 0.686549]  # t=4
APPROACH_006_JOINTS = [-0.045819, -1.076326, -0.130368, -2.326526, 0.070798, 1.471460, 0.673346]  # t=6
APPROACH_009_JOINTS = [-0.052160, -1.145733, -0.256478, -2.366981, 0.141725, 1.495938, 0.643685]  # t=9
APPROACH_012_JOINTS = [-0.067123, -1.228282, -0.391628, -2.454566, 0.232026, 1.596470, 0.642136]  # t=12
APPROACH_015_JOINTS = [-0.084017, -1.280214, -0.513694, -2.546649, 0.325437, 1.709242, 0.664616]  # t=15
APPROACH_017_JOINTS = [-0.092045, -1.295975, -0.563459, -2.612640, 0.398022, 1.799037, 0.683775]  # t=17
APPROACH_018_JOINTS = [-0.095105, -1.300819, -0.577517, -2.650954, 0.438176, 1.852975, 0.690045]  # t=18
APPROACH_021_JOINTS = [-0.093799, -1.296177, -0.597383, -2.760197, 0.582181, 2.031568, 0.683237]  # t=21
APPROACH_024_JOINTS = [-0.079227, -1.273702, -0.605449, -2.831293, 0.745865, 2.168513, 0.658090]  # t=24
APPROACH_026_JOINTS = [-0.069458, -1.258849, -0.612278, -2.857427, 0.848093, 2.225942, 0.641543]  # t=26
APPROACH_027_JOINTS = [-0.066239, -1.253391, -0.618961, -2.866213, 0.894664, 2.243736, 0.634027]  # t=27
APPROACH_030_JOINTS = [-0.055169, -1.229975, -0.640021, -2.879091, 1.025895, 2.275862, 0.612171]  # t=30
APPROACH_033_JOINTS = [-0.037358, -1.189946, -0.657386, -2.876404, 1.150772, 2.282426, 0.581474]  # t=33
APPROACH_036_JOINTS = [-0.024989, -1.147411, -0.676119, -2.868929, 1.249466, 2.269751, 0.553525]  # t=36
APPROACH_039_JOINTS = [-0.016891, -1.103453, -0.690154, -2.857263, 1.327425, 2.248195, 0.527217]  # t=39
APPROACH_042_JOINTS = [-0.008294, -1.050495, -0.698434, -2.838038, 1.388265, 2.227649, 0.498683]  # t=42
APPROACH_045_JOINTS = [0.002063, -0.989158, -0.706944, -2.811306, 1.436201, 2.204853, 0.465983]  # t=45
APPROACH_048_JOINTS = [0.011711, -0.927566, -0.717490, -2.779241, 1.467617, 2.174582, 0.435086]  # t=48
APPROACH_051_JOINTS = [0.015634, -0.879603, -0.728468, -2.755992, 1.481252, 2.138826, 0.413708]  # t=51
PRESS_053_JOINTS = [0.009080, -0.871036, -0.729088, -2.753322, 1.478093, 2.120073, 0.412979]  # t=53
PRESS_055_JOINTS = [0.000606, -0.868149, -0.722287, -2.752446, 1.470625, 2.117219, 0.419088]  # t=55
PRESS_057_JOINTS = [-0.007061, -0.865751, -0.711085, -2.750573, 1.461704, 2.123192, 0.427896]  # t=57
PRESS_059_JOINTS = [-0.014595, -0.865886, -0.699906, -2.750307, 1.455342, 2.131839, 0.436568]  # t=59
PRESS_061_JOINTS = [-0.021182, -0.866752, -0.688611, -2.750806, 1.452859, 2.142865, 0.442955]  # t=61
PRESS_062_JOINTS = [-0.024153, -0.867467, -0.682295, -2.751199, 1.452597, 2.150206, 0.445853]  # t=62
PRESS_063_JOINTS = [-0.027249, -0.868907, -0.675443, -2.751934, 1.452234, 2.159063, 0.449698]  # t=63
PRESS_064_JOINTS = [-0.030585, -0.871154, -0.667752, -2.752959, 1.451088, 2.169913, 0.454882]  # t=64
PRESS_065_JOINTS = [-0.034011, -0.873866, -0.659052, -2.754021, 1.449158, 2.182809, 0.461790]  # t=65
PRESS_067_JOINTS = [-0.041687, -0.881280, -0.639694, -2.756490, 1.439713, 2.213366, 0.483136]  # t=67
PRESS_069_JOINTS = [-0.050413, -0.890025, -0.619728, -2.759013, 1.418264, 2.247500, 0.516659]  # t=69
PRESS_071_JOINTS = [-0.058915, -0.897479, -0.595895, -2.758397, 1.379241, 2.284294, 0.565813]  # t=71
PRESS_073_JOINTS = [-0.067239, -0.903640, -0.571986, -2.756036, 1.325666, 2.319639, 0.629976]  # t=73
PRESS_075_JOINTS = [-0.075527, -0.908703, -0.548805, -2.752877, 1.258309, 2.352469, 0.704021]  # t=75
PRESS_077_JOINTS = [-0.083732, -0.911959, -0.526973, -2.748618, 1.177796, 2.380079, 0.786931]  # t=77
PRESS_079_JOINTS = [-0.093236, -0.914802, -0.509172, -2.744051, 1.083194, 2.397915, 0.881049]  # t=79
PRESS_080_JOINTS = [-0.099915, -0.918413, -0.503806, -2.746484, 1.028871, 2.400956, 0.930211]  # t=80
PRESS_081_JOINTS = [-0.108059, -0.925447, -0.499179, -2.748752, 0.970744, 2.399949, 0.979867]  # t=81
PRESS_083_JOINTS = [-0.129390, -0.947253, -0.486604, -2.745757, 0.836777, 2.383514, 1.096823]  # t=83
PRESS_085_JOINTS = [-0.155458, -0.972499, -0.472163, -2.738476, 0.688536, 2.346771, 1.230138]  # t=85
PRESS_087_JOINTS = [-0.181240, -0.996362, -0.457019, -2.725677, 0.545300, 2.292110, 1.361540]  # t=87
PRESS_088_JOINTS = [-0.192102, -1.005177, -0.448526, -2.716118, 0.480204, 2.260514, 1.423022]  # t=88
PRESS_089_JOINTS = [-0.200876, -1.010812, -0.439517, -2.704314, 0.421016, 2.227444, 1.480203]  # t=89
PRESS_091_JOINTS = [-0.212718, -1.013774, -0.422566, -2.673967, 0.319265, 2.153296, 1.581144]  # t=91
PRESS_093_JOINTS = [-0.219275, -1.011339, -0.409194, -2.638413, 0.234733, 2.067223, 1.663732]  # t=93
PRESS_095_JOINTS = [-0.221918, -1.006968, -0.399030, -2.603079, 0.164925, 1.976826, 1.729129]  # t=95
PRESS_097_JOINTS = [-0.221454, -1.001758, -0.391201, -2.570610, 0.108606, 1.891819, 1.778916]  # t=97
PRESS_099_JOINTS = [-0.220175, -0.998784, -0.388495, -2.545743, 0.061294, 1.810486, 1.815278]  # t=99
PRESS_101_JOINTS = [-0.219888, -1.001872, -0.391504, -2.531903, 0.019076, 1.731537, 1.839892]  # t=101
PRESS_103_JOINTS = [-0.222166, -1.012946, -0.402390, -2.539579, -0.023061, 1.662508, 1.854428]  # t=103
PRESS_105_JOINTS = [-0.227630, -1.031972, -0.419198, -2.566730, -0.067885, 1.607814, 1.863340]  # t=105
PRESS_107_JOINTS = [-0.235517, -1.055446, -0.438647, -2.605625, -0.114481, 1.568399, 1.869842]  # t=107
PRESS_109_JOINTS = [-0.246177, -1.086776, -0.456420, -2.641311, -0.159647, 1.529576, 1.873833]  # t=109
PRESS_110_JOINTS = [-0.252513, -1.104145, -0.465786, -2.660637, -0.182537, 1.513212, 1.874744]  # t=110
PRESS_111_JOINTS = [-0.259546, -1.121902, -0.476148, -2.681859, -0.206129, 1.499449, 1.875407]  # t=111
PRESS_112_JOINTS = [-0.266956, -1.138532, -0.487792, -2.705626, -0.230666, 1.491047, 1.876717]  # t=112
PRESS_113_JOINTS = [-0.274327, -1.152638, -0.500864, -2.732305, -0.255170, 1.489252, 1.879161]  # t=113
PRESS_115_JOINTS = [-0.288816, -1.171994, -0.530393, -2.788632, -0.303245, 1.496363, 1.888035]  # t=115
PRESS_117_JOINTS = [-0.305020, -1.184191, -0.565037, -2.840376, -0.351517, 1.504818, 1.897998]  # t=117
PRESS_119_JOINTS = [-0.322754, -1.187324, -0.606867, -2.889995, -0.399196, 1.520654, 1.909366]  # t=119
PRESS_121_JOINTS = [-0.339924, -1.178378, -0.654975, -2.932382, -0.440013, 1.547104, 1.919678]  # t=121
PRESS_122_JOINTS = [-0.344705, -1.175888, -0.665004, -2.935911, -0.440153, 1.553551, 1.919409]  # t=122
PRESS_123_JOINTS = [-0.347669, -1.173130, -0.667202, -2.935174, -0.436403, 1.555908, 1.919159]  # t=123
PRESS_124_JOINTS = [-0.349984, -1.168667, -0.667162, -2.934031, -0.433088, 1.557427, 1.920394]  # t=124
PRESS_125_JOINTS = [-0.351854, -1.163066, -0.666195, -2.932308, -0.429400, 1.558265, 1.922393]  # t=125
PRESS_127_JOINTS = [-0.354783, -1.150258, -0.664849, -2.926468, -0.418519, 1.557890, 1.924356]  # t=127
PRESS_129_JOINTS = [-0.357228, -1.136258, -0.667220, -2.918761, -0.404075, 1.556139, 1.922524]  # t=129
PRESS_131_JOINTS = [-0.359709, -1.123136, -0.673216, -2.910851, -0.388378, 1.554345, 1.916781]  # t=131
PRESS_133_JOINTS = [-0.362687, -1.112559, -0.680039, -2.904775, -0.374275, 1.553743, 1.911622]  # t=133
APPROACH_000_JOINTS = [-0.046595, -1.032737, -0.056082, -2.314732, 0.046409, 1.518914, 0.685818]  # 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_006_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_009_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_012_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_015_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_017_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_018_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_021_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_024_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_026_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_027_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_030_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_033_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_036_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_039_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_042_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_045_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_048_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_051_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_053_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_055_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_057_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_059_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_061_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_062_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_063_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_064_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_065_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_067_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_069_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_071_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_073_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_075_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_077_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_079_JOINTS, input_type='joint', steps=2, 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_083_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_085_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_087_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_088_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_089_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_091_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_093_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_095_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_097_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_099_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_101_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_103_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_105_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_107_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_109_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_110_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_111_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_112_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_113_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_115_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_117_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_119_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_121_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_122_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_123_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_124_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_125_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_127_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_129_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_131_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_133_JOINTS, input_type='joint', steps=2, 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


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

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

SCENE_ARTIFACT = '../../../artifacts/20260324/PackDessert/20260324_205316_pack-dessert_episode_000000_action2code-open-loop-joint_initial-scene.json'
POLICY_METADATA = {
    'policy_kind': 'open_loop_joint',
    'policy_variant': 'open-loop-joint',
    'task_name': 'PackDessert',
    'episode_id': 'episode_000000',
    'scene_artifact_path': '../../../artifacts/20260324/PackDessert/20260324_205316_pack-dessert_episode_000000_action2code-open-loop-joint_initial-scene.json',
    'fitting_summary_path': '../../../artifacts/20260324/PackDessert/20260324_205316_pack-dessert_episode_000000_action2code-open-loop-joint_fitting-summary.json',
    'extracted_pose_metadata_path': '../../../artifacts/20260324/PackDessert/20260324_205316_pack-dessert_episode_000000_action2code-open-loop-joint_extracted-pose-metadata.json',
    'stable_grasp_contact_t': 167,
    'stable_release_contact_loss_t': 293,
    'uses_moveC': False,
    'controller_mode': 'whole_body_ik',
}

OBJ_POSE_T0 = pose(x=3.262106, y=-2.807337, z=0.933553, qw=0.742961, qx=-0.001140, qy=0.001524, qz=-0.669332)
GOAL_RECEPTACLE_POSE = pose(x=3.311911, y=-2.572790, z=0.948702, qw=0.707215, qx=0.000504, qy=-0.000617, qz=-0.706998)

APPROACH_005_JOINTS = [-0.000261, -1.072576, -0.001469, -2.315858, 0.024786, 1.478648, 0.679538]  # t=5
APPROACH_007_JOINTS = [-0.003862, -1.096110, -0.017344, -2.332675, 0.011094, 1.458898, 0.667620]  # t=7
APPROACH_010_JOINTS = [-0.012390, -1.132252, -0.058873, -2.382504, -0.026828, 1.464078, 0.647292]  # t=10
APPROACH_015_JOINTS = [-0.038519, -1.159015, -0.182295, -2.445513, -0.140369, 1.494966, 0.640681]  # t=15
APPROACH_020_JOINTS = [-0.064680, -1.149514, -0.321321, -2.433010, -0.222757, 1.494192, 0.637546]  # t=20
APPROACH_024_JOINTS = [-0.081156, -1.139387, -0.390627, -2.406533, -0.263345, 1.474455, 0.641348]  # t=24
APPROACH_025_JOINTS = [-0.083218, -1.137409, -0.403375, -2.404661, -0.271752, 1.476212, 0.629549]  # t=25
APPROACH_029_JOINTS = [-0.087934, -1.133722, -0.460317, -2.403673, -0.313192, 1.482940, 0.522712]  # t=29
APPROACH_030_JOINTS = [-0.088642, -1.133590, -0.480617, -2.404624, -0.328081, 1.490708, 0.480446]  # t=30
APPROACH_035_JOINTS = [-0.084222, -1.122261, -0.592085, -2.398457, -0.413969, 1.553304, 0.194103]  # t=35
APPROACH_040_JOINTS = [-0.068583, -1.097222, -0.677493, -2.397290, -0.508682, 1.623872, -0.139597]  # t=40
APPROACH_041_JOINTS = [-0.066696, -1.096171, -0.685319, -2.403857, -0.530320, 1.638806, -0.199979]  # t=41
APPROACH_045_JOINTS = [-0.064451, -1.107587, -0.726530, -2.452396, -0.610809, 1.715911, -0.438271]  # t=45
APPROACH_048_JOINTS = [-0.063980, -1.126628, -0.753439, -2.470385, -0.597726, 1.730004, -0.597150]  # t=48
APPROACH_050_JOINTS = [-0.056673, -1.124749, -0.773423, -2.475267, -0.575611, 1.742345, -0.684639]  # t=50
APPROACH_055_JOINTS = [-0.016162, -1.081063, -0.820526, -2.462196, -0.493446, 1.763377, -0.882931]  # t=55
APPROACH_060_JOINTS = [0.040171, -0.980249, -0.840553, -2.418209, -0.473236, 1.726318, -1.019660]  # t=60
APPROACH_065_JOINTS = [0.093179, -0.874572, -0.849265, -2.363782, -0.462699, 1.658147, -1.140973]  # t=65
APPROACH_069_JOINTS = [0.115523, -0.829370, -0.853109, -2.342086, -0.447020, 1.624559, -1.238579]  # t=69
APPROACH_070_JOINTS = [0.118339, -0.823743, -0.854068, -2.339993, -0.442710, 1.623831, -1.260387]  # t=70
APPROACH_071_JOINTS = [0.120084, -0.820173, -0.854945, -2.339724, -0.438617, 1.623910, -1.281183]  # t=71
APPROACH_075_JOINTS = [0.119630, -0.817972, -0.841710, -2.356072, -0.421938, 1.619210, -1.313685]  # t=75
APPROACH_080_JOINTS = [0.115939, -0.817016, -0.821682, -2.398231, -0.403593, 1.661873, -1.293922]  # t=80
APPROACH_084_JOINTS = [0.119903, -0.792120, -0.833061, -2.443471, -0.404954, 1.737618, -1.296463]  # t=84
APPROACH_085_JOINTS = [0.121634, -0.783381, -0.838307, -2.453089, -0.405482, 1.756803, -1.302099]  # t=85
APPROACH_090_JOINTS = [0.128523, -0.743987, -0.852414, -2.473995, -0.397824, 1.817803, -1.328897]  # t=90
APPROACH_095_JOINTS = [0.140567, -0.701579, -0.849349, -2.467797, -0.375245, 1.852809, -1.365114]  # t=95
APPROACH_097_JOINTS = [0.145840, -0.680900, -0.852359, -2.463906, -0.367659, 1.867150, -1.385754]  # t=97
APPROACH_100_JOINTS = [0.150143, -0.648557, -0.869670, -2.454150, -0.362118, 1.887761, -1.420807]  # t=100
APPROACH_105_JOINTS = [0.163402, -0.583215, -0.905223, -2.450535, -0.343332, 1.946281, -1.481205]  # t=105
APPROACH_110_JOINTS = [0.184687, -0.501827, -0.929609, -2.452346, -0.309760, 2.012963, -1.523064]  # t=110
APPROACH_112_JOINTS = [0.192462, -0.471234, -0.930632, -2.446569, -0.288826, 2.031691, -1.540908]  # t=112
DESCEND_114_JOINTS = [0.200447, -0.435426, -0.932492, -2.444470, -0.264684, 2.060177, -1.560849]  # t=114
DESCEND_116_JOINTS = [0.206838, -0.398340, -0.932209, -2.440026, -0.236341, 2.085877, -1.580446]  # t=116
DESCEND_118_JOINTS = [0.208271, -0.367414, -0.927775, -2.428292, -0.208450, 2.092750, -1.599466]  # t=118
DESCEND_119_JOINTS = [0.206614, -0.354503, -0.925303, -2.421899, -0.196544, 2.090949, -1.608586]  # t=119
DESCEND_120_JOINTS = [0.203770, -0.342299, -0.923153, -2.416784, -0.185702, 2.090043, -1.617349]  # t=120
DESCEND_122_JOINTS = [0.196139, -0.318741, -0.917749, -2.410897, -0.164772, 2.093505, -1.634655]  # t=122
DESCEND_124_JOINTS = [0.187158, -0.294834, -0.909605, -2.408103, -0.143003, 2.103846, -1.650954]  # t=124
DESCEND_126_JOINTS = [0.176210, -0.272439, -0.899462, -2.404341, -0.121285, 2.112795, -1.667058]  # t=126
DESCEND_128_JOINTS = [0.163415, -0.251136, -0.888394, -2.402863, -0.100324, 2.122378, -1.685247]  # t=128
DESCEND_130_JOINTS = [0.149447, -0.231647, -0.875568, -2.403002, -0.078278, 2.135658, -1.707491]  # t=130
DESCEND_132_JOINTS = [0.133509, -0.218954, -0.862713, -2.403281, -0.054206, 2.148214, -1.735335]  # t=132
DESCEND_134_JOINTS = [0.116262, -0.212184, -0.850321, -2.405100, -0.033007, 2.161440, -1.771728]  # t=134
DESCEND_136_JOINTS = [0.098868, -0.205515, -0.838232, -2.407446, -0.019894, 2.168882, -1.804041]  # t=136
DESCEND_138_JOINTS = [0.082598, -0.198798, -0.824011, -2.407813, -0.012048, 2.169835, -1.826574]  # t=138
DESCEND_140_JOINTS = [0.067375, -0.192470, -0.809776, -2.407561, -0.005334, 2.170295, -1.842497]  # t=140
DESCEND_142_JOINTS = [0.053320, -0.185478, -0.796403, -2.407987, 0.001490, 2.172444, -1.855097]  # t=142
DESCEND_144_JOINTS = [0.040516, -0.173184, -0.785700, -2.411650, 0.010571, 2.184245, -1.866112]  # t=144
DESCEND_146_JOINTS = [0.028518, -0.155957, -0.778440, -2.416022, 0.022618, 2.202030, -1.886689]  # t=146
DESCEND_148_JOINTS = [0.016674, -0.141731, -0.770473, -2.417245, 0.035446, 2.211573, -1.907767]  # t=148
DESCEND_150_JOINTS = [0.004861, -0.129650, -0.761170, -2.417013, 0.046635, 2.216948, -1.925704]  # t=150
DESCEND_152_JOINTS = [-0.006545, -0.117001, -0.750531, -2.418370, 0.057578, 2.224308, -1.941393]  # t=152
DESCEND_154_JOINTS = [-0.018066, -0.106541, -0.739755, -2.418944, 0.067574, 2.229413, -1.955762]  # t=154
DESCEND_156_JOINTS = [-0.029799, -0.100136, -0.728990, -2.417649, 0.074348, 2.229954, -1.965538]  # t=156
DESCEND_158_JOINTS = [-0.041107, -0.095467, -0.718212, -2.416548, 0.079129, 2.230017, -1.972019]  # t=158
DESCEND_159_JOINTS = [-0.046511, -0.094099, -0.712840, -2.415904, 0.080811, 2.229117, -1.973897]  # t=159
DESCEND_160_JOINTS = [-0.051726, -0.093201, -0.707594, -2.415292, 0.081822, 2.228060, -1.975016]  # t=160
DESCEND_161_JOINTS = [-0.056719, -0.092412, -0.702605, -2.414939, 0.082449, 2.227383, -1.975859]  # t=161
DESCEND_162_JOINTS = [-0.061534, -0.091730, -0.698090, -2.414828, 0.082667, 2.226857, -1.976487]  # t=162
DESCEND_164_JOINTS = [-0.070770, -0.091220, -0.690979, -2.414509, 0.082263, 2.225077, -1.976739]  # t=164
GRASP_HOLD_167_JOINTS = [-0.081590, -0.090731, -0.679328, -2.412372, 0.083816, 2.224452, -1.976869]  # t=167
LIFT_168_JOINTS = [-0.084681, -0.090520, -0.676047, -2.412132, 0.084084, 2.224193, -1.976870]  # t=168
LIFT_169_JOINTS = [-0.087561, -0.090392, -0.673125, -2.412115, 0.084265, 2.224151, -1.976875]  # t=169
LIFT_170_JOINTS = [-0.090219, -0.090323, -0.670474, -2.412136, 0.084389, 2.224149, -1.976879]  # t=170
LIFT_171_JOINTS = [-0.092660, -0.090386, -0.668023, -2.412143, 0.084459, 2.223993, -1.976881]  # t=171
LIFT_172_JOINTS = [-0.094776, -0.092072, -0.664985, -2.412145, 0.083758, 2.221822, -1.975914]  # t=172
LIFT_173_JOINTS = [-0.096778, -0.094739, -0.661924, -2.411654, 0.080315, 2.220014, -1.972812]  # t=173
LIFT_174_JOINTS = [-0.098740, -0.099266, -0.658897, -2.410211, 0.072900, 2.217676, -1.967151]  # t=174
LIFT_175_JOINTS = [-0.100463, -0.108103, -0.654510, -2.407742, 0.058881, 2.212415, -1.956153]  # t=175
LIFT_176_JOINTS = [-0.101887, -0.122746, -0.648185, -2.404377, 0.037103, 2.203400, -1.937941]  # t=176
LIFT_177_JOINTS = [-0.103077, -0.140445, -0.640803, -2.400796, 0.007417, 2.196018, -1.913023]  # t=177
LIFT_178_JOINTS = [-0.103947, -0.162890, -0.632819, -2.397092, -0.024919, 2.186992, -1.887124]  # t=178
LIFT_179_JOINTS = [-0.104584, -0.190879, -0.624946, -2.392199, -0.057577, 2.171236, -1.863765]  # t=179
LIFT_180_JOINTS = [-0.104441, -0.222010, -0.616609, -2.386971, -0.087706, 2.148627, -1.844856]  # t=180
TRANSPORT_183_JOINTS = [-0.099327, -0.311690, -0.593695, -2.366420, -0.163543, 2.074941, -1.796918]  # t=183
TRANSPORT_184_JOINTS = [-0.095442, -0.342205, -0.584579, -2.360080, -0.178978, 2.043959, -1.784293]  # t=184
TRANSPORT_186_JOINTS = [-0.084767, -0.395925, -0.567954, -2.351398, -0.200929, 1.990407, -1.766486]  # t=186
TRANSPORT_188_JOINTS = [-0.070437, -0.442453, -0.549559, -2.352280, -0.214126, 1.944709, -1.759289]  # t=188
TRANSPORT_189_JOINTS = [-0.063223, -0.468234, -0.539843, -2.354395, -0.219331, 1.921222, -1.759063]  # t=189
TRANSPORT_192_JOINTS = [-0.041005, -0.552528, -0.513113, -2.370656, -0.215894, 1.890267, -1.764005]  # t=192
TRANSPORT_195_JOINTS = [-0.019237, -0.631136, -0.488917, -2.403681, -0.207914, 1.896113, -1.757856]  # t=195
TRANSPORT_196_JOINTS = [-0.012112, -0.657639, -0.480759, -2.418621, -0.204155, 1.903077, -1.758197]  # t=196
TRANSPORT_198_JOINTS = [0.002663, -0.709616, -0.462850, -2.458776, -0.195692, 1.921398, -1.766665]  # t=198
TRANSPORT_200_JOINTS = [0.016663, -0.756844, -0.444823, -2.502798, -0.192082, 1.934649, -1.776771]  # t=200
TRANSPORT_201_JOINTS = [0.023504, -0.774262, -0.437976, -2.524847, -0.192819, 1.942050, -1.780561]  # t=201
TRANSPORT_204_JOINTS = [0.040903, -0.813865, -0.431341, -2.581973, -0.199883, 1.963746, -1.799294]  # t=204
TRANSPORT_207_JOINTS = [0.054895, -0.844100, -0.433644, -2.615766, -0.207758, 1.975447, -1.830535]  # t=207
TRANSPORT_208_JOINTS = [0.058932, -0.850517, -0.437781, -2.621637, -0.210675, 1.977978, -1.844749]  # t=208
TRANSPORT_210_JOINTS = [0.066068, -0.858189, -0.450773, -2.627436, -0.217691, 1.980769, -1.877604]  # t=210
TRANSPORT_212_JOINTS = [0.072440, -0.860902, -0.467572, -2.627413, -0.224508, 1.981165, -1.914219]  # t=212
TRANSPORT_213_JOINTS = [0.075789, -0.860254, -0.475253, -2.627596, -0.227298, 1.978613, -1.931456]  # t=213
TRANSPORT_216_JOINTS = [0.087374, -0.843395, -0.489957, -2.633204, -0.244050, 1.967323, -1.969310]  # t=216
TRANSPORT_219_JOINTS = [0.098213, -0.816909, -0.489493, -2.635300, -0.276235, 1.957749, -1.986425]  # t=219
TRANSPORT_220_JOINTS = [0.101512, -0.808688, -0.487779, -2.636686, -0.287177, 1.957847, -1.992435]  # t=220
TRANSPORT_222_JOINTS = [0.106670, -0.791558, -0.487253, -2.645009, -0.310894, 1.968010, -2.004201]  # t=222
TRANSPORT_224_JOINTS = [0.109758, -0.778118, -0.487902, -2.657269, -0.332620, 1.987057, -2.014827]  # t=224
TRANSPORT_225_JOINTS = [0.110560, -0.773526, -0.488000, -2.663764, -0.342410, 1.996560, -2.020181]  # t=225
TRANSPORT_228_JOINTS = [0.110842, -0.761615, -0.491681, -2.685580, -0.371803, 2.028325, -2.040300]  # t=228
TRANSPORT_231_JOINTS = [0.108736, -0.746715, -0.505185, -2.710507, -0.402281, 2.069641, -2.063729]  # t=231
TRANSPORT_232_JOINTS = [0.108096, -0.744948, -0.506920, -2.716434, -0.409853, 2.079472, -2.071777]  # t=232
TRANSPORT_234_JOINTS = [0.107065, -0.749592, -0.507307, -2.724196, -0.416718, 2.093058, -2.093533]  # t=234
TRANSPORT_236_JOINTS = [0.105610, -0.754676, -0.508825, -2.729732, -0.418656, 2.098499, -2.110008]  # t=236
TRANSPORT_237_JOINTS = [0.105103, -0.756424, -0.509384, -2.731672, -0.419162, 2.100083, -2.117110]  # t=237
TRANSPORT_240_JOINTS = [0.104395, -0.759505, -0.510715, -2.734822, -0.419546, 2.102675, -2.136081]  # t=240
TRANSPORT_243_JOINTS = [0.105215, -0.756201, -0.511924, -2.735300, -0.419341, 2.110371, -2.145261]  # t=243
TRANSPORT_244_JOINTS = [0.105836, -0.753872, -0.512158, -2.735023, -0.419040, 2.113806, -2.146842]  # t=244
TRANSPORT_246_JOINTS = [0.107888, -0.746520, -0.512643, -2.733726, -0.417860, 2.123086, -2.150082]  # t=246
TRANSPORT_248_JOINTS = [0.109955, -0.739038, -0.512706, -2.731127, -0.415946, 2.129360, -2.153047]  # t=248
TRANSPORT_249_JOINTS = [0.111248, -0.734486, -0.512784, -2.729603, -0.414766, 2.133840, -2.155062]  # t=249
TRANSPORT_252_JOINTS = [0.116209, -0.716316, -0.513167, -2.723324, -0.409788, 2.150385, -2.163440]  # t=252
TRANSPORT_254_JOINTS = [0.118868, -0.704884, -0.512839, -2.717465, -0.405628, 2.155836, -2.165914]  # t=254
PLACE_256_JOINTS = [0.119812, -0.699046, -0.511778, -2.712230, -0.402023, 2.153371, -2.167309]  # t=256
PLACE_258_JOINTS = [0.119655, -0.695782, -0.511603, -2.708692, -0.400182, 2.151920, -2.169378]  # t=258
PLACE_260_JOINTS = [0.118416, -0.693905, -0.514839, -2.706040, -0.400629, 2.155308, -2.175954]  # t=260
PLACE_262_JOINTS = [0.115625, -0.688855, -0.525382, -2.703342, -0.405949, 2.161381, -2.187914]  # t=262
PLACE_264_JOINTS = [0.113739, -0.680790, -0.538341, -2.701965, -0.410376, 2.171682, -2.205125]  # t=264
PLACE_266_JOINTS = [0.113485, -0.670737, -0.550065, -2.700504, -0.412365, 2.184472, -2.224124]  # t=266
PLACE_268_JOINTS = [0.115651, -0.658173, -0.554762, -2.699101, -0.410381, 2.200768, -2.230226]  # t=268
PLACE_270_JOINTS = [0.120172, -0.638632, -0.556710, -2.696014, -0.406170, 2.222737, -2.230438]  # t=270
PLACE_272_JOINTS = [0.125635, -0.615685, -0.557276, -2.689724, -0.399457, 2.243891, -2.230447]  # t=272
PLACE_274_JOINTS = [0.131147, -0.592714, -0.556276, -2.679882, -0.390243, 2.259521, -2.231053]  # t=274
PLACE_275_JOINTS = [0.133274, -0.583166, -0.555285, -2.674350, -0.385326, 2.262997, -2.231914]  # t=275
PLACE_276_JOINTS = [0.134792, -0.575354, -0.554089, -2.668948, -0.380596, 2.263921, -2.233122]  # t=276
PLACE_278_JOINTS = [0.135761, -0.565497, -0.551337, -2.659939, -0.372630, 2.260180, -2.236158]  # t=278
PLACE_280_JOINTS = [0.134900, -0.560685, -0.548591, -2.654141, -0.367020, 2.255657, -2.239114]  # t=280
PLACE_282_JOINTS = [0.133239, -0.557745, -0.546018, -2.651020, -0.363173, 2.253288, -2.241354]  # t=282
PLACE_284_JOINTS = [0.131188, -0.555939, -0.543586, -2.649620, -0.360462, 2.252497, -2.242961]  # t=284
PLACE_286_JOINTS = [0.129011, -0.555033, -0.541350, -2.649203, -0.358401, 2.252879, -2.244178]  # t=286
PLACE_288_JOINTS = [0.126838, -0.555057, -0.539559, -2.649418, -0.356576, 2.255300, -2.245359]  # t=288
PLACE_290_JOINTS = [0.124730, -0.555210, -0.538067, -2.650193, -0.355434, 2.257179, -2.246251]  # t=290
PLACE_292_JOINTS = [0.122257, -0.558525, -0.536075, -2.650498, -0.354776, 2.254438, -2.246956]  # t=292
PLACE_293_JOINTS = [0.120078, -0.565623, -0.534004, -2.649890, -0.354925, 2.245343, -2.247309]  # t=293
RELEASE_POSE_293_JOINTS = [0.120078, -0.565623, -0.534004, -2.649890, -0.354925, 2.245343, -2.247309]  # t=293
RETRACT_295_JOINTS = [0.111958, -0.600136, -0.526108, -2.646019, -0.358213, 2.207078, -2.246963]  # t=295
RETRACT_297_JOINTS = [0.099108, -0.657852, -0.514118, -2.644720, -0.369291, 2.147817, -2.242650]  # t=297
RETRACT_299_JOINTS = [0.083756, -0.733633, -0.500666, -2.647673, -0.382161, 2.076324, -2.241489]  # t=299
RETRACT_300_JOINTS = [0.075674, -0.778432, -0.492057, -2.651710, -0.388090, 2.039541, -2.241085]  # t=300
RETRACT_301_JOINTS = [0.068316, -0.826456, -0.479519, -2.659417, -0.392254, 2.004250, -2.238206]  # t=301
RETRACT_303_JOINTS = [0.055232, -0.924611, -0.453572, -2.680296, -0.395618, 1.944700, -2.228855]  # t=303
RETRACT_305_JOINTS = [0.042145, -1.032928, -0.426554, -2.699051, -0.391787, 1.877748, -2.222049]  # t=305
RETRACT_307_JOINTS = [0.029049, -1.147345, -0.400545, -2.713386, -0.386408, 1.804855, -2.220401]  # t=307
RETRACT_309_JOINTS = [0.021575, -1.256517, -0.368960, -2.722000, -0.369050, 1.747102, -2.219967]  # t=309
RETRACT_311_JOINTS = [0.020028, -1.348980, -0.334069, -2.727813, -0.346286, 1.708970, -2.210712]  # t=311
RETRACT_313_JOINTS = [0.027494, -1.417975, -0.285681, -2.731948, -0.307682, 1.685588, -2.191723]  # t=313
RETRACT_315_JOINTS = [0.044971, -1.461365, -0.221706, -2.738358, -0.251599, 1.673605, -2.173963]  # t=315
RETRACT_317_JOINTS = [0.067778, -1.484217, -0.153814, -2.738553, -0.193683, 1.666098, -2.160458]  # t=317
RETRACT_319_JOINTS = [0.091244, -1.496067, -0.092057, -2.731322, -0.142577, 1.651614, -2.146363]  # t=319
RETRACT_321_JOINTS = [0.116558, -1.494720, -0.028859, -2.720233, -0.089902, 1.631828, -2.133376]  # t=321
RETRACT_323_JOINTS = [0.141725, -1.480637, 0.032130, -2.701381, -0.041066, 1.603316, -2.120800]  # t=323
RETRACT_325_JOINTS = [0.164752, -1.459121, 0.081570, -2.673916, 0.000329, 1.568752, -2.110225]  # t=325
RETRACT_326_JOINTS = [0.175080, -1.447546, 0.100409, -2.659606, 0.017707, 1.550437, -2.105621]  # t=326
APPROACH_000_JOINTS = [0.003431, -1.053115, 0.005184, -2.311799, 0.030015, 1.500472, 0.685453]  # 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_pregrasp():
    """Coarse approach into the pregrasp corridor."""
    moveJoint(APPROACH_000_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_005_JOINTS, input_type='joint', steps=4, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_007_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_010_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_015_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_020_JOINTS, input_type='joint', steps=5, 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_029_JOINTS, input_type='joint', steps=4, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_030_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_035_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_040_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_041_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_045_JOINTS, input_type='joint', steps=4, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_048_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_050_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_055_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_060_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_065_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_069_JOINTS, input_type='joint', steps=4, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_070_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_071_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_075_JOINTS, input_type='joint', steps=4, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_080_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_084_JOINTS, input_type='joint', steps=4, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_085_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_090_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_095_JOINTS, input_type='joint', steps=5, 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)

def execute_grasp_approach():
    """Final Cartesian descent into grasp alignment."""
    moveJoint(DESCEND_114_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_116_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_118_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_119_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_120_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_122_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_124_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_126_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_128_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_130_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_132_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_134_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_136_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_138_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_140_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_142_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_144_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_146_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_148_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_150_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_152_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_154_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_156_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_158_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_159_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_160_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(DESCEND_161_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(DESCEND_162_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(DESCEND_164_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)

def close_gripper_on_object():
    """Close the gripper and let the grasp settle briefly."""
    grasp(hold_target=GRASP_HOLD_167_JOINTS, input_type='joint', close_steps=1, settle_steps=0, gripper=1.0, require_contact_count=4)
    wait(duration=0.05, hold_target=GRASP_HOLD_167_JOINTS, input_type='joint', gripper=1.0)

def lift_object():
    """Lift the grasped object clear of the counter."""
    moveJoint(LIFT_168_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(LIFT_169_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(LIFT_170_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(LIFT_171_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(LIFT_172_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(LIFT_173_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(LIFT_174_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(LIFT_175_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(LIFT_176_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(LIFT_177_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(LIFT_178_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(LIFT_179_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(LIFT_180_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)

def transport_to_place():
    """Carry the object through the curved transport corridor."""
    moveJoint(TRANSPORT_183_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_184_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_186_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_188_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_189_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_192_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_195_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_196_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_198_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_200_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_201_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_204_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_207_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_208_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_210_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_212_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_213_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_216_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_219_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_220_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_222_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_224_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_225_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_228_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_231_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_232_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_234_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_236_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_237_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_240_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_243_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_244_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_246_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_248_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_249_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_252_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_254_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)

def prepare_release():
    """Set the object into the receptacle and stabilize before release."""
    moveJoint(PLACE_256_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PLACE_258_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PLACE_260_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PLACE_262_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PLACE_264_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PLACE_266_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PLACE_268_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PLACE_270_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PLACE_272_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PLACE_274_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PLACE_275_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PLACE_276_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PLACE_278_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PLACE_280_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PLACE_282_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PLACE_284_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PLACE_286_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PLACE_288_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PLACE_290_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PLACE_292_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PLACE_293_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    wait(duration=0.05, hold_target=RELEASE_POSE_293_JOINTS, input_type='joint', gripper=-1.0)

def release_object():
    """Open the gripper and hold briefly to avoid disturbing the placement."""
    release(hold_target=RELEASE_POSE_293_JOINTS, input_type='joint', open_steps=1, settle_steps=0, gripper=-1.0)
    wait(duration=0.05, hold_target=RELEASE_POSE_293_JOINTS, input_type='joint', gripper=-1.0)

def retreat_after_release():
    """Retreat away from the placed object without clipping it."""
    moveJoint(RETRACT_295_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_297_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_299_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_300_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_301_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_303_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_305_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_307_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_309_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_311_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_313_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_315_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_317_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_319_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_321_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_323_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_325_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_326_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)

move_to_pregrasp()
execute_grasp_approach()
close_gripper_on_object()
lift_object()
transport_to_place()
prepare_release()
release_object()
retreat_after_release()

# 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

Add the marshmallow to the tupperware that contains the hot dog.

dessert

all marshmallow sweets food in_container