{"mode":"Blocks","workspace":"<xml xmlns=\"http://www.w3.org/1999/xhtml\"><variables><variable type=\"\" id=\"_2.^beQjx|FGt38A,8(E\" islocal=\"false\" iscloud=\"false\" arraylength=\"0\" arraywidth=\"0\">myVariable</variable></variables><block type=\"iq_events_when_started\" id=\".NsXwU_L.OuU1l7Sho$F\" x=\"70\" y=\"-10\"><next><block type=\"iq_other_comment\" id=\"31dyX4+P~l66[j79L=~k\"><value name=\"COMMENT\"><shadow type=\"comment_text\" id=\"hfygOMvt9dK^U;#-WQZs\"><field name=\"comment\">Move the robot to the outer square</field></shadow></value><next><block type=\"iq_drivetrain_drive_for\" id=\"i`!B$Wk7Me#%.UCr-{s=\"><field name=\"DIRECTION\">rev</field><field name=\"UNITS\">mm</field><field name=\"anddontwait_mutator\">FALSE</field><value name=\"AMOUNT\"><shadow type=\"math_number\" id=\"~pQ:J%0pMcvuancH^:%Q\"><field name=\"NUM\">300</field></shadow></value><next><block type=\"iq_drivetrain_turn_to_heading\" id=\"[T4_RoRTPPqS9}`@v+rF\"><field name=\"anddontwait_mutator\">FALSE</field><value name=\"HEADING\"><shadow type=\"math_number\" id=\"gC_RiaAA6U|mUfHc[lmh\"><field name=\"NUM\">90</field></shadow></value><next><block type=\"iq_other_comment\" id=\"yv3xVHR~nXip)N:x10[u\"><value name=\"COMMENT\"><shadow type=\"comment_text\" id=\"8kFus}|7S#)ao==`U]A1\"><field name=\"comment\">If there is a block within the robots view, push it off and back up to the square</field></shadow></value><next><block type=\"iq_control_if_then_else\" id=\"W@t%B(E@Rm~!n159gbB}\"><value name=\"CONDITION\"><block type=\"iq_operator_less_than\" id=\"*OraG}=6U4^p.$qOq94/\"><value name=\"OPERAND1\"><shadow type=\"math_number\" id=\";Yx~Ap;cs2S6#F^F_4zW\"><field name=\"NUM\"></field></shadow><block type=\"iq_sensing_distance_object_distance\" id=\"@W`x1EEo;/9u}$z:9-=P\"><field name=\"DISTANCE\">Distance3</field><field name=\"UNITS\">mm</field></block></value><value name=\"OPERAND2\"><shadow type=\"math_number\" id=\"#8OrASbv@(j}mv?7J,-2\"><field name=\"NUM\">500</field></shadow></value></block></value><statement name=\"SUBSTACK\"><block type=\"iq_drivetrain_drive_for\" id=\"FBv=2q=;x(RmK@EBe%g:\"><field name=\"DIRECTION\">fwd</field><field name=\"UNITS\">mm</field><field name=\"anddontwait_mutator\">FALSE</field><value name=\"AMOUNT\"><shadow type=\"math_number\" id=\"WgGnDDZIN}Kys5#CLP$B\"><field name=\"NUM\">450</field></shadow></value><next><block type=\"iq_drivetrain_drive_for\" id=\"{c1?wtDP]wQ)|xhx1+]R\"><field name=\"DIRECTION\">rev</field><field name=\"UNITS\">mm</field><field name=\"anddontwait_mutator\">FALSE</field><value name=\"AMOUNT\"><shadow type=\"math_number\" id=\"l`=IcHU^D|8J$a%9f/P[\"><field name=\"NUM\">150</field></shadow></value></block></next></block></statement><statement name=\"SUBSTACK2\"><block type=\"iq_other_comment\" id=\"!Tgo/?dx2(g0_.(fCX5#\"><value name=\"COMMENT\"><shadow type=\"comment_text\" id=\"Dy{3X.$CXe.I2_}m+/b3\"><field name=\"comment\">If not move forward to the corner of the square</field></shadow></value><next><block type=\"iq_drivetrain_drive_for\" id=\"d}%.{z)wtCljw:PK5Zpl\"><field name=\"DIRECTION\">fwd</field><field name=\"UNITS\">mm</field><field name=\"anddontwait_mutator\">FALSE</field><value name=\"AMOUNT\"><shadow type=\"math_number\" id=\"#(Dn:wc}ZI%tKq:M}MiR\"><field name=\"NUM\">300</field></shadow></value></block></next></block></statement><next><block type=\"iq_drivetrain_turn_to_heading\" id=\"=}d[-M^F9UhTp7nqn%~J\"><field name=\"anddontwait_mutator\">FALSE</field><value name=\"HEADING\"><shadow type=\"math_number\" id=\"ziug6A9{q$e,#w~^%[NL\"><field name=\"NUM\">0</field></shadow></value><next><block type=\"iq_other_comment\" id=\"+y!E$IU4zxE/,}[J43?k\"><value name=\"COMMENT\"><shadow type=\"comment_text\" id=\"N(E!lsiy)W)5R|Z0Ue5=\"><field name=\"comment\">Repeat for all 4 sides of the square</field></shadow></value><next><block type=\"iq_control_repeat\" id=\"H^pGKev,9mJ;.j~u={nT\"><value name=\"TIMES\"><shadow type=\"math_whole_number\" id=\"DKM2,gWE+hOZ!:D-K~D[\"><field name=\"NUM\">4</field></shadow></value><statement name=\"SUBSTACK\"><block type=\"iq_other_comment\" id=\"8zPM`)Q!p*:nnoOG`Lr:\"><value name=\"COMMENT\"><shadow type=\"comment_text\" id=\"oA@@i*1M1G5H%Ycdf)6g\"><field name=\"comment\">If there is a block within the robots view, push it off and back up to the square</field></shadow></value><next><block type=\"iq_control_if_then_else\" id=\"6lXugTh9;QT@E;zsR86L\"><value name=\"CONDITION\"><block type=\"iq_operator_less_than\" id=\"9#M(.LYgW;wwG_o%q=c_\"><value name=\"OPERAND1\"><shadow type=\"math_number\" id=\":{,A.{d/.PJGN!u_!$oA\"><field name=\"NUM\"></field></shadow><block type=\"iq_sensing_distance_object_distance\" id=\"cn#A)e2SNACrkQ+*%)A9\"><field name=\"DISTANCE\">Distance3</field><field name=\"UNITS\">mm</field></block></value><value name=\"OPERAND2\"><shadow type=\"math_number\" id=\"?X3X=w`r;n)=1t[urA6.\"><field name=\"NUM\">500</field></shadow></value></block></value><statement name=\"SUBSTACK\"><block type=\"iq_drivetrain_drive_for\" id=\"=oHSh_F7tUjPsribZ+_|\"><field name=\"DIRECTION\">fwd</field><field name=\"UNITS\">mm</field><field name=\"anddontwait_mutator\">FALSE</field><value name=\"AMOUNT\"><shadow type=\"math_number\" id=\"QXG/*0~y=I.f@iqOgjoK\"><field name=\"NUM\">750</field></shadow></value><next><block type=\"iq_drivetrain_drive_for\" id=\"jW}F8VxGrS9HJcy3=k]%\"><field name=\"DIRECTION\">rev</field><field name=\"UNITS\">mm</field><field name=\"anddontwait_mutator\">FALSE</field><value name=\"AMOUNT\"><shadow type=\"math_number\" id=\"~=y$o,_gHe5(sB,Fo+Bp\"><field name=\"NUM\">150</field></shadow></value></block></next></block></statement><statement name=\"SUBSTACK2\"><block type=\"iq_other_comment\" id=\"9]+AhmU4!sMeCIa#4:7D\"><value name=\"COMMENT\"><shadow type=\"comment_text\" id=\"ku!h4A!ifVHTT8D^fe^8\"><field name=\"comment\">If not move forward to the corner of the square</field></shadow></value><next><block type=\"iq_drivetrain_drive_for\" id=\"Q{t$FhR8a!YM:/LE!SIL\"><field name=\"DIRECTION\">fwd</field><field name=\"UNITS\">mm</field><field name=\"anddontwait_mutator\">FALSE</field><value name=\"AMOUNT\"><shadow type=\"math_number\" id=\"LLmElq%Lhj?:-[f,{sgm\"><field name=\"NUM\">600</field></shadow></value></block></next></block></statement><next><block type=\"iq_drivetrain_turn_for\" id=\"[Sdc!~]lUDkpCX]ZBBMi\"><field name=\"TURNDIRECTION\">left</field><field name=\"anddontwait_mutator\">FALSE</field><value name=\"AMOUNT\"><shadow type=\"math_number\" id=\"I=am`#dODU0tVA@Ty;]c\"><field name=\"NUM\">90</field></shadow></value></block></next></block></next></block></statement></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></xml>","rconfig":[{"port":[1,6,0],"name":"Drivetrain","customName":false,"deviceType":"Drivetrain","deviceClass":"smartdrive","setting":{"type":"2-motor","wheelSize":"200mm","gearRatio":"1:1","direction":"fwd","gyroType":"integrated","width":"173","unit":"mm","wheelbase":"76","wheelbaseUnit":"mm","xOffset":"0","yOffset":"0","thetaOffset":"0"},"triportSourcePort":22},{"port":[3],"name":"Distance3","customName":false,"deviceType":"Distance","deviceClass":"distance","setting":{},"triportSourcePort":22}],"slot":0,"platform":"IQ","sdkVersion":"20220726.10.00.00","appVersion":"2.4.5","minVersion":"2.4.0","fileFormat":"1.2.0","icon":"","targetBrainGen":"Second","cppStatus":"true","cpp":"// Make sure all required headers are included.\n#include <stdio.h>\n#include <stdlib.h>\n#include <stdbool.h>\n#include <math.h>\n#include <string.h>\n\n\n#include \"vex.h\"\n\nusing namespace vex;\n\n// Brain should be defined by default\nbrain Brain;\n\n\n// START IQ MACROS\n#define waitUntil(condition)                                                   \\\n  do {                                                                         \\\n    wait(5, msec);                                                             \\\n  } while (!(condition))\n\n#define repeat(iterations)                                                     \\\n  for (int iterator = 0; iterator < iterations; iterator++)\n// END IQ MACROS\n\n\n// Robot configuration code.\ninertial BrainInertial = inertial();\nmotor LeftDriveSmart = motor(PORT1, 1, false);\nmotor RightDriveSmart = motor(PORT6, 1, true);\n\nsmartdrive Drivetrain = smartdrive(LeftDriveSmart, RightDriveSmart, BrainInertial, 200);\n\ndistance Distance3 = distance(PORT3);\n\nvoid calibrateDrivetrain() {\n  wait(200, msec);\n  Brain.Screen.print(\"Calibrating\");\n  Brain.Screen.newLine();\n  Brain.Screen.print(\"Inertial\");\n  BrainInertial.calibrate();\n  while (BrainInertial.isCalibrating()) {\n    wait(25, msec);\n  }\n\n  // Clears the screen and returns the cursor to row 1, column 1.\n  Brain.Screen.clearScreen();\n  Brain.Screen.setCursor(1, 1);\n}\n\n// Generated code.\n\n// Include the IQ Library\n#include \"vex.h\"\n  \n// Allows for easier use of the VEX Library\nusing namespace vex;\n\nfloat myVariable;\n\n// \"when started\" hat block\nint whenStarted1() {\n  // Move the robot to the outer square\n  Drivetrain.driveFor(reverse, 300.0, mm);\n  Drivetrain.turnToHeading(90.0, degrees);\n  // If there is a block within the robots view, push it off and back up to the square\n  if (Distance3.objectDistance(mm) < 500.0) {\n    Drivetrain.driveFor(forward, 450.0, mm);\n    Drivetrain.driveFor(reverse, 150.0, mm);\n  }\n  else {\n    // If not move forward to the corner of the square\n    Drivetrain.driveFor(forward, 300.0, mm);\n  }\n  Drivetrain.turnToHeading(0.0, degrees);\n  // Repeat for all 4 sides of the square\n  repeat(4) {\n    // If there is a block within the robots view, push it off and back up to the square\n    if (Distance3.objectDistance(mm) < 500.0) {\n      Drivetrain.driveFor(forward, 750.0, mm);\n      Drivetrain.driveFor(reverse, 150.0, mm);\n    }\n    else {\n      // If not move forward to the corner of the square\n      Drivetrain.driveFor(forward, 600.0, mm);\n    }\n    Drivetrain.turnFor(left, 90.0, degrees);\n    wait(20, msec);\n  }\n  return 0;\n}\n\n\nint main() {\n  // Calibrate the Drivetrain Gyro\n  calibrateDrivetrain();\n\n  whenStarted1();\n}","target":"Physical"}