{"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><variable type=\"\" id=\"M`YOK5)Xte#8Tlom@9B:\" islocal=\"false\" iscloud=\"false\" arraylength=\"0\" arraywidth=\"0\">sideA</variable><variable type=\"\" id=\")^~qarhmXSPA0-E+JO#v\" islocal=\"false\" iscloud=\"false\" arraylength=\"0\" arraywidth=\"0\">sideB</variable><variable type=\"\" id=\"Z4YZ|GAc4klgn.:@0u_E\" islocal=\"false\" iscloud=\"false\" arraylength=\"0\" arraywidth=\"0\">sideC</variable><variable type=\"\" id=\"LAfei{AgD:!1+-9ld3Fo\" islocal=\"false\" iscloud=\"false\" arraylength=\"0\" arraywidth=\"0\">angleA</variable></variables><block type=\"iq_events_when_started\" id=\".NsXwU_L.OuU1l7Sho$F\" x=\"-10\" y=\"26\"><next><block type=\"iq_looks_set_print_precision_new\" id=\"ia`iObN#qWP}|CO+zDDI\"><field name=\"PRECISION\">2</field><field name=\"TARGET\">Console</field><next><block type=\"iq_variables_set_variable\" id=\"%Uzk+bw]6P2*n1-}3Vvu\"><field name=\"VARIABLE\" id=\"M`YOK5)Xte#8Tlom@9B:\" variabletype=\"\">sideA</field><value name=\"VALUE\"><shadow type=\"math_number\" id=\"YmS*aqnRBt1r5(,wntto\"><field name=\"NUM\">600</field></shadow></value><next><block type=\"iq_variables_set_variable\" id=\"wlmjm)o|zW%Xd|X88)Sm\"><field name=\"VARIABLE\" id=\")^~qarhmXSPA0-E+JO#v\" variabletype=\"\">sideB</field><value name=\"VALUE\"><shadow type=\"math_number\" id=\"O@Sm`rhM[{6ppw-{XpF/\"><field name=\"NUM\">450</field></shadow></value><next><block type=\"iq_variables_set_variable\" id=\"68Lo2,//w@i+rg,w?)3i\"><field name=\"VARIABLE\" id=\"Z4YZ|GAc4klgn.:@0u_E\" variabletype=\"\">sideC</field><value name=\"VALUE\"><shadow type=\"math_number\" id=\"DZdoRK[}-K$hI$r+t[9P\"><field name=\"NUM\">0</field></shadow><block type=\"iq_operator_function\" id=\"f4U=+g5X^LL;KRJ+LO}e\"><field name=\"OPERATOR\">sqrt</field><value name=\"NUM\"><shadow type=\"math_number\" id=\"8XN~Gd8/E1Go$(ri2U`s\"><field name=\"NUM\"></field></shadow><block type=\"iq_operator_add\" id=\"z|ypV/OL[-9B(Om{oRS@\"><value name=\"NUM1\"><shadow type=\"math_number\" id=\"MDYh8kJ!oxZFHqpHq2.g\"><field name=\"NUM\"></field></shadow><block type=\"iq_operator_multiply\" id=\"II2YA:p+rMvPoy8[XTX3\"><value name=\"NUM1\"><shadow type=\"math_number\" id=\"B$9*FurP)+?l8~cH:^Dt\"><field name=\"NUM\"></field></shadow><block type=\"iq_variables_variable\" id=\"-3s0eXTT8k9XR0dKN%g*\"><field name=\"VARIABLE\" id=\"M`YOK5)Xte#8Tlom@9B:\" variabletype=\"\">sideA</field></block></value><value name=\"NUM2\"><shadow type=\"math_number\" id=\"MY8}~V:kWX28f$T6tL/k\"><field name=\"NUM\"></field></shadow><block type=\"iq_variables_variable\" id=\"l9f(?z+$d;!wx-FQ%-B:\"><field name=\"VARIABLE\" id=\"M`YOK5)Xte#8Tlom@9B:\" variabletype=\"\">sideA</field></block></value></block></value><value name=\"NUM2\"><shadow type=\"math_number\" id=\"UJn-3m-BARVVHc_QFJ=C\"><field name=\"NUM\"></field></shadow><block type=\"iq_operator_multiply\" id=\"0ZdIC%pT!|R,sreluTq`\"><value name=\"NUM1\"><shadow type=\"math_number\" id=\"#wKcMjoe%BpH.L,;e5(x\"><field name=\"NUM\"></field></shadow><block type=\"iq_variables_variable\" id=\"7eBG9}_)oSm)#L]%]Be`\"><field name=\"VARIABLE\" id=\")^~qarhmXSPA0-E+JO#v\" variabletype=\"\">sideB</field></block></value><value name=\"NUM2\"><shadow type=\"math_number\" id=\"3;;OW|q9,{.5q0G=(}3c\"><field name=\"NUM\"></field></shadow><block type=\"iq_variables_variable\" id=\"tG]DuMXt+9wJbz8~,]%Q\"><field name=\"VARIABLE\" id=\")^~qarhmXSPA0-E+JO#v\" variabletype=\"\">sideB</field></block></value></block></value></block></value></block></value><next><block type=\"iq_drivetrain_drive_for\" id=\"t|DEs[EprbJUc]KZ|cV:\"><field name=\"DIRECTION\">fwd</field><field name=\"UNITS\">mm</field><field name=\"anddontwait_mutator\">FALSE</field><value name=\"AMOUNT\"><shadow type=\"math_number\" id=\"80}@U*bILZP{RbTycdeB\"><field name=\"NUM\">200</field></shadow><block type=\"iq_variables_variable\" id=\"G#E!hev`tcwAgkBW!eu^\"><field name=\"VARIABLE\" id=\"M`YOK5)Xte#8Tlom@9B:\" variabletype=\"\">sideA</field></block></value><next><block type=\"iq_looks_print_new\" id=\"7vdb8PI?Wg_L5{rkpqvr\"><field name=\"TARGET\">Brain</field><field name=\"andsetcursortonextrow_mutator\">FALSE</field><value name=\"DATA\"><shadow type=\"text\" id=\"8iV2Ke}w*%4C1xfr./eF\"><field name=\"TEXT\">A: </field></shadow></value><next><block type=\"iq_looks_print_new\" id=\"El1Amayf0v,)~;ljCaCz\"><field name=\"TARGET\">Brain</field><field name=\"andsetcursortonextrow_mutator\">TRUE</field><value name=\"DATA\"><shadow type=\"text\" id=\"..a,B;TrSh;gCAg4Aw##\"><field name=\"TEXT\">VEXcode</field></shadow><block type=\"iq_variables_variable\" id=\"mR7w={,@iBmB30eKD?gB\"><field name=\"VARIABLE\" id=\"M`YOK5)Xte#8Tlom@9B:\" variabletype=\"\">sideA</field></block></value><next><block type=\"iq_drivetrain_turn_for\" id=\"dbq(p^?Ib$Npqq~P009c\"><field name=\"TURNDIRECTION\">right</field><field name=\"anddontwait_mutator\">FALSE</field><value name=\"AMOUNT\"><shadow type=\"math_number\" id=\"P^V!4t54IF8$f8Yq@NQ@\"><field name=\"NUM\">90</field></shadow></value><next><block type=\"iq_drivetrain_drive_for\" id=\"LbScl4tu7M55/nJQ.f0D\"><field name=\"DIRECTION\">fwd</field><field name=\"UNITS\">mm</field><field name=\"anddontwait_mutator\">FALSE</field><value name=\"AMOUNT\"><shadow type=\"math_number\" id=\"a;ni5zM@UU9$jl-me_4Z\"><field name=\"NUM\">200</field></shadow><block type=\"iq_variables_variable\" id=\"|K0cXKf*KfNmjhcyzN,m\"><field name=\"VARIABLE\" id=\")^~qarhmXSPA0-E+JO#v\" variabletype=\"\">sideB</field></block></value><next><block type=\"iq_looks_print_new\" id=\":WnZ0!qYlpHS=QLfp41`\"><field name=\"TARGET\">Brain</field><field name=\"andsetcursortonextrow_mutator\">FALSE</field><value name=\"DATA\"><shadow type=\"text\" id=\"xALD|#%B)]z1k$VvI|},\"><field name=\"TEXT\">B: </field></shadow></value><next><block type=\"iq_looks_print_new\" id=\"mM8ePwWpm5IX]IOFu41K\"><field name=\"TARGET\">Brain</field><field name=\"andsetcursortonextrow_mutator\">TRUE</field><value name=\"DATA\"><shadow type=\"text\" id=\"wnw;x7q4MIzWUSTB{B/e\"><field name=\"TEXT\">VEXcode</field></shadow><block type=\"iq_variables_variable\" id=\"}LuBe|+=oQ[#k!r.@w,l\"><field name=\"VARIABLE\" id=\")^~qarhmXSPA0-E+JO#v\" variabletype=\"\">sideB</field></block></value><next><block type=\"iq_other_comment\" id=\"VrbGvdoFqLy2}:n@$r:d\"><value name=\"COMMENT\"><shadow type=\"comment_text\" id=\"32.36#VayHimRfeH=94q\"><field name=\"comment\">Calculate angle a</field></shadow></value><next><block type=\"iq_variables_set_variable\" id=\"+?1f4oZ6D{k}5Kh_ip$G\"><field name=\"VARIABLE\" id=\"LAfei{AgD:!1+-9ld3Fo\" variabletype=\"\">angleA</field><value name=\"VALUE\"><shadow type=\"math_number\" id=\"A+NpwRo)N6,TOKvSsi)/\"><field name=\"NUM\">0</field></shadow><block type=\"iq_operator_function\" id=\"Cy=Tyfg0T$#6kehQ@$5.\"><field name=\"OPERATOR\">atan</field><value name=\"NUM\"><shadow type=\"math_number\" id=\"HqsB:WQ_X5Btqs1];0~.\"><field name=\"NUM\"></field></shadow><block type=\"iq_operator_divide\" id=\"H`h,KM$:0maRoPk8;R+9\"><value name=\"NUM1\"><shadow type=\"math_number\" id=\"NK}TuEE}qhJS^%$ftKik\"><field name=\"NUM\"></field></shadow><block type=\"iq_variables_variable\" id=\"lU`Mhs8-~T13%y/l,lO@\"><field name=\"VARIABLE\" id=\"M`YOK5)Xte#8Tlom@9B:\" variabletype=\"\">sideA</field></block></value><value name=\"NUM2\"><shadow type=\"math_number\" id=\"@yC]Io(VAk,!sMAmMmda\"><field name=\"NUM\"></field></shadow><block type=\"iq_variables_variable\" id=\"#Y@R?(b$y++*5P-)=|l]\"><field name=\"VARIABLE\" id=\")^~qarhmXSPA0-E+JO#v\" variabletype=\"\">sideB</field></block></value></block></value></block></value><next><block type=\"iq_looks_print_new\" id=\",GKv?5ulrvgJU|`jN5$I\"><field name=\"TARGET\">Brain</field><field name=\"andsetcursortonextrow_mutator\">FALSE</field><value name=\"DATA\"><shadow type=\"text\" id=\"}hLjs4#Z:M8sG`2eWvy;\"><field name=\"TEXT\">Angle a: </field></shadow></value><next><block type=\"iq_looks_print_new\" id=\"4H_Reoj_E4mt(a4^qi4}\"><field name=\"TARGET\">Brain</field><field name=\"andsetcursortonextrow_mutator\">TRUE</field><value name=\"DATA\"><shadow type=\"text\" id=\"nlX*}3)IxdI{23m(}y/.\"><field name=\"TEXT\">VEXcode</field></shadow><block type=\"iq_variables_variable\" id=\"88c9U*EIVT*arJh-k@g-\"><field name=\"VARIABLE\" id=\"LAfei{AgD:!1+-9ld3Fo\" variabletype=\"\">angleA</field></block></value><next><block type=\"iq_other_comment\" id=\"`a@d^fqDyVsV~G,/jQ;z\"><value name=\"COMMENT\"><shadow type=\"comment_text\" id=\"bmff4ID6L2w,f{5B/o[~\"><field name=\"comment\">Need to turn the exterior angle</field></shadow></value><next><block type=\"iq_drivetrain_turn_for\" id=\"Cf@j7~e}3~CH}#Jd%(qQ\"><field name=\"TURNDIRECTION\">right</field><field name=\"anddontwait_mutator\">FALSE</field><value name=\"AMOUNT\"><shadow type=\"math_number\" id=\"h0FFwF}b5?6TRU-Y}e!e\"><field name=\"NUM\">90</field></shadow><block type=\"iq_operator_subtract\" id=\"O@K#$pj@i)oTPa!+X2)%\"><value name=\"NUM1\"><shadow type=\"math_number\" id=\";MUK*Fq+djI#D.fluK-q\"><field name=\"NUM\">180</field></shadow></value><value name=\"NUM2\"><shadow type=\"math_number\" id=\"i6`B]Md_S9:FhP?pv@4#\"><field name=\"NUM\"></field></shadow><block type=\"iq_variables_variable\" id=\"yB/nP2s`^)HW(e^r2^)D\"><field name=\"VARIABLE\" id=\"LAfei{AgD:!1+-9ld3Fo\" variabletype=\"\">angleA</field></block></value></block></value><next><block type=\"iq_drivetrain_drive_for\" id=\"XA;9UX-Eb3},g2:ave]r\"><field name=\"DIRECTION\">fwd</field><field name=\"UNITS\">mm</field><field name=\"anddontwait_mutator\">FALSE</field><value name=\"AMOUNT\"><shadow type=\"math_number\" id=\"o{ka+8zbrzXQDz9T)H8t\"><field name=\"NUM\">200</field></shadow><block type=\"iq_variables_variable\" id=\"?ikJiv/W}m2_J0s?ME6/\"><field name=\"VARIABLE\" id=\"Z4YZ|GAc4klgn.:@0u_E\" variabletype=\"\">sideC</field></block></value><next><block type=\"iq_looks_print_new\" id=\"U-nD9V6(FhZZQo`H3Swg\"><field name=\"TARGET\">Brain</field><field name=\"andsetcursortonextrow_mutator\">FALSE</field><value name=\"DATA\"><shadow type=\"text\" id=\"?ME|2`Ih`Sl*e,{Z*VDA\"><field name=\"TEXT\">C: </field></shadow></value><next><block type=\"iq_looks_print_new\" id=\"{9i;lB[Z6oeyrbRL!oqx\"><field name=\"TARGET\">Brain</field><field name=\"andsetcursortonextrow_mutator\">TRUE</field><value name=\"DATA\"><shadow type=\"text\" id=\"mfOFw@}gDQp_luJ;j9,x\"><field name=\"TEXT\">VEXcode</field></shadow><block type=\"iq_variables_variable\" id=\"xPYq4vVY~bKbmI[-|t!+\"><field name=\"VARIABLE\" id=\"Z4YZ|GAc4klgn.:@0u_E\" variabletype=\"\">sideC</field></block></value></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></xml>","rconfig":[{"port":[1,6],"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}],"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\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\nint Brain_precision = 0, Console_precision = 0;\n\nfloat myVariable, sideA, sideB, sideC, angleA;\n\n// Used to find the format string for printing numbers with the\n// desired number of decimal places\nconst char* printToBrain_numberFormat() {\n  // look at the current precision setting to find the format string\n  switch(Brain_precision){\n    case 0:  return \"%.0f\"; // 0 decimal places (1)\n    case 1:  return \"%.1f\"; // 1 decimal place  (0.1)\n    case 2:  return \"%.2f\"; // 2 decimal places (0.01)\n    case 3:  return \"%.3f\"; // 3 decimal places (0.001)\n    default: return \"%f\"; // use the print system default for everthing else\n  }\n}\n\n// \"when started\" hat block\nint whenStarted1() {\n  Console_precision = 2;\n  sideA = 600.0;\n  sideB = 450.0;\n  sideC = sqrt(sideA * sideA + sideB * sideB);\n  Drivetrain.driveFor(forward, sideA, mm);\n  Brain.Screen.print(\"A: \");\n  Brain.Screen.print(printToBrain_numberFormat(), static_cast<float>(sideA));\n  Brain.Screen.newLine();\n  Drivetrain.turnFor(right, 90.0, degrees);\n  Drivetrain.driveFor(forward, sideB, mm);\n  Brain.Screen.print(\"B: \");\n  Brain.Screen.print(printToBrain_numberFormat(), static_cast<float>(sideB));\n  Brain.Screen.newLine();\n  // Calculate angle a\n  angleA = atan(sideA / sideB) * 180 / M_PI;\n  Brain.Screen.print(\"Angle a: \");\n  Brain.Screen.print(printToBrain_numberFormat(), static_cast<float>(angleA));\n  Brain.Screen.newLine();\n  // Need to turn the exterior angle\n  Drivetrain.turnFor(right, (180.0 - angleA), degrees);\n  Drivetrain.driveFor(forward, sideC, mm);\n  Brain.Screen.print(\"C: \");\n  Brain.Screen.print(printToBrain_numberFormat(), static_cast<float>(sideC));\n  Brain.Screen.newLine();\n  return 0;\n}\n\n\nint main() {\n  // Calibrate the Drivetrain Gyro\n  calibrateDrivetrain();\n\n  whenStarted1();\n}","target":"Physical"}