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

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

SCENE_ARTIFACT = '../../../artifacts/20260324/AdjustToasterOvenTemperature/20260324_205246_adjust-toaster-oven-temperature_episode_000000_action2code-open-loop-joint_initial-scene.json'
POLICY_METADATA = {
    'policy_kind': 'open_loop_joint',
    'policy_variant': 'open-loop-joint',
    'task_name': 'AdjustToasterOvenTemperature',
    'episode_id': 'episode_000000',
    'scene_artifact_path': '../../../artifacts/20260324/AdjustToasterOvenTemperature/20260324_205246_adjust-toaster-oven-temperature_episode_000000_action2code-open-loop-joint_initial-scene.json',
    'fitting_summary_path': '../../../artifacts/20260324/AdjustToasterOvenTemperature/20260324_205246_adjust-toaster-oven-temperature_episode_000000_action2code-open-loop-joint_fitting-summary.json',
    'extracted_pose_metadata_path': '../../../artifacts/20260324/AdjustToasterOvenTemperature/20260324_205246_adjust-toaster-oven-temperature_episode_000000_action2code-open-loop-joint_extracted-pose-metadata.json',
    'stable_grasp_contact_t': 218,
    'stable_release_contact_loss_t': 218,
    '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_005_JOINTS = [0.012989, -1.037815, -0.044813, -2.281597, 0.036483, 1.492026, 0.699067]  # t=5
APPROACH_007_JOINTS = [0.008926, -1.052557, -0.043478, -2.279893, 0.038946, 1.512731, 0.694177]  # t=7
APPROACH_010_JOINTS = [0.003073, -1.097143, -0.041167, -2.254531, 0.042880, 1.533194, 0.687269]  # t=10
APPROACH_014_JOINTS = [-0.004789, -1.163207, -0.046417, -2.209743, 0.039728, 1.542886, 0.680502]  # t=14
APPROACH_015_JOINTS = [-0.006716, -1.176217, -0.049005, -2.200451, 0.037569, 1.544991, 0.679759]  # t=15
APPROACH_016_JOINTS = [-0.008620, -1.187607, -0.052353, -2.192089, 0.034555, 1.546034, 0.679066]  # t=16
APPROACH_019_JOINTS = [-0.013469, -1.212716, -0.061581, -2.177650, 0.020731, 1.546201, 0.670348]  # t=19
APPROACH_020_JOINTS = [-0.014906, -1.218158, -0.060069, -2.178291, 0.014610, 1.547451, 0.668350]  # t=20
APPROACH_022_JOINTS = [-0.017479, -1.224564, -0.050641, -2.183509, -0.003773, 1.551264, 0.660396]  # t=22
APPROACH_025_JOINTS = [-0.020490, -1.231648, -0.032488, -2.195590, -0.036936, 1.555245, 0.642438]  # t=25
APPROACH_030_JOINTS = [-0.022696, -1.245345, -0.016003, -2.218720, -0.064576, 1.563816, 0.630069]  # t=30
APPROACH_031_JOINTS = [-0.022768, -1.247895, -0.016320, -2.222862, -0.065040, 1.565427, 0.630065]  # t=31
APPROACH_035_JOINTS = [-0.022617, -1.254463, -0.027442, -2.232202, -0.057827, 1.570988, 0.633224]  # t=35
APPROACH_036_JOINTS = [-0.022494, -1.255220, -0.034707, -2.233914, -0.051015, 1.570992, 0.635944]  # t=36
APPROACH_040_JOINTS = [-0.022354, -1.259906, -0.084809, -2.246838, -0.011856, 1.572537, 0.649069]  # t=40
APPROACH_045_JOINTS = [-0.024756, -1.261362, -0.163862, -2.258093, 0.047829, 1.580273, 0.683486]  # t=45
APPROACH_048_JOINTS = [-0.028204, -1.262897, -0.200171, -2.268658, 0.086708, 1.594394, 0.718827]  # t=48
APPROACH_050_JOINTS = [-0.030818, -1.263993, -0.217534, -2.279328, 0.114176, 1.613284, 0.744337]  # t=50
APPROACH_054_JOINTS = [-0.035024, -1.275906, -0.250411, -2.314199, 0.183209, 1.665597, 0.773561]  # t=54
APPROACH_055_JOINTS = [-0.036807, -1.285149, -0.258097, -2.329467, 0.200043, 1.682820, 0.775510]  # t=55
APPROACH_059_JOINTS = [-0.047385, -1.345816, -0.289525, -2.413921, 0.274677, 1.781508, 0.771968]  # t=59
APPROACH_060_JOINTS = [-0.050925, -1.364986, -0.297100, -2.439518, 0.292218, 1.808891, 0.768444]  # t=60
APPROACH_062_JOINTS = [-0.059200, -1.404259, -0.311519, -2.493823, 0.322795, 1.863979, 0.761404]  # t=62
APPROACH_065_JOINTS = [-0.070356, -1.437256, -0.313978, -2.571024, 0.355414, 1.954611, 0.766649]  # t=65
APPROACH_068_JOINTS = [-0.073008, -1.436670, -0.307942, -2.614760, 0.391613, 2.016507, 0.775690]  # t=68
APPROACH_070_JOINTS = [-0.071503, -1.424913, -0.308041, -2.630312, 0.421507, 2.047725, 0.784491]  # t=70
APPROACH_071_JOINTS = [-0.070470, -1.418833, -0.309099, -2.635256, 0.436360, 2.059619, 0.787582]  # t=71
APPROACH_075_JOINTS = [-0.064918, -1.393527, -0.316869, -2.646510, 0.497781, 2.098179, 0.793277]  # t=75
APPROACH_078_JOINTS = [-0.060336, -1.371610, -0.322472, -2.651034, 0.537143, 2.124501, 0.790954]  # t=78
APPROACH_080_JOINTS = [-0.055072, -1.350819, -0.322929, -2.652798, 0.566222, 2.147155, 0.786135]  # t=80
APPROACH_085_JOINTS = [-0.045108, -1.305089, -0.320326, -2.651730, 0.618164, 2.192895, 0.774302]  # t=85
APPROACH_090_JOINTS = [-0.042161, -1.269775, -0.306415, -2.650449, 0.638514, 2.242463, 0.774939]  # t=90
APPROACH_091_JOINTS = [-0.041922, -1.263133, -0.302716, -2.651136, 0.640342, 2.253101, 0.775968]  # t=91
APPROACH_094_JOINTS = [-0.040072, -1.239904, -0.289905, -2.657711, 0.647928, 2.295046, 0.777607]  # t=94
APPROACH_095_JOINTS = [-0.038266, -1.229336, -0.283945, -2.659314, 0.652833, 2.313525, 0.777563]  # t=95
APPROACH_100_JOINTS = [-0.024231, -1.168656, -0.253662, -2.659279, 0.682765, 2.405500, 0.775869]  # t=100
APPROACH_105_JOINTS = [-0.008119, -1.113776, -0.234213, -2.655185, 0.713707, 2.477814, 0.767512]  # t=105
APPROACH_110_JOINTS = [0.003404, -1.084575, -0.243232, -2.655126, 0.740386, 2.506722, 0.743668]  # t=110
APPROACH_114_JOINTS = [0.013841, -1.057703, -0.252348, -2.650169, 0.767999, 2.523578, 0.721345]  # t=114
APPROACH_115_JOINTS = [0.018051, -1.046395, -0.252552, -2.645484, 0.778853, 2.529595, 0.716154]  # t=115
APPROACH_120_JOINTS = [0.044646, -0.971610, -0.252916, -2.607351, 0.852450, 2.562291, 0.685968]  # t=120
APPROACH_125_JOINTS = [0.066330, -0.905868, -0.260838, -2.581321, 0.933590, 2.583201, 0.636252]  # t=125
APPROACH_130_JOINTS = [0.077975, -0.864074, -0.270201, -2.577812, 1.011348, 2.592865, 0.570868]  # t=130
APPROACH_135_JOINTS = [0.084895, -0.819839, -0.274917, -2.568137, 1.089440, 2.598356, 0.508040]  # t=135
APPROACH_140_JOINTS = [0.089183, -0.760009, -0.286081, -2.542191, 1.173861, 2.595440, 0.441360]  # t=140
APPROACH_145_JOINTS = [0.085562, -0.701888, -0.321274, -2.508347, 1.242293, 2.554590, 0.371698]  # t=145
APPROACH_146_JOINTS = [0.084122, -0.693698, -0.327046, -2.501124, 1.254601, 2.541625, 0.365348]  # t=146
PRESS_148_JOINTS = [0.077815, -0.689390, -0.328066, -2.494870, 1.266948, 2.530465, 0.380088]  # t=148
PRESS_150_JOINTS = [0.071016, -0.683711, -0.322996, -2.488810, 1.271833, 2.530597, 0.404051]  # t=150
PRESS_151_JOINTS = [0.067738, -0.679919, -0.318695, -2.485457, 1.272947, 2.534402, 0.417696]  # t=151
PRESS_152_JOINTS = [0.064454, -0.675996, -0.312893, -2.482329, 1.272455, 2.541114, 0.432911]  # t=152
PRESS_153_JOINTS = [0.061163, -0.672422, -0.306111, -2.479706, 1.270599, 2.549445, 0.448770]  # t=153
PRESS_154_JOINTS = [0.057925, -0.669568, -0.298818, -2.477907, 1.267095, 2.557851, 0.462750]  # t=154
PRESS_156_JOINTS = [0.051970, -0.670054, -0.288331, -2.477978, 1.263110, 2.564425, 0.474401]  # t=156
PRESS_158_JOINTS = [0.047452, -0.670693, -0.281637, -2.477230, 1.264899, 2.565441, 0.476954]  # t=158
PRESS_160_JOINTS = [0.043794, -0.670914, -0.275667, -2.475594, 1.266962, 2.566278, 0.478957]  # t=160
PRESS_162_JOINTS = [0.040662, -0.670889, -0.271500, -2.475006, 1.269147, 2.566925, 0.478689]  # t=162
PRESS_164_JOINTS = [0.038258, -0.670891, -0.268744, -2.474927, 1.272534, 2.566901, 0.475150]  # t=164
PRESS_166_JOINTS = [0.036344, -0.671103, -0.266336, -2.474957, 1.276881, 2.567280, 0.469786]  # t=166
PRESS_168_JOINTS = [0.035120, -0.671903, -0.263727, -2.475326, 1.284956, 2.569273, 0.458778]  # t=168
PRESS_170_JOINTS = [0.034530, -0.672879, -0.262524, -2.475661, 1.297852, 2.569687, 0.443509]  # t=170
PRESS_172_JOINTS = [0.033644, -0.673291, -0.261224, -2.476004, 1.307101, 2.570030, 0.432046]  # t=172
PRESS_174_JOINTS = [0.032643, -0.673662, -0.259753, -2.476369, 1.315051, 2.570595, 0.422189]  # t=174
PRESS_176_JOINTS = [0.031644, -0.674217, -0.257886, -2.477074, 1.323857, 2.572452, 0.411946]  # t=176
PRESS_178_JOINTS = [0.030250, -0.674441, -0.255909, -2.477439, 1.328582, 2.573768, 0.406879]  # t=178
PRESS_180_JOINTS = [0.028615, -0.674280, -0.254425, -2.477364, 1.329289, 2.573480, 0.406559]  # t=180
PRESS_182_JOINTS = [0.027173, -0.673986, -0.253676, -2.477216, 1.329791, 2.572116, 0.406570]  # t=182
PRESS_184_JOINTS = [0.025879, -0.673572, -0.253471, -2.476983, 1.329992, 2.569884, 0.407067]  # t=184
PRESS_186_JOINTS = [0.024205, -0.672720, -0.253239, -2.476188, 1.325715, 2.566822, 0.414620]  # t=186
PRESS_188_JOINTS = [0.022381, -0.672116, -0.252199, -2.475697, 1.319429, 2.565873, 0.429094]  # t=188
PRESS_190_JOINTS = [0.021157, -0.672313, -0.251965, -2.476116, 1.320062, 2.565466, 0.442392]  # t=190
PRESS_192_JOINTS = [0.020551, -0.673212, -0.252038, -2.476872, 1.327309, 2.565846, 0.453429]  # t=192
PRESS_193_JOINTS = [0.020297, -0.673815, -0.251839, -2.477440, 1.331773, 2.566724, 0.458997]  # t=193
PRESS_194_JOINTS = [0.020094, -0.674446, -0.252672, -2.479780, 1.339640, 2.567757, 0.463663]  # t=194
PRESS_196_JOINTS = [0.020310, -0.675737, -0.256868, -2.487340, 1.370172, 2.568923, 0.465121]  # t=196
PRESS_198_JOINTS = [0.020518, -0.677727, -0.259320, -2.495813, 1.410113, 2.573032, 0.465632]  # t=198
PRESS_200_JOINTS = [0.020352, -0.680911, -0.258472, -2.506416, 1.456040, 2.583715, 0.460740]  # t=200
PRESS_202_JOINTS = [0.019671, -0.684428, -0.254159, -2.515686, 1.504272, 2.597973, 0.454088]  # t=202
PRESS_204_JOINTS = [0.017568, -0.688539, -0.246276, -2.523291, 1.546224, 2.614679, 0.456591]  # t=204
PRESS_205_JOINTS = [0.015930, -0.689821, -0.241496, -2.527012, 1.562447, 2.622991, 0.463575]  # t=205
PRESS_206_JOINTS = [0.013979, -0.690897, -0.235504, -2.528106, 1.574128, 2.631330, 0.473680]  # t=206
PRESS_208_JOINTS = [0.009098, -0.691865, -0.223714, -2.529199, 1.588336, 2.646635, 0.515468]  # t=208
PRESS_210_JOINTS = [0.003387, -0.692573, -0.211036, -2.528499, 1.589416, 2.661150, 0.569882]  # t=210
PRESS_212_JOINTS = [-0.002620, -0.693127, -0.198625, -2.527862, 1.582198, 2.674991, 0.633496]  # t=212
PRESS_214_JOINTS = [-0.008687, -0.694420, -0.187680, -2.528673, 1.566280, 2.686827, 0.704134]  # t=214
PRESS_215_JOINTS = [-0.011660, -0.695248, -0.182609, -2.529308, 1.554345, 2.692197, 0.743728]  # t=215
PRESS_216_JOINTS = [-0.014528, -0.696150, -0.177909, -2.529827, 1.540442, 2.697059, 0.785395]  # t=216
PRESS_218_JOINTS = [-0.019791, -0.698018, -0.169759, -2.531153, 1.508622, 2.705129, 0.872712]  # t=218
PRESS_220_JOINTS = [-0.024157, -0.699856, -0.163240, -2.532603, 1.475743, 2.711477, 0.961111]  # t=220
PRESS_222_JOINTS = [-0.027235, -0.702345, -0.158729, -2.535290, 1.449352, 2.716055, 1.041428]  # t=222
PRESS_224_JOINTS = [-0.029169, -0.706017, -0.155780, -2.539564, 1.428416, 2.718234, 1.114298]  # t=224
PRESS_226_JOINTS = [-0.030249, -0.708490, -0.153868, -2.543378, 1.410262, 2.718902, 1.184942]  # t=226
PRESS_228_JOINTS = [-0.031071, -0.710188, -0.152106, -2.545745, 1.390436, 2.719588, 1.256346]  # t=228
PRESS_230_JOINTS = [-0.031920, -0.711702, -0.150396, -2.547289, 1.367630, 2.720072, 1.328664]  # t=230
PRESS_232_JOINTS = [-0.032340, -0.713048, -0.149447, -2.548075, 1.346997, 2.719860, 1.397032]  # t=232
PRESS_233_JOINTS = [-0.032451, -0.714339, -0.148981, -2.548795, 1.337465, 2.719729, 1.430218]  # t=233
APPROACH_000_JOINTS = [0.020043, -1.015707, -0.043832, -2.277006, 0.034405, 1.495798, 0.714649]  # 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_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_014_JOINTS, input_type='joint', steps=4, 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_019_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_020_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_022_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_025_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_030_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_031_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_035_JOINTS, input_type='joint', steps=4, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_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_045_JOINTS, input_type='joint', steps=5, 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_054_JOINTS, input_type='joint', steps=4, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_055_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_059_JOINTS, input_type='joint', steps=4, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_060_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_062_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_065_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_068_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_070_JOINTS, input_type='joint', steps=2, 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_078_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_080_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_085_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_090_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_091_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_094_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_095_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_100_JOINTS, input_type='joint', steps=5, 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_114_JOINTS, input_type='joint', steps=4, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_115_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_120_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_125_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_130_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_135_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_140_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_145_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_146_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_148_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_150_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_151_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_152_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_153_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_154_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_156_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_158_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_160_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_162_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_164_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_166_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_168_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_170_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_172_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_174_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_176_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_178_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_180_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_182_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_184_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_186_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_188_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_190_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_192_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_193_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_194_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_196_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_198_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_200_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_202_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_204_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_205_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_206_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_208_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_210_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_212_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_214_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_215_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_216_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_218_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_220_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_222_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_224_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_226_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_228_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_230_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_232_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PRESS_233_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)

move_to_control_panel()
press_control()

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


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

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

SCENE_ARTIFACT = '../../../artifacts/20260324/AdjustWaterTemperature/20260324_205247_adjust-water-temperature_episode_000000_action2code-open-loop-joint_initial-scene.json'
POLICY_METADATA = {
    'policy_kind': 'open_loop_joint',
    'policy_variant': 'open-loop-joint',
    'task_name': 'AdjustWaterTemperature',
    'episode_id': 'episode_000000',
    'scene_artifact_path': '../../../artifacts/20260324/AdjustWaterTemperature/20260324_205247_adjust-water-temperature_episode_000000_action2code-open-loop-joint_initial-scene.json',
    'fitting_summary_path': '../../../artifacts/20260324/AdjustWaterTemperature/20260324_205247_adjust-water-temperature_episode_000000_action2code-open-loop-joint_fitting-summary.json',
    'extracted_pose_metadata_path': '../../../artifacts/20260324/AdjustWaterTemperature/20260324_205247_adjust-water-temperature_episode_000000_action2code-open-loop-joint_extracted-pose-metadata.json',
    'stable_grasp_contact_t': 243,
    'stable_release_contact_loss_t': 243,
    '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_003_JOINTS = [0.002579, -1.034126, -0.027043, -2.282255, 0.033292, 1.538172, 0.689823]  # t=3
APPROACH_005_JOINTS = [0.003426, -1.054671, -0.031165, -2.303988, 0.042554, 1.550061, 0.646263]  # t=5
APPROACH_010_JOINTS = [0.008565, -1.150319, -0.078697, -2.423724, 0.119216, 1.674475, 0.486010]  # t=10
APPROACH_015_JOINTS = [0.013420, -1.221816, -0.158189, -2.528129, 0.231938, 1.763784, 0.342651]  # t=15
APPROACH_020_JOINTS = [0.021763, -1.215650, -0.220685, -2.573299, 0.339163, 1.821208, 0.217171]  # t=20
APPROACH_025_JOINTS = [0.034025, -1.191178, -0.287795, -2.617725, 0.462229, 1.910517, 0.044250]  # t=25
APPROACH_030_JOINTS = [0.061405, -1.124366, -0.345890, -2.644420, 0.628402, 1.986242, -0.150863]  # t=30
APPROACH_035_JOINTS = [0.092078, -1.038028, -0.400014, -2.648552, 0.788399, 2.012808, -0.349047]  # t=35
APPROACH_040_JOINTS = [0.114294, -0.941791, -0.433034, -2.626487, 0.901688, 2.007028, -0.481250]  # t=40
APPROACH_045_JOINTS = [0.130409, -0.833143, -0.436525, -2.577607, 0.982924, 2.009367, -0.555736]  # t=45
APPROACH_050_JOINTS = [0.139067, -0.725291, -0.430099, -2.516877, 1.039756, 2.007928, -0.610162]  # t=50
APPROACH_055_JOINTS = [0.140114, -0.625982, -0.429156, -2.480468, 1.100328, 2.008133, -0.694937]  # t=55
APPROACH_060_JOINTS = [0.138566, -0.521184, -0.427255, -2.460280, 1.188444, 2.014669, -0.826302]  # t=60
APPROACH_065_JOINTS = [0.130294, -0.418152, -0.420632, -2.437105, 1.282580, 2.001781, -0.968337]  # t=65
APPROACH_070_JOINTS = [0.109814, -0.328796, -0.415704, -2.411327, 1.326807, 1.935124, -1.071154]  # t=70
APPROACH_075_JOINTS = [0.084414, -0.229781, -0.408512, -2.376349, 1.336685, 1.842237, -1.167381]  # t=75
APPROACH_080_JOINTS = [0.057329, -0.091480, -0.389669, -2.293248, 1.347429, 1.752797, -1.233572]  # t=80
APPROACH_085_JOINTS = [0.019506, 0.007832, -0.360305, -2.213311, 1.382070, 1.700322, -1.276191]  # t=85
APPROACH_090_JOINTS = [-0.020946, 0.066347, -0.325069, -2.158385, 1.416200, 1.669690, -1.320249]  # t=90
APPROACH_095_JOINTS = [-0.049916, 0.127580, -0.270734, -2.103663, 1.453436, 1.677593, -1.350037]  # t=95
APPROACH_100_JOINTS = [-0.071341, 0.185556, -0.218289, -2.054202, 1.481600, 1.694951, -1.366978]  # t=100
APPROACH_105_JOINTS = [-0.088355, 0.239945, -0.177492, -2.016578, 1.498869, 1.706103, -1.394670]  # t=105
APPROACH_110_JOINTS = [-0.102428, 0.297823, -0.148215, -1.968424, 1.515487, 1.721161, -1.408444]  # t=110
APPROACH_115_JOINTS = [-0.114087, 0.360317, -0.124606, -1.897384, 1.526501, 1.734622, -1.402549]  # t=115
APPROACH_120_JOINTS = [-0.125145, 0.421686, -0.105031, -1.819442, 1.526281, 1.734735, -1.389294]  # t=120
APPROACH_125_JOINTS = [-0.135407, 0.482088, -0.085985, -1.745536, 1.518640, 1.728042, -1.383094]  # t=125
APPROACH_130_JOINTS = [-0.144177, 0.535995, -0.065405, -1.686871, 1.511571, 1.719268, -1.394415]  # t=130
APPROACH_135_JOINTS = [-0.150117, 0.579914, -0.044865, -1.634629, 1.511844, 1.722954, -1.389133]  # t=135
APPROACH_140_JOINTS = [-0.154371, 0.623310, -0.028059, -1.578385, 1.517213, 1.731344, -1.375148]  # t=140
APPROACH_145_JOINTS = [-0.158928, 0.668201, -0.018828, -1.528455, 1.516045, 1.735777, -1.369220]  # t=145
APPROACH_149_JOINTS = [-0.162852, 0.701914, -0.011546, -1.491858, 1.517448, 1.736603, -1.367123]  # t=149
APPROACH_150_JOINTS = [-0.164083, 0.708176, -0.009454, -1.484312, 1.518238, 1.733807, -1.366360]  # t=150
PRESS_151_JOINTS = [-0.165905, 0.710240, -0.008409, -1.482600, 1.518828, 1.728433, -1.368270]  # t=151
PRESS_152_JOINTS = [-0.167452, 0.711489, -0.006846, -1.482254, 1.520913, 1.725467, -1.370599]  # t=152
PRESS_154_JOINTS = [-0.169948, 0.712965, -0.003220, -1.483139, 1.526830, 1.723046, -1.375498]  # t=154
PRESS_156_JOINTS = [-0.171735, 0.713550, 0.000321, -1.485354, 1.533987, 1.722932, -1.380703]  # t=156
PRESS_158_JOINTS = [-0.172820, 0.713822, 0.003134, -1.487741, 1.540905, 1.723314, -1.385620]  # t=158
PRESS_160_JOINTS = [-0.173369, 0.714257, 0.005230, -1.489626, 1.547235, 1.723157, -1.390067]  # t=160
PRESS_162_JOINTS = [-0.173636, 0.715212, 0.006341, -1.490251, 1.551656, 1.721287, -1.393610]  # t=162
PRESS_164_JOINTS = [-0.173659, 0.716482, 0.006879, -1.490093, 1.554948, 1.718747, -1.396663]  # t=164
PRESS_166_JOINTS = [-0.173744, 0.718154, 0.006853, -1.489072, 1.556935, 1.714579, -1.398911]  # t=166
PRESS_168_JOINTS = [-0.173593, 0.721839, 0.007192, -1.484819, 1.554989, 1.706125, -1.399314]  # t=168
PRESS_170_JOINTS = [-0.173571, 0.726967, 0.007090, -1.478002, 1.550091, 1.694823, -1.398912]  # t=170
PRESS_172_JOINTS = [-0.173353, 0.732770, 0.007570, -1.469909, 1.543409, 1.683292, -1.398054]  # t=172
PRESS_174_JOINTS = [-0.173504, 0.738388, 0.007742, -1.461632, 1.535894, 1.672124, -1.397077]  # t=174
PRESS_176_JOINTS = [-0.173991, 0.743797, 0.007755, -1.453207, 1.527723, 1.661628, -1.395935]  # t=176
PRESS_177_JOINTS = [-0.174445, 0.746402, 0.007635, -1.449070, 1.523723, 1.656460, -1.395313]  # t=177
PRESS_178_JOINTS = [-0.175049, 0.748928, 0.007385, -1.444986, 1.520030, 1.651897, -1.394854]  # t=178
PRESS_180_JOINTS = [-0.176570, 0.752957, 0.007194, -1.438614, 1.514062, 1.644396, -1.394828]  # t=180
PRESS_181_JOINTS = [-0.177332, 0.754708, 0.007208, -1.435802, 1.511192, 1.641020, -1.394799]  # t=181
PRESS_182_JOINTS = [-0.177939, 0.756495, 0.007526, -1.432964, 1.507819, 1.637196, -1.394626]  # t=182
PRESS_184_JOINTS = [-0.177920, 0.761336, 0.010674, -1.425322, 1.499862, 1.630043, -1.393312]  # t=184
PRESS_186_JOINTS = [-0.178325, 0.766248, 0.012900, -1.417097, 1.491016, 1.622096, -1.391599]  # t=186
PRESS_188_JOINTS = [-0.178630, 0.771540, 0.015379, -1.408275, 1.481930, 1.613792, -1.389751]  # t=188
PRESS_190_JOINTS = [-0.178989, 0.776937, 0.017809, -1.399309, 1.472961, 1.605498, -1.387919]  # t=190
PRESS_192_JOINTS = [-0.179586, 0.782292, 0.019755, -1.390334, 1.464498, 1.597139, -1.386049]  # t=192
PRESS_194_JOINTS = [-0.181247, 0.787352, 0.020006, -1.381616, 1.456928, 1.588191, -1.384100]  # t=194
PRESS_195_JOINTS = [-0.182106, 0.789979, 0.020235, -1.377187, 1.453207, 1.583475, -1.383162]  # t=195
PRESS_196_JOINTS = [-0.182752, 0.792878, 0.020829, -1.372300, 1.449100, 1.578520, -1.382142]  # t=196
PRESS_198_JOINTS = [-0.184239, 0.799418, 0.021628, -1.360895, 1.439498, 1.566364, -1.379684]  # t=198
PRESS_200_JOINTS = [-0.186381, 0.807690, 0.022198, -1.347014, 1.430414, 1.550306, -1.376642]  # t=200
PRESS_202_JOINTS = [-0.188660, 0.818489, 0.024029, -1.330346, 1.422776, 1.530968, -1.375187]  # t=202
PRESS_204_JOINTS = [-0.190977, 0.831562, 0.026445, -1.310645, 1.414334, 1.509599, -1.374668]  # t=204
PRESS_206_JOINTS = [-0.193540, 0.846421, 0.029153, -1.287878, 1.405368, 1.486037, -1.372957]  # t=206
PRESS_208_JOINTS = [-0.196262, 0.862831, 0.032126, -1.262277, 1.395721, 1.461433, -1.369193]  # t=208
PRESS_210_JOINTS = [-0.199095, 0.880689, 0.035553, -1.234066, 1.385647, 1.436227, -1.364341]  # t=210
PRESS_212_JOINTS = [-0.202281, 0.899655, 0.039306, -1.203859, 1.375892, 1.410295, -1.358852]  # t=212
PRESS_214_JOINTS = [-0.205729, 0.919204, 0.043531, -1.172451, 1.366172, 1.383180, -1.353087]  # t=214
PRESS_216_JOINTS = [-0.209182, 0.939929, 0.048134, -1.139865, 1.356021, 1.356740, -1.346568]  # t=216
PRESS_218_JOINTS = [-0.212769, 0.961557, 0.053124, -1.105890, 1.346046, 1.330334, -1.338620]  # t=218
PRESS_220_JOINTS = [-0.217746, 0.982571, 0.056551, -1.072060, 1.336441, 1.303275, -1.330525]  # t=220
PRESS_222_JOINTS = [-0.221886, 1.000927, 0.061382, -1.042695, 1.327324, 1.281902, -1.323254]  # t=222
PRESS_224_JOINTS = [-0.225506, 1.013512, 0.066369, -1.022147, 1.318808, 1.269065, -1.318585]  # t=224
PRESS_226_JOINTS = [-0.228765, 1.022120, 0.070975, -1.007441, 1.310095, 1.260923, -1.315563]  # t=226
PRESS_228_JOINTS = [-0.231705, 1.028556, 0.075322, -0.995971, 1.301740, 1.253951, -1.312171]  # t=228
PRESS_230_JOINTS = [-0.233993, 1.034808, 0.079827, -0.984210, 1.294118, 1.247393, -1.307766]  # t=230
PRESS_232_JOINTS = [-0.236319, 1.041623, 0.083710, -0.971721, 1.286210, 1.238176, -1.304515]  # t=232
PRESS_234_JOINTS = [-0.238524, 1.048599, 0.087500, -0.958727, 1.277907, 1.228951, -1.301966]  # t=234
PRESS_236_JOINTS = [-0.240810, 1.055307, 0.091570, -0.945742, 1.268361, 1.219851, -1.299767]  # t=236
PRESS_238_JOINTS = [-0.243402, 1.060856, 0.096141, -0.934455, 1.257700, 1.211446, -1.298258]  # t=238
PRESS_240_JOINTS = [-0.246475, 1.063709, 0.101550, -0.927228, 1.245350, 1.205451, -1.298070]  # t=240
PRESS_242_JOINTS = [-0.249938, 1.063084, 0.107579, -0.925608, 1.232047, 1.202561, -1.299249]  # t=242
PRESS_243_JOINTS = [-0.251729, 1.061501, 0.110564, -0.926915, 1.225317, 1.202118, -1.300596]  # t=243
PRESS_244_JOINTS = [-0.253524, 1.059014, 0.113406, -0.929736, 1.218653, 1.202339, -1.302512]  # t=244
PRESS_246_JOINTS = [-0.256964, 1.051151, 0.118455, -0.940099, 1.205514, 1.205074, -1.308256]  # t=246
PRESS_248_JOINTS = [-0.260100, 1.039078, 0.122466, -0.957285, 1.192849, 1.211458, -1.316699]  # t=248
PRESS_250_JOINTS = [-0.262818, 1.022281, 0.125388, -0.982035, 1.180637, 1.222306, -1.328100]  # t=250
PRESS_252_JOINTS = [-0.265072, 1.000429, 0.127191, -1.014783, 1.169055, 1.238486, -1.342581]  # t=252
PRESS_254_JOINTS = [-0.266769, 0.973421, 0.128013, -1.055484, 1.158144, 1.260974, -1.360107]  # t=254
PRESS_256_JOINTS = [-0.267872, 0.941231, 0.128221, -1.104162, 1.148254, 1.290873, -1.380452]  # t=256
PRESS_257_JOINTS = [-0.268292, 0.922993, 0.128362, -1.131819, 1.143728, 1.309224, -1.391797]  # t=257
PRESS_258_JOINTS = [-0.268687, 0.903104, 0.128750, -1.161958, 1.139405, 1.330426, -1.404024]  # t=258
APPROACH_000_JOINTS = [0.002977, -1.030809, -0.026424, -2.277712, 0.029467, 1.539352, 0.705861]  # 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_005_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_010_JOINTS, input_type='joint', steps=5, 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_025_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_030_JOINTS, input_type='joint', steps=5, 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_045_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_050_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_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_070_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_075_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_080_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_085_JOINTS, input_type='joint', steps=5, 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_100_JOINTS, input_type='joint', steps=5, 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_115_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_120_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_125_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_130_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_135_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_140_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_145_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_149_JOINTS, input_type='joint', steps=4, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_150_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_151_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_152_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_154_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_156_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_158_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_160_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_162_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_164_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_166_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_168_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_170_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_172_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_174_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_176_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_177_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_178_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_180_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_181_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_182_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_184_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_186_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_188_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_190_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_192_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_194_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_195_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_196_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_198_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_200_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_202_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_204_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_206_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_208_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_210_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_212_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_214_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_216_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_218_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_220_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_222_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_224_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_226_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_228_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_230_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_232_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_234_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_236_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_238_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_240_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_242_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_243_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_244_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_246_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_248_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_250_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_252_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_254_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_256_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_257_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PRESS_258_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)

move_to_control_panel()
press_control()

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

The water running in the sink is cold. Adjust the faucet handle to run the water hot. Make sure to keep the water on.


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

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

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

OBJ_POSE_T0 = pose(x=5.169349, y=-0.662852, z=0.949744, qw=0.964067, qx=-0.017605, qy=0.011163, qz=-0.264842)
GOAL_RECEPTACLE_POSE = pose(x=5.439678, y=-0.436471, z=0.926729, qw=0.983943, qx=0.000013, qy=-0.000011, qz=0.178484)

APPROACH_002_JOINTS = [-0.000091, -1.039810, -0.054196, -2.264715, 0.036617, 1.506161, 0.688943]  # t=2
APPROACH_005_JOINTS = [-0.001362, -1.040509, -0.016642, -2.265938, 0.060486, 1.507775, 0.744880]  # t=5
APPROACH_010_JOINTS = [-0.008246, -1.048148, 0.114002, -2.265669, 0.100475, 1.512643, 0.992961]  # t=10
APPROACH_012_JOINTS = [-0.011501, -1.058717, 0.164858, -2.263344, 0.109968, 1.498274, 1.103529]  # t=12
APPROACH_015_JOINTS = [-0.016820, -1.080786, 0.205772, -2.269001, 0.109331, 1.438904, 1.231059]  # t=15
APPROACH_020_JOINTS = [-0.023063, -1.116313, 0.227149, -2.271685, 0.105518, 1.358652, 1.355074]  # t=20
APPROACH_025_JOINTS = [-0.021886, -1.161704, 0.242205, -2.294962, 0.145718, 1.285389, 1.429634]  # t=25
APPROACH_030_JOINTS = [-0.018044, -1.179245, 0.277180, -2.354412, 0.213634, 1.279597, 1.455871]  # t=30
APPROACH_035_JOINTS = [-0.010734, -1.195567, 0.305129, -2.426152, 0.265644, 1.304122, 1.452000]  # t=35
APPROACH_040_JOINTS = [-0.002761, -1.192962, 0.355808, -2.468931, 0.325333, 1.325563, 1.475914]  # t=40
APPROACH_045_JOINTS = [0.006831, -1.181742, 0.427716, -2.500359, 0.395519, 1.361340, 1.525282]  # t=45
APPROACH_048_JOINTS = [0.012938, -1.170032, 0.442554, -2.518790, 0.420620, 1.367963, 1.508513]  # t=48
APPROACH_050_JOINTS = [0.015358, -1.158799, 0.449724, -2.534990, 0.429672, 1.389770, 1.490520]  # t=50
APPROACH_055_JOINTS = [0.021693, -1.122705, 0.489526, -2.591404, 0.472493, 1.487708, 1.458950]  # t=55
APPROACH_060_JOINTS = [0.030104, -1.082017, 0.546739, -2.636894, 0.520879, 1.588478, 1.453605]  # t=60
APPROACH_063_JOINTS = [0.030518, -1.050171, 0.574107, -2.653856, 0.534448, 1.653677, 1.454865]  # t=63
APPROACH_065_JOINTS = [0.028270, -1.031042, 0.578305, -2.657073, 0.528039, 1.695057, 1.453434]  # t=65
APPROACH_070_JOINTS = [0.021664, -0.972512, 0.581641, -2.661522, 0.516543, 1.764164, 1.442604]  # t=70
APPROACH_073_JOINTS = [0.022571, -0.946659, 0.584151, -2.661238, 0.511993, 1.777816, 1.434185]  # t=73
APPROACH_075_JOINTS = [0.026076, -0.936985, 0.588210, -2.666858, 0.515272, 1.780109, 1.435213]  # t=75
APPROACH_080_JOINTS = [0.041275, -0.936135, 0.601745, -2.692276, 0.529884, 1.785603, 1.441990]  # t=80
APPROACH_085_JOINTS = [0.055891, -0.936968, 0.624076, -2.733745, 0.554631, 1.819224, 1.443098]  # t=85
APPROACH_086_JOINTS = [0.058053, -0.934668, 0.629584, -2.743400, 0.560954, 1.829674, 1.442200]  # t=86
DESCEND_088_JOINTS = [0.061669, -0.928263, 0.640725, -2.761587, 0.573014, 1.852312, 1.439809]  # t=88
DESCEND_090_JOINTS = [0.065018, -0.920869, 0.652676, -2.778624, 0.584440, 1.876801, 1.437819]  # t=90
DESCEND_092_JOINTS = [0.068299, -0.912696, 0.664780, -2.794727, 0.595831, 1.901331, 1.435990]  # t=92
DESCEND_094_JOINTS = [0.071420, -0.901879, 0.678803, -2.811877, 0.609204, 1.928387, 1.433856]  # t=94
DESCEND_096_JOINTS = [0.073964, -0.885686, 0.695509, -2.831099, 0.626542, 1.958684, 1.429899]  # t=96
DESCEND_098_JOINTS = [0.075696, -0.866839, 0.711592, -2.848387, 0.643302, 1.989350, 1.425217]  # t=98
DESCEND_099_JOINTS = [0.076463, -0.858757, 0.717715, -2.854667, 0.649146, 2.002658, 1.423498]  # t=99
DESCEND_100_JOINTS = [0.077341, -0.852492, 0.721832, -2.859022, 0.652801, 2.012766, 1.422565]  # t=100
DESCEND_102_JOINTS = [0.079367, -0.844565, 0.724789, -2.863280, 0.655102, 2.024000, 1.422341]  # t=102
DESCEND_104_JOINTS = [0.081441, -0.840573, 0.723800, -2.864255, 0.653977, 2.028016, 1.422957]  # t=104
DESCEND_105_JOINTS = [0.082441, -0.839525, 0.722672, -2.864250, 0.652916, 2.028631, 1.423486]  # t=105
DESCEND_106_JOINTS = [0.083409, -0.838677, 0.721588, -2.864250, 0.651941, 2.029128, 1.424010]  # t=106
DESCEND_107_JOINTS = [0.084333, -0.837951, 0.720590, -2.864251, 0.651067, 2.029570, 1.424510]  # t=107
DESCEND_108_JOINTS = [0.085205, -0.837316, 0.719680, -2.864253, 0.650279, 2.029970, 1.424981]  # t=108
DESCEND_109_JOINTS = [0.086025, -0.836752, 0.718848, -2.864241, 0.649571, 2.030339, 1.425418]  # t=109
GRASP_HOLD_111_JOINTS = [0.087492, -0.835723, 0.717407, -2.862739, 0.648414, 2.030981, 1.426721]  # t=111
LIFT_112_JOINTS = [0.088090, -0.835227, 0.716777, -2.862376, 0.647681, 2.031166, 1.427317]  # t=112
LIFT_113_JOINTS = [0.088668, -0.834869, 0.716281, -2.862333, 0.646995, 2.031693, 1.427793]  # t=113
LIFT_114_JOINTS = [0.089267, -0.834737, 0.715939, -2.862357, 0.646352, 2.032523, 1.428264]  # t=114
LIFT_115_JOINTS = [0.089464, -0.834951, 0.712341, -2.861228, 0.645247, 2.027025, 1.428672]  # t=115
LIFT_116_JOINTS = [0.088194, -0.835735, 0.701745, -2.856075, 0.638460, 2.008410, 1.428340]  # t=116
LIFT_117_JOINTS = [0.085718, -0.841412, 0.685597, -2.843358, 0.619392, 1.980899, 1.432864]  # t=117
LIFT_118_JOINTS = [0.083550, -0.851089, 0.669262, -2.825954, 0.595312, 1.949399, 1.445374]  # t=118
LIFT_119_JOINTS = [0.080832, -0.863655, 0.650789, -2.808723, 0.568069, 1.915376, 1.464637]  # t=119
LIFT_120_JOINTS = [0.076551, -0.878029, 0.627647, -2.794064, 0.537165, 1.882834, 1.484731]  # t=120
LIFT_121_JOINTS = [0.070891, -0.895286, 0.596102, -2.782730, 0.501570, 1.847051, 1.497266]  # t=121
TRANSPORT_123_JOINTS = [0.056579, -0.928180, 0.523010, -2.772837, 0.427750, 1.787449, 1.498541]  # t=123
TRANSPORT_125_JOINTS = [0.039549, -0.953811, 0.448292, -2.765124, 0.353289, 1.737723, 1.488056]  # t=125
TRANSPORT_127_JOINTS = [0.018792, -0.965647, 0.375440, -2.762155, 0.286121, 1.703094, 1.486429]  # t=127
TRANSPORT_129_JOINTS = [-0.006056, -0.954257, 0.309089, -2.760641, 0.223004, 1.690534, 1.493413]  # t=129
TRANSPORT_131_JOINTS = [-0.029577, -0.925315, 0.252149, -2.742983, 0.166083, 1.692266, 1.488189]  # t=131
TRANSPORT_133_JOINTS = [-0.047826, -0.899137, 0.200395, -2.707437, 0.117865, 1.684059, 1.467653]  # t=133
TRANSPORT_135_JOINTS = [-0.062691, -0.861555, 0.158636, -2.679791, 0.082351, 1.702618, 1.453279]  # t=135
TRANSPORT_137_JOINTS = [-0.070482, -0.813291, 0.140055, -2.656562, 0.071339, 1.728954, 1.458087]  # t=137
TRANSPORT_139_JOINTS = [-0.073179, -0.773044, 0.135320, -2.631673, 0.069512, 1.736925, 1.477324]  # t=139
TRANSPORT_140_JOINTS = [-0.074494, -0.753681, 0.132484, -2.619902, 0.066433, 1.743746, 1.487405]  # t=140
TRANSPORT_141_JOINTS = [-0.077254, -0.730359, 0.126568, -2.608186, 0.061439, 1.759776, 1.503821]  # t=141
TRANSPORT_143_JOINTS = [-0.083483, -0.672596, 0.112991, -2.583853, 0.051135, 1.806668, 1.539717]  # t=143
TRANSPORT_145_JOINTS = [-0.085009, -0.613653, 0.109466, -2.555800, 0.046504, 1.865776, 1.560898]  # t=145
TRANSPORT_147_JOINTS = [-0.083728, -0.570420, 0.108467, -2.532065, 0.042483, 1.915743, 1.566974]  # t=147
TRANSPORT_149_JOINTS = [-0.081579, -0.542382, 0.106478, -2.516719, 0.039005, 1.957455, 1.570525]  # t=149
TRANSPORT_151_JOINTS = [-0.078952, -0.523396, 0.104297, -2.507770, 0.036169, 1.994732, 1.573515]  # t=151
TRANSPORT_153_JOINTS = [-0.076911, -0.507564, 0.099950, -2.505084, 0.031993, 2.033703, 1.574780]  # t=153
TRANSPORT_155_JOINTS = [-0.076371, -0.496592, 0.089947, -2.508057, 0.024696, 2.064225, 1.571864]  # t=155
TRANSPORT_157_JOINTS = [-0.076615, -0.489170, 0.075687, -2.512066, 0.016823, 2.096783, 1.564155]  # t=157
TRANSPORT_159_JOINTS = [-0.077143, -0.480717, 0.059896, -2.515947, 0.009145, 2.128497, 1.554345]  # t=159
PLACE_161_JOINTS = [-0.078251, -0.470146, 0.042039, -2.517862, 0.000928, 2.156068, 1.542375]  # t=161
PLACE_163_JOINTS = [-0.078873, -0.457068, 0.025483, -2.516316, -0.005354, 2.182287, 1.530160]  # t=163
PLACE_165_JOINTS = [-0.078497, -0.443894, 0.013159, -2.511584, -0.009337, 2.200616, 1.521180]  # t=165
PLACE_167_JOINTS = [-0.076806, -0.431898, 0.006453, -2.505045, -0.010885, 2.208972, 1.516709]  # t=167
PLACE_169_JOINTS = [-0.074383, -0.422162, 0.003827, -2.498241, -0.011581, 2.211486, 1.516624]  # t=169
PLACE_171_JOINTS = [-0.072171, -0.414861, 0.001870, -2.493549, -0.012644, 2.209990, 1.517196]  # t=171
PLACE_173_JOINTS = [-0.070215, -0.407296, 0.000264, -2.489769, -0.014133, 2.204379, 1.517997]  # t=173
PLACE_175_JOINTS = [-0.068490, -0.397570, -0.001073, -2.486947, -0.016081, 2.196909, 1.519002]  # t=175
PLACE_177_JOINTS = [-0.067070, -0.381469, -0.001668, -2.484885, -0.020757, 2.187716, 1.521618]  # t=177
PLACE_179_JOINTS = [-0.065598, -0.363687, -0.001307, -2.480064, -0.027119, 2.175574, 1.525984]  # t=179
PLACE_181_JOINTS = [-0.063595, -0.347746, 0.000640, -2.463549, -0.033273, 2.152727, 1.532160]  # t=181
PLACE_183_JOINTS = [-0.061396, -0.329360, 0.002431, -2.441771, -0.037896, 2.125418, 1.537712]  # t=183
PLACE_185_JOINTS = [-0.059206, -0.315042, 0.002534, -2.420535, -0.038443, 2.104751, 1.539927]  # t=185
PLACE_187_JOINTS = [-0.057200, -0.305900, 0.002171, -2.407767, -0.038442, 2.093375, 1.541299]  # t=187
PLACE_189_JOINTS = [-0.055463, -0.300140, 0.001420, -2.400263, -0.038495, 2.086941, 1.542155]  # t=189
PLACE_191_JOINTS = [-0.053929, -0.296672, 0.000557, -2.395755, -0.038553, 2.083141, 1.542677]  # t=191
PLACE_193_JOINTS = [-0.052588, -0.294379, -0.000343, -2.393140, -0.038653, 2.081182, 1.542996]  # t=193
PLACE_195_JOINTS = [-0.051433, -0.292921, -0.001252, -2.391420, -0.038787, 2.079925, 1.543126]  # t=195
PLACE_197_JOINTS = [-0.050433, -0.291251, -0.002090, -2.390773, -0.038900, 2.079878, 1.543166]  # t=197
PLACE_199_JOINTS = [-0.049601, -0.286792, -0.002978, -2.394094, -0.039113, 2.084876, 1.543186]  # t=199
PLACE_201_JOINTS = [-0.048686, -0.285790, -0.003297, -2.397466, -0.039056, 2.087887, 1.543408]  # t=201
PLACE_202_JOINTS = [-0.048172, -0.286549, -0.003307, -2.398548, -0.039040, 2.087833, 1.543698]  # t=202
PLACE_203_JOINTS = [-0.047737, -0.287930, -0.003393, -2.399749, -0.039042, 2.087105, 1.543903]  # t=203
PLACE_205_JOINTS = [-0.047072, -0.290656, -0.003749, -2.401400, -0.039045, 2.087471, 1.543987]  # t=205
PLACE_207_JOINTS = [-0.046591, -0.291853, -0.004146, -2.402582, -0.039050, 2.088820, 1.543992]  # t=207
PLACE_209_JOINTS = [-0.046221, -0.292214, -0.004425, -2.402775, -0.039054, 2.088952, 1.543996]  # t=209
PLACE_211_JOINTS = [-0.045933, -0.292299, -0.004630, -2.402770, -0.039057, 2.088952, 1.543999]  # t=211
PLACE_213_JOINTS = [-0.045712, -0.292879, -0.004794, -2.403012, -0.039061, 2.088094, 1.544002]  # t=213
PLACE_215_JOINTS = [-0.045571, -0.297409, -0.004995, -2.405261, -0.039066, 2.082957, 1.543999]  # t=215
PLACE_217_JOINTS = [-0.043412, -0.302534, 0.001243, -2.407748, -0.034819, 2.080341, 1.547761]  # t=217
PLACE_219_JOINTS = [-0.039696, -0.306201, 0.013497, -2.410445, -0.029149, 2.079032, 1.558790]  # t=219
PLACE_221_JOINTS = [-0.035480, -0.312348, 0.028297, -2.414747, -0.022779, 2.074736, 1.572692]  # t=221
PLACE_223_JOINTS = [-0.030752, -0.320417, 0.046032, -2.420645, -0.015071, 2.070154, 1.589258]  # t=223
PLACE_225_JOINTS = [-0.026324, -0.329376, 0.064178, -2.427599, -0.007346, 2.063874, 1.606335]  # t=225
PLACE_227_JOINTS = [-0.022568, -0.338885, 0.081243, -2.434993, 0.000483, 2.051593, 1.621682]  # t=227
PLACE_229_JOINTS = [-0.020314, -0.352078, 0.094049, -2.442940, 0.006588, 2.027398, 1.633040]  # t=229
PLACE_231_JOINTS = [-0.020222, -0.378319, 0.098434, -2.457637, 0.010321, 1.990529, 1.635193]  # t=231
RELEASE_POSE_231_JOINTS = [-0.020222, -0.378319, 0.098434, -2.457637, 0.010321, 1.990529, 1.635193]  # t=231
RETRACT_234_JOINTS = [-0.020094, -0.428989, 0.102865, -2.490941, 0.017079, 1.942488, 1.627963]  # t=234
RETRACT_237_JOINTS = [-0.018746, -0.505455, 0.108985, -2.540737, 0.023509, 1.893845, 1.601203]  # t=237
RETRACT_240_JOINTS = [-0.017638, -0.602460, 0.115347, -2.605550, 0.032217, 1.866991, 1.582188]  # t=240
RETRACT_243_JOINTS = [-0.015414, -0.704197, 0.123529, -2.676495, 0.041523, 1.852375, 1.549222]  # t=243
RETRACT_246_JOINTS = [-0.009352, -0.787643, 0.132864, -2.730204, 0.042220, 1.842434, 1.437432]  # t=246
RETRACT_249_JOINTS = [-0.001932, -0.864709, 0.138756, -2.769649, 0.041601, 1.822660, 1.299024]  # t=249
RETRACT_250_JOINTS = [0.000575, -0.886832, 0.139967, -2.780657, 0.041177, 1.819237, 1.250800]  # t=250
RETRACT_252_JOINTS = [0.005152, -0.922065, 0.140792, -2.801047, 0.041372, 1.794930, 1.158271]  # t=252
RETRACT_254_JOINTS = [0.008882, -0.948488, 0.141348, -2.812046, 0.039923, 1.777934, 1.076238]  # t=254
RETRACT_255_JOINTS = [0.010941, -0.961850, 0.141712, -2.813454, 0.038237, 1.770151, 1.035460]  # t=255
RETRACT_258_JOINTS = [0.020160, -0.999201, 0.137445, -2.806068, 0.034876, 1.749521, 0.878974]  # t=258
RETRACT_261_JOINTS = [0.030145, -1.031051, 0.121841, -2.790528, 0.035955, 1.725998, 0.698561]  # t=261
RETRACT_264_JOINTS = [0.034239, -1.072912, 0.095753, -2.774287, 0.045981, 1.695271, 0.581411]  # t=264
RETRACT_267_JOINTS = [0.031577, -1.144591, 0.060928, -2.781196, 0.065103, 1.663704, 0.553198]  # t=267
RETRACT_270_JOINTS = [0.030354, -1.240828, 0.041605, -2.803285, 0.076768, 1.627633, 0.541824]  # t=270
RETRACT_273_JOINTS = [0.026090, -1.326692, 0.041261, -2.816196, 0.076756, 1.583559, 0.584392]  # t=273
RETRACT_276_JOINTS = [0.017395, -1.388157, 0.051159, -2.829709, 0.076808, 1.554582, 0.689758]  # t=276
RETRACT_277_JOINTS = [0.014311, -1.403579, 0.055986, -2.835074, 0.076825, 1.549260, 0.729387]  # t=277
RETRACT_279_JOINTS = [0.008068, -1.421335, 0.066707, -2.845551, 0.076685, 1.538027, 0.810544]  # t=279
RETRACT_282_JOINTS = [0.002528, -1.430688, 0.086103, -2.847098, 0.075299, 1.524598, 0.899135]  # t=282
APPROACH_000_JOINTS = [0.000540, -1.039431, -0.054396, -2.264717, 0.036371, 1.506583, 0.689183]  # 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_002_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_005_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_010_JOINTS, input_type='joint', steps=5, 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_020_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_025_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_030_JOINTS, input_type='joint', steps=5, 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_045_JOINTS, input_type='joint', steps=5, 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_063_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_065_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_070_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_073_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_075_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_080_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_085_JOINTS, input_type='joint', steps=5, settle_steps=0, gripper=-1.000)
    moveJoint(APPROACH_086_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)

def execute_grasp_approach():
    """Final Cartesian descent into grasp alignment."""
    moveJoint(DESCEND_088_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_090_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_092_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_094_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_096_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_098_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_099_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_100_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_102_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_104_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_105_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(DESCEND_106_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(DESCEND_107_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(DESCEND_108_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(DESCEND_109_JOINTS, input_type='joint', steps=1, 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_111_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_111_JOINTS, input_type='joint', gripper=1.0)

def lift_object():
    """Lift the grasped object clear of the counter."""
    moveJoint(LIFT_112_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(LIFT_113_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(LIFT_114_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(LIFT_115_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(LIFT_116_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(LIFT_117_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(LIFT_118_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(LIFT_119_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(LIFT_120_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(LIFT_121_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_123_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_125_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_127_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_129_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_131_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_133_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_135_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_137_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_139_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_140_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_141_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_143_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_145_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_147_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_149_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_151_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_153_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_155_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_157_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(TRANSPORT_159_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_161_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PLACE_163_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PLACE_165_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PLACE_167_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PLACE_169_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PLACE_171_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PLACE_173_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PLACE_175_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PLACE_177_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PLACE_179_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PLACE_181_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PLACE_183_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PLACE_185_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PLACE_187_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PLACE_189_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=1.000)
    moveJoint(PLACE_191_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PLACE_193_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PLACE_195_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PLACE_197_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PLACE_199_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PLACE_201_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PLACE_202_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PLACE_203_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(PLACE_205_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PLACE_207_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PLACE_209_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PLACE_211_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PLACE_213_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PLACE_215_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PLACE_217_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PLACE_219_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PLACE_221_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PLACE_223_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PLACE_225_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PLACE_227_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PLACE_229_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(PLACE_231_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    wait(duration=0.05, hold_target=RELEASE_POSE_231_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_231_JOINTS, input_type='joint', open_steps=1, settle_steps=0, gripper=-1.0)
    wait(duration=0.05, hold_target=RELEASE_POSE_231_JOINTS, input_type='joint', gripper=-1.0)

def retreat_after_release():
    """Retreat away from the placed object without clipping it."""
    moveJoint(RETRACT_234_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_237_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_240_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_243_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_246_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_249_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_250_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_252_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_254_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_255_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_258_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_261_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_264_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_267_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_270_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_273_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_276_JOINTS, input_type='joint', steps=3, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_277_JOINTS, input_type='joint', steps=1, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_279_JOINTS, input_type='joint', steps=2, settle_steps=0, gripper=-1.000)
    moveJoint(RETRACT_282_JOINTS, input_type='joint', steps=3, 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

Pick up the wedge of cheese and place it on the slice of bread to prepare a simple cheese on bread dish.

cheese

all cheese dairy food in_container food_set1