Motor Moving out of Turn v5 Blocks

Hello,

We’re having major errors with our program we have built for a competition coming in 2 days, and if we could get some help that’d be great.

The error we’re having: the bot moves forward a significant amount prior to activating any created code.

Here are some pictures of the current code. Are there any problems with the code? Or is this an error within the bot’s brain?

Thanks.

48 PM

For clarification, the detached broadcast segment normally goes beneath the Wait 2 Seconds block under the When Started block, its currently detached because I tried to simplify the code for troubleshooting purposes.

I believe you can simplify your code a lot just by setting up a drivetrain and having “drive forward” and “turn ___” commands.

Hello!

Thank you for your suggestion, but it is a 4 wheel drive robot, which gives problems with the drivetrain, which (from what I can find) only allows 2 wheels, and you can only have 1 drivetrain, which is unfortunate.


Idk how, but this person has a 4M drivetrain.

Hmm. That’s interesting. I did a quick google search on how to set up a 4 motor drivetrain, and found this guide on how to set it up. However, the 4 motor drivetrain option never shows up when. I select “add a device,” so unfortunately, drivetrains are not an option with our current setup, as far as I can find.

so what exactly is the problem ? When the code runs you move spin motors for 6000 degrees, does that not happen ?

1 Like

Hello!

I suppose I should’ve gone into more detail above. Our bot is built optimized for the Tower Takeover competition. It is a 4-wheeled bot (leftAltDrive, leftMainDrive, rightAltDrive, & rightMainDrive) with a tray that can rotate in the center for stacking blocks (alignTrayMotor), two arms that can both be lifted as a unit (spinFlipMotor) and they have brush-like wheel attachments on the end that allow it to scoop block onto the tray (leftSpinMotor & rightSpinMotor)

The bot is meant to go forward with Left and RightSpinMotor spinning inward. As it goes to a row of blocks, the brushes push the block up the diagonally aligned tray in the center. Once the tray is full, the bot then returns to a corner (where collected blocks are stored), flips the tray, and leaves the blocks in a stack.

The problem we’re facing is: when the program initiates, the 4 driving motors seem to rotate somewhere around 1000 degrees, then it starts the rest of what is programmed. We know all the motors are in the correct ports because the controller works correctly with each button activating the correct motors.

I was able to find a similar looking picture of the bot on the internet, as I am currently away from the bot.

image

Hope this helps you understand the scenario!

There must be some more code we cannot see or something like that, attach the project file to this topic and I will have a look.

1 Like

Ok, will do. I cannot do it tonight, since I am at home, but I can get it up tomorrow morning. (~7:20 EST)

Thanks!

It’s not letting me upload the file, it says that new users cannot upload files. I’m looking for code that may have been missed in the screenshot.

That is all the code though; there is no code in any other directions. I was able to open the file in TextEdit and pasted it below, if that helps.

{“wrkspace”:"<xml xmlns=“http://www.w3.org/1999/xhtml”><variable type="" id=“U9aA+=)r+L1tzA.)-qi\" islocal=\"false\" iscloud=\"false\" arraylength=\"0\" arraywidth=\"0\">my variable</variable><variable type=\"broadcast_msg\" id=\";kIy8)B8qUH#;!*;%dgP\" islocal=\"false\" iscloud=\"false\" arraylength=\"0\" arraywidth=\"0\">message1</variable><variable type=\"broadcast_msg\" id=\"iEvkib?0-PpBa9P,|M:y\" islocal=\"false\" iscloud=\"false\" arraylength=\"0\" arraywidth=\"0\">OmNomNom</variable><variable type=\"broadcast_msg\" id=\"A!F#+WOx97DB5_+d[lpR\" islocal=\"false\" iscloud=\"false\" arraylength=\"0\" arraywidth=\"0\">DriveForward1440</variable><variable type=\"broadcast_msg\" id=\",a^0+mwLK2{lTi4UFqlS\" islocal=\"false\" iscloud=\"false\" arraylength=\"0\" arraywidth=\"0\">BackUp</variable><variable type=\"broadcast_msg\" id=\"xBzt0ek(uLva)JNepLv/\" islocal=\"false\" iscloud=\"false\" arraylength=\"0\" arraywidth=\"0\">Turn</variable><variable type=\"broadcast_msg\" id=\"Z]OC3GB[Tw)y^hZC~U(S\" islocal=\"false\" iscloud=\"false\" arraylength=\"0\" arraywidth=\"0\">LiftTray</variable><variable type=\"broadcast_msg\" id=\"|l(]K1H2O64@/nXG=Ce5\" islocal=\"false\" iscloud=\"false\" arraylength=\"0\" arraywidth=\"0\">LiftArms</variable><variable type=\"broadcast_msg\" id=\"aIRD%]peLv(8qC}5*t*V\" islocal=\"false\" iscloud=\"false\" arraylength=\"0\" arraywidth=\"0\">DriveForwardSlightly</variable></variables><block type=\"v5_events_when_started\" id=\".NsXwU_L.OuU1l7Sho$F\" x=\"-10\" y=\"-10\"><next><block type=\"v5_events_broadcast\" id=\"f4~lag17:JcKA%{G}nrs\"><value name=\"BROADCAST_INPUT\"><shadow type=\"event_broadcast_menu\" id=\"O4%:XB]%8=QdAQ9@Q9~/\"><field name=\"BROADCAST_OPTION\" id=\"iEvkib?0-PpBa9P,|M:y\" variabletype=\"broadcast_msg\">OmNomNom</field></shadow></value><next><block type=\"v5_control_wait\" id=\"SWZ9x8Uf^wuLeSe]tlRO\"><value name=\"DURATION\"><shadow type=\"math_positive_number\" id=\"/X#D(X%gaopeIBn13{Qt\"><field name=\"NUM\">3</field></shadow></value></block></next></block></next></block><block type=\"v5_events_when_broadcasted\" id=\"e5(u;f7Ci$%^m3IC-tP2\" x=\"690\" y=\"-30\"><field name=\"BROADCAST_OPTION\" id=\"iEvkib?0-PpBa9P,|M:y\" variabletype=\"broadcast_msg\">OmNomNom</field><next><block type=\"v5_motion_set_motor_velocity\" id=\"TvyvOW.[(%^W7xZ$BKuj\"><field name=\"MOTOR\">LeftSpinMotor</field><field name=\"UNITS\">pct</field><value name=\"VELOCITY\"><shadow type=\"math_number\" id=\"Vat3n2}Y0nDjBN4tkaJs\"><field name=\"NUM\">100</field></shadow></value><next><block type=\"v5_motion_set_motor_velocity\" id=\"-)K)VYiMf)Sz?wKK2mK”><field name=“MOTOR”>RightSpinMotor<field name=“UNITS”>pct<value name=“VELOCITY”><shadow type=“math_number” id=“gcPIZq@A(j@}~Z1:]ja\"><field name=\"NUM\">100</field></shadow></value><next><block type=\"v5_motion_set_motor_torque\" id=\"o1^~gq)HHTnw(K}@m(NT\"><field name=\"MOTOR\">LeftSpinMotor</field><value name=\"TORQUE\"><shadow type=\"math_number\" id=\"[6iA@DjTZ%b7%=1VR6R”><field name=“NUM”>100<block type=“v5_motion_set_motor_torque” id=“lebQ%oJC[#KW;flycy!"><field name=“MOTOR”>RightSpinMotor<value name=“TORQUE”><shadow type=“math_number” id=“fx+eSDf];Tzx$l%.:kM\"><field name=\"NUM\">100</field></shadow></value><next><block type=\"v5_motion_spin_for\" id=\"%,U!1AjXfnyZ^I/BloG=\"><field name=\"MOTOR\">LeftSpinMotor</field><field name=\"DIRECTION\">fwd</field><field name=\"UNITS\">deg</field><field name=\"anddontwait_mutator\">TRUE</field><value name=\"AMOUNT\"><shadow type=\"math_number\" id=\"+9V^W@AWM?J4-hX(8x%”><field name=“NUM”>6000<block type=“v5_motion_spin_for” id=“DcRfWj^dV8Tx/)Jxig0\"><field name=\"MOTOR\">RightSpinMotor</field><field name=\"DIRECTION\">fwd</field><field name=\"UNITS\">deg</field><field name=\"anddontwait_mutator\">FALSE</field><value name=\"AMOUNT\"><shadow type=\"math_number\" id=\"9mb3B9NRQnMd43yL1MPc\"><field name=\"NUM\">6000</field></shadow></value></block></next></block></next></block></next></block></next></block></next></block></next></block><block type=\"v5_events_broadcast\" id=\"QtDF~tNr-S%IIP)R)Pr0\" x=\"350\" y=\"10\"><value name=\"BROADCAST_INPUT\"><shadow type=\"event_broadcast_menu\" id=\"ZRVPN2K/ai|}+(@#3t3”><field name=“BROADCAST_OPTION” id="A!F#+WOx97DB5+d[lpR” variabletype=“broadcast_msg”>DriveForward1440<block type=“v5_control_wait” id=“L|#:u7[ND-134ZpX:LdC”><value name=“DURATION”><shadow type=“math_positive_number” id=“HF3S4u2o=Sh:Z6;t(Qw"><field name=“NUM”>5<block type=“v5_events_broadcast” id=“KO8KpAk(_9IAw_LG;If4”><value name=“BROADCAST_INPUT”><shadow type=“event_broadcast_menu” id=“ZEil]~)#|G-3r]pa6bx3”><field name=“BROADCAST_OPTION” id=",a^0+mwLK2{lTi4UFqlS" variabletype=“broadcast_msg”>BackUp<block type=“v5_control_wait” id=“g-QmEaOA$lJrR~[Lb#lX”><value name=“DURATION”><shadow type=“math_positive_number” id="(uy1j#$33C;cTUoe=U@K"><field name=“NUM”>2<block type=“v5_events_broadcast” id=“w+5d}-.T4zva(LNI|3@S”><value name=“BROADCAST_INPUT”><shadow type=“event_broadcast_menu” id=“svLKTU%L8yGyWwzx^IKR”><field name=“BROADCAST_OPTION” id=“xBzt0ek(uLva)JNepLv/” variabletype=“broadcast_msg”>Turn<block type=“v5_control_wait” id=“yPE_0JZggeL6SOTewmAW”><value name=“DURATION”><shadow type=“math_positive_number” id=“ze7…iod9OoChAN^|gI\"><field name=\"NUM\">2</field></shadow></value><next><block type=\"v5_motion_stop_motor\" id=\",CV?tfRP5;!FAj#y?vQ9\"><field name=\"MOTOR\">LeftSpinMotor</field><next><block type=\"v5_motion_stop_motor\" id=\"[mlLYX__,U;WrD=3];W*\"><field name=\"MOTOR\">RightSpinMotor</field></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block><block type=\"v5_events_when_broadcasted\" id=\"Xtdx#[QW-P0$9Tlo/Ts,\" x=\"1510\" y=\"-30\"><field name=\"BROADCAST_OPTION\" id=\"Z]OC3GB[Tw)y^hZC~U(S\" variabletype=\"broadcast_msg\">LiftTray</field><next><block type=\"v5_motion_spin_for\" id=\"!q8vJ62xcy/Z3)Aj(-$)\"><field name=\"MOTOR\">AlignTrayMotor</field><field name=\"DIRECTION\">rev</field><field name=\"UNITS\">deg</field><field name=\"anddontwait_mutator\">TRUE</field><value name=\"AMOUNT\"><shadow type=\"math_number\" id=\"i%h,%L8|).CMY!kmYO|]\"><field name=\"NUM\">800</field></shadow></value></block></next></block><block type=\"v5_events_when_broadcasted\" id=\"bbO8lduNPF/5a,WBDc/E\" x=\"1510\" y=\"170\"><field name=\"BROADCAST_OPTION\" id=\",a^0+mwLK2{lTi4UFqlS\" variabletype=\"broadcast_msg\">BackUp</field><next><block type=\"v5_motion_set_motor_velocity\" id=\"=-7By(LbMq:e29|7n2D”><field name=“MOTOR”>LeftAltDrive<field name=“UNITS”>pct<value name=“VELOCITY”><shadow type=“math_number” id=“lC1m0:XS2Y)r+^]K,T51”><field name=“NUM”>20<block type=“v5_motion_set_motor_velocity” id="{gZiF+U:JjyOaX%zpzZ5"><field name=“MOTOR”>RightAltDrive<field name=“UNITS”>pct<value name=“VELOCITY”><shadow type=“math_number” id="#1M+N]a+^A!-:47}vN;G"><field name=“NUM”>20<block type=“v5_motion_set_motor_velocity” id="}ot#?dWG$gT2[xOK@a2L"><field name=“MOTOR”>LeftMainDrive<field name=“UNITS”>pct<value name=“VELOCITY”><shadow type=“math_number” id=“dpy=kV%D(sx:TzFzoL1-”><field name=“NUM”>20<block type=“v5_motion_set_motor_velocity” id=“HM/ix4Y@NN}s:C]0x]M}”><field name=“MOTOR”>RightMainDrive<field name=“UNITS”>pct<value name=“VELOCITY”><shadow type=“math_number” id=“koPPkn!MQf@TZnHj;Di5”><field name=“NUM”>20<block type=“v5_motion_spin_for” id=“BSc7g%Q9x}=Hd#BAm@cb”><field name=“MOTOR”>LeftAltDrive<field name=“DIRECTION”>rev<field name=“UNITS”>deg<field name=“anddontwait_mutator”>TRUE<value name=“AMOUNT”><shadow type=“math_number” id="|G7GhX2VTIH2Ruz;^5)S"><field name=“NUM”>425<block type=“v5_motion_spin_for” id="hf+GL6{Jm3iX5CYf[(8”><field name=“MOTOR”>RightAltDrive<field name=“DIRECTION”>rev<field name=“UNITS”>deg<field name=“anddontwait_mutator”>TRUE<value name=“AMOUNT”><shadow type=“math_number” id=“W!tzZBaBRb2-8Ygu||Z\"><field name=\"NUM\">425</field></shadow></value><next><block type=\"v5_motion_spin_for\" id=\"XIW_%O1Ik,4C1[)fQmSl\"><field name=\"MOTOR\">LeftMainDrive</field><field name=\"DIRECTION\">rev</field><field name=\"UNITS\">deg</field><field name=\"anddontwait_mutator\">TRUE</field><value name=\"AMOUNT\"><shadow type=\"math_number\" id=\"ozW|-GuV!5o@iZaY}KfI\"><field name=\"NUM\">425</field></shadow></value><next><block type=\"v5_motion_spin_for\" id=\"N*Rx9G]ZPmh3bvaI;:s”><field name=“MOTOR”>RightMainDrive<field name=“DIRECTION”>rev<field name=“UNITS”>deg<field name=“anddontwait_mutator”>TRUE<value name=“AMOUNT”><shadow type=“math_number” id=“hly6*({wdR^1KNmy3*F\"><field name=\"NUM\">425</field></shadow></value></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block><block type=\"v5_events_when_broadcasted\" id=\"z-%3nD%+!jBG[c_gLbpT\" x=\"710\" y=\"370\"><field name=\"BROADCAST_OPTION\" id=\"A!F#+WOx97DB5_+d[lpR\" variabletype=\"broadcast_msg\">DriveForward1440</field><next><block type=\"v5_motion_set_motor_velocity\" id=\"r0z,Fbet1m$meDna]a;~\"><field name=\"MOTOR\">LeftAltDrive</field><field name=\"UNITS\">pct</field><value name=\"VELOCITY\"><shadow type=\"math_number\" id=\"z=5S}ysmJww0-y+9uI|J\"><field name=\"NUM\">20</field></shadow></value><next><block type=\"v5_motion_set_motor_velocity\" id=\"mODe^K),gV/FdsFho:"><field name=“MOTOR”>RightAltDrive<field name=“UNITS”>pct<value name=“VELOCITY”><shadow type=“math_number” id=“L.^8IDKNkywc0E@Fk(A2”><field name=“NUM”>20<block type=“v5_motion_set_motor_velocity” id=“8qr7nqno@Wlo_8:y0ZQ^”><field name=“MOTOR”>LeftMainDrive<field name=“UNITS”>pct<value name=“VELOCITY”><shadow type=“math_number” id=“WBH9n5{]7C9{]x;W79;\"><field name=\"NUM\">20</field></shadow></value><next><block type=\"v5_motion_set_motor_velocity\" id=\"]05:#47N067tQ76WXa~A\"><field name=\"MOTOR\">RightMainDrive</field><field name=\"UNITS\">pct</field><value name=\"VELOCITY\"><shadow type=\"math_number\" id=\"br%5ycJ]b5yAqZJeMu*_\"><field name=\"NUM\">20</field></shadow></value><next><block type=\"v5_motion_spin_for\" id=\"ku.k+Z3G%|[J(fdHZ~or\"><field name=\"MOTOR\">LeftAltDrive</field><field name=\"DIRECTION\">fwd</field><field name=\"UNITS\">deg</field><field name=\"anddontwait_mutator\">TRUE</field><value name=\"AMOUNT\"><shadow type=\"math_number\" id=\"WAy@Xv-t=*^A5^i9#{}e\"><field name=\"NUM\">700</field></shadow></value><next><block type=\"v5_motion_spin_for\" id=\"2(,V:$J1aF[n)#D7ajd”><field name=“MOTOR”>RightAltDrive<field name=“DIRECTION”>fwd<field name=“UNITS”>deg<field name=“anddontwait_mutator”>TRUE<value name=“AMOUNT”><shadow type=“math_number” id="=7g9(BkLr|WD),hRqqK["><field name=“NUM”>700<block type=“v5_motion_spin_for” id=“P|e(mjr}F$12aNQw]aj0”><field name=“MOTOR”>LeftMainDrive<field name=“DIRECTION”>fwd<field name=“UNITS”>deg<field name=“anddontwait_mutator”>TRUE<value name=“AMOUNT”><shadow type=“math_number” id="(/?!lOVi-Ktap2%ik5s”><field name=“NUM”>700<block type=“v5_motion_spin_for” id="%?GdnUGcaIVZZ-B^MR1W"><field name=“MOTOR”>RightMainDrive<field name=“DIRECTION”>fwd<field name=“UNITS”>deg<field name=“anddontwait_mutator”>TRUE<value name=“AMOUNT”><shadow type=“math_number” id=“9uZC)+[{+kN2Z0}]J+b\"><field name=\"NUM\">700</field></shadow></value></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block><block type=\"v5_events_when_broadcasted\" id=\"IRkgRvSB]8.K/^O;.]%” x="-50" y=“410”><field name=“BROADCAST_OPTION” id=“xBzt0ek(uLva)JNepLv/” variabletype=“broadcast_msg”>Turn<block type=“v5_motion_set_motor_velocity” id="?^S8KiSb^PJviu)3]Z]m"><field name=“MOTOR”>LeftAltDrive<field name=“UNITS”>pct<value name=“VELOCITY”><shadow type=“math_number” id=“2!yigmtFA3ua-!95(.r:”><field name=“NUM”>20<block type=“v5_motion_set_motor_velocity” id=“Pzf$I!llLPq17bg9dVVS”><field name=“MOTOR”>RightAltDrive<field name=“UNITS”>pct<value name=“VELOCITY”><shadow type=“math_number” id=“l17L.cjysz%JlGn0KCpX”><field name=“NUM”>20<block type=“v5_motion_set_motor_velocity” id=“UsQZOb?6J~tJSSiZinwJ”><field name=“MOTOR”>LeftMainDrive<field name=“UNITS”>pct<value name=“VELOCITY”><shadow type=“math_number” id=“2%X~BXKQPfx4wKVApA”><field name=“NUM”>20<block type=“v5_motion_set_motor_velocity” id="}zCI8h~Ihcj;-~||=HK\"><field name=\"MOTOR\">RightMainDrive</field><field name=\"UNITS\">pct</field><value name=\"VELOCITY\"><shadow type=\"math_number\" id=\";5|qDGee,V%8mp~DS.u"><field name=“NUM”>20<block type=“v5_motion_spin_for” id=“U#_DVM(P5X]FSym04^!a”><field name=“MOTOR”>LeftAltDrive<field name=“DIRECTION”>fwd<field name=“UNITS”>deg<field name=“anddontwait_mutator”>TRUE<value name=“AMOUNT”><shadow type=“math_number” id=“b21pvnl$gQWz?pSr^As"><field name=“NUM”>250<block type=“v5_motion_spin_for” id=“nf!EzRnA^(#Dpx~k2:XF”><field name=“MOTOR”>RightAltDrive<field name=“DIRECTION”>rev<field name=“UNITS”>deg<field name=“anddontwait_mutator”>TRUE<value name=“AMOUNT”><shadow type=“math_number” id="5](sU}eZLkPs[znf9u1”><field name=“NUM”>250<block type=“v5_motion_spin_for” id=":dk8:=S7)Wy7nn*?Dq3/"><field name=“MOTOR”>LeftMainDrive<field name=“DIRECTION”>fwd<field name=“UNITS”>deg<field name=“anddontwait_mutator”>TRUE<value name=“AMOUNT”><shadow type=“math_number” id=“HMhg07R[+hpWu4xEz8:D”><field name=“NUM”>250<block type=“v5_motion_spin_for” id=“7IQ1pq@@-1fWSRetQPb)”><field name=“MOTOR”>RightMainDrive<field name=“DIRECTION”>rev<field name=“UNITS”>deg<field name=“anddontwait_mutator”>TRUE<value name=“AMOUNT”><shadow type=“math_number” id="!Xj(Z]3{#gW_sKbMcDY("><field name=“NUM”>250<block type=“v5_events_when_broadcasted” id=“N./3B{lNGxgf7vxaNGhx” x=“1510” y=“650”><field name=“BROADCAST_OPTION” id="|l(]K1H2O64@/nXG=Ce5" variabletype=“broadcast_msg”>LiftArms<block type=“v5_motion_stop_motor” id=“s#zqCB9/8kLp[nDZp|4u”><field name=“MOTOR”>LeftSpinMotor<block type=“v5_motion_stop_motor” id=“OsbC2kI?[{^$go]f8Mf\"><field name=\"MOTOR\">RightSpinMotor</field><next><block type=\"v5_motion_spin_for\" id=\"h1qEJ+X^x]jN9:5_4M/[\"><field name=\"MOTOR\">SpinFlipMotor</field><field name=\"DIRECTION\">fwd</field><field name=\"UNITS\">deg</field><field name=\"anddontwait_mutator\">TRUE</field><value name=\"AMOUNT\"><shadow type=\"math_number\" id=\"1w=R?pP!hZ2uYs;5eB9X\"><field name=\"NUM\">1000</field></shadow></value></block></next></block></next></block></next></block><block type=\"v5_events_when_broadcasted\" id=\"!0xefik$4(WDvG[jsrKt\" x=\"810\" y=\"850\"><field name=\"BROADCAST_OPTION\" id=\"aIRD%]peLv(8qC}5*t*V\" variabletype=\"broadcast_msg\">DriveForwardSlightly</field><next><block type=\"v5_motion_set_motor_velocity\" id=\"W=sc=O(inO[+a,}*hp-f\"><field name=\"MOTOR\">LeftAltDrive</field><field name=\"UNITS\">pct</field><value name=\"VELOCITY\"><shadow type=\"math_number\" id=\"#VN@$_/r.e:FXnYN213”><field name=“NUM”>20<block type=“v5_motion_set_motor_velocity” id=“vyI;77;)wLGYCIlCmO8,”><field name=“MOTOR”>RightAltDrive<field name=“UNITS”>pct<value name=“VELOCITY”><shadow type=“math_number” id=“nP7s%:)i#S@nP^x:.N.9”><field name=“NUM”>20<block type=“v5_motion_set_motor_velocity” id=“z#HBym0xsyP=PCK:(0H\"><field name=\"MOTOR\">LeftMainDrive</field><field name=\"UNITS\">pct</field><value name=\"VELOCITY\"><shadow type=\"math_number\" id=\"3Dz5J4W[]!@4-PyHKw(+\"><field name=\"NUM\">20</field></shadow></value><next><block type=\"v5_motion_set_motor_velocity\" id=\"AeMzPq+t6H$kqQM*Y8|E\"><field name=\"MOTOR\">RightMainDrive</field><field name=\"UNITS\">pct</field><value name=\"VELOCITY\"><shadow type=\"math_number\" id=\"mr,wa6m1{~,_ZLRwZ194\"><field name=\"NUM\">20</field></shadow></value><next><block type=\"v5_motion_spin_for\" id=\"$v:1S%!#r!PACL0~#Ao5\"><field name=\"MOTOR\">LeftAltDrive</field><field name=\"DIRECTION\">fwd</field><field name=\"UNITS\">deg</field><field name=\"anddontwait_mutator\">TRUE</field><value name=\"AMOUNT\"><shadow type=\"math_number\" id=\"ETlv!Ct?dc8E#/zd6i,{\"><field name=\"NUM\">390</field></shadow></value><next><block type=\"v5_motion_spin_for\" id=\"U:EQ[Ux0?1H(7|)y*-G”><field name=“MOTOR”>RightAltDrive<field name=“DIRECTION”>fwd<field name=“UNITS”>deg<field name=“anddontwait_mutator”>TRUE<value name=“AMOUNT”><shadow type=“math_number” id=“XSP?,HR@=h8j?mPS?`QX”><field name=“NUM”>390<block type=“v5_motion_spin_for” id=“Qbq#3WMPS4^u.zQ2_5Sr”><field name=“MOTOR”>LeftMainDrive<field name=“DIRECTION”>fwd<field name=“UNITS”>deg<field name=“anddontwait_mutator”>TRUE<value name=“AMOUNT”><shadow type=“math_number” id=“J84:ch5CRh=LLIQ=~(J}”><field name=“NUM”>390<block type=“v5_motion_spin_for” id=“i58S(nVJdzi1AG^l{hp"><field name=“MOTOR”>RightMainDrive<field name=“DIRECTION”>fwd<field name=“UNITS”>deg<field name=“anddontwait_mutator”>TRUE<value name=“AMOUNT”><shadow type=“math_number” id="H}veJ6gRI-8AD#JI4x#”><field name=“NUM”>390",“rconfig”:[{“port”:[1],“name”:“LeftAltDrive”,“customName”:true,“deviceType”:“Motor”,“setting”:{“reversed”:“false”,“fwd”:“forward”,“rev”:“reverse”,“gear”:“ratio36_1”}},{“port”:[2],“name”:“RightAltDrive”,“customName”:true,“deviceType”:“Motor”,“setting”:{“reversed”:“true”,“fwd”:“forward”,“rev”:“reverse”,“gear”:“ratio36_1”}},{“port”:[3],“name”:“LeftSpinMotor”,“customName”:true,“deviceType”:“Motor”,“setting”:{“reversed”:“false”,“fwd”:“forward”,“rev”:“reverse”,“gear”:“ratio36_1”}},{“port”:[8],“name”:“RightSpinMotor”,“customName”:true,“deviceType”:“Motor”,“setting”:{“reversed”:“false”,“fwd”:“forward”,“rev”:“reverse”,“gear”:“ratio36_1”}},{“port”:[5],“name”:“SpinFlipMotor”,“customName”:true,“deviceType”:“Motor”,“setting”:{“reversed”:“false”,“fwd”:“forward”,“rev”:“reverse”,“gear”:“ratio36_1”}},{“port”:[7],“name”:“AlignTrayMotor”,“customName”:true,“deviceType”:“Motor”,“setting”:{“reversed”:“false”,“fwd”:“forward”,“rev”:“reverse”,“gear”:“ratio36_1”}},{“port”:[9],“name”:“LeftMainDrive”,“customName”:true,“deviceType”:“Motor”,“setting”:{“reversed”:“false”,“fwd”:“forward”,“rev”:“reverse”,“gear”:“ratio36_1”}},{“port”:[10],“name”:“RightMainDrive”,“customName”:true,“deviceType”:“Motor”,“setting”:{“reversed”:“true”,“fwd”:“forward”,“rev”:“reverse”,“gear”:“ratio36_1”}}],“slot”:0,“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 “v5.h”\n#include “v5_cpp.h”\n\nusing namespace vex;\n\n// Brain should be defined by default\nbrain Brain;\n\n// Robot configuration code.\nmotor LeftAltDrive = motor(vex::PORT1, vex::gearSetting::ratio36_1, false);\n\nmotor RightAltDrive = motor(vex::PORT2, vex::gearSetting::ratio36_1, true);\n\nmotor LeftSpinMotor = motor(vex::PORT3, vex::gearSetting::ratio36_1, false);\n\nmotor RightSpinMotor = motor(vex::PORT8, vex::gearSetting::ratio36_1, false);\n\nmotor SpinFlipMotor = motor(vex::PORT5, vex::gearSetting::ratio36_1, false);\n\nmotor AlignTrayMotor = motor(vex::PORT7, vex::gearSetting::ratio36_1, false);\n\nmotor LeftMainDrive = motor(vex::PORT9, vex::gearSetting::ratio36_1, false);\n\nmotor RightMainDrive = motor(vex::PORT10, vex::gearSetting::ratio36_1, true);\n\n\n//Vision sensor index vars.\nint Vision1_objectIndex = 0;\n\nint Brain_precision;\n\n\n// Generated code.\n\nfloat my_variable;\n\nvex::event message1 = vex::event();\nvex::event OmNomNom = vex::event();\nvex::event DriveForward1440 = vex::event();\nvex::event BackUp = vex::event();\nvex::event Turn = vex::event();\nvex::event LiftTray = vex::event();\nvex::event LiftArms = vex::event();\nvex::event DriveForwardSlightly = vex::event();\n\nint whenStarted1() {\n OmNomNom.broadcast();\n task::sleep(static_cast<uint32_t>(3.01000));\nreturn 0;\n}\n\nvoid onevent_OmNomNom_0() {\n LeftSpinMotor.setVelocity(100.0, vex::velocityUnits::pct);\n RightSpinMotor.setVelocity(100.0, vex::velocityUnits::pct);\n LeftSpinMotor.setMaxTorque(100.0, vex::percentUnits::pct);\n RightSpinMotor.setMaxTorque(100.0, vex::percentUnits::pct);\n LeftSpinMotor.rotateFor(6000.0, vex::rotationUnits::deg, false);\n RightSpinMotor.rotateFor(6000.0, vex::rotationUnits::deg, true);\n}\n\nvoid onevent_LiftTray_0() {\n AlignTrayMotor.rotateFor(800.0 * -1, vex::rotationUnits::deg, false);\n}\n\nvoid onevent_BackUp_0() {\n LeftAltDrive.setVelocity(20.0, vex::velocityUnits::pct);\n RightAltDrive.setVelocity(20.0, vex::velocityUnits::pct);\n LeftMainDrive.setVelocity(20.0, vex::velocityUnits::pct);\n RightMainDrive.setVelocity(20.0, vex::velocityUnits::pct);\n LeftAltDrive.rotateFor(425.0 * -1, vex::rotationUnits::deg, false);\n RightAltDrive.rotateFor(425.0 * -1, vex::rotationUnits::deg, false);\n LeftMainDrive.rotateFor(425.0 * -1, vex::rotationUnits::deg, false);\n RightMainDrive.rotateFor(425.0 * -1, vex::rotationUnits::deg, false);\n}\n\nvoid onevent_DriveForward1440_0() {\n LeftAltDrive.setVelocity(20.0, vex::velocityUnits::pct);\n RightAltDrive.setVelocity(20.0, vex::velocityUnits::pct);\n LeftMainDrive.setVelocity(20.0, vex::velocityUnits::pct);\n RightMainDrive.setVelocity(20.0, vex::velocityUnits::pct);\n LeftAltDrive.rotateFor(700.0, vex::rotationUnits::deg, false);\n RightAltDrive.rotateFor(700.0, vex::rotationUnits::deg, false);\n LeftMainDrive.rotateFor(700.0, vex::rotationUnits::deg, false);\n RightMainDrive.rotateFor(700.0, vex::rotationUnits::deg, false);\n}\n\nvoid onevent_Turn_0() {\n LeftAltDrive.setVelocity(20.0, vex::velocityUnits::pct);\n RightAltDrive.setVelocity(20.0, vex::velocityUnits::pct);\n LeftMainDrive.setVelocity(20.0, vex::velocityUnits::pct);\n RightMainDrive.setVelocity(20.0, vex::velocityUnits::pct);\n LeftAltDrive.rotateFor(250.0, vex::rotationUnits::deg, false);\n RightAltDrive.rotateFor(250.0 * -1, vex::rotationUnits::deg, false);\n LeftMainDrive.rotateFor(250.0, vex::rotationUnits::deg, false);\n RightMainDrive.rotateFor(250.0 * -1, vex::rotationUnits::deg, false);\n}\n\nvoid onevent_LiftArms_0() {\n LeftSpinMotor.stop();\n RightSpinMotor.stop();\n SpinFlipMotor.rotateFor(1000.0, vex::rotationUnits::deg, false);\n}\n\nvoid onevent_DriveForwardSlightly_0() {\n LeftAltDrive.setVelocity(20.0, vex::velocityUnits::pct);\n RightAltDrive.setVelocity(20.0, vex::velocityUnits::pct);\n LeftMainDrive.setVelocity(20.0, vex::velocityUnits::pct);\n RightMainDrive.setVelocity(20.0, vex::velocityUnits::pct);\n LeftAltDrive.rotateFor(390.0, vex::rotationUnits::deg, false);\n RightAltDrive.rotateFor(390.0, vex::rotationUnits::deg, false);\n LeftMainDrive.rotateFor(390.0, vex::rotationUnits::deg, false);\n RightMainDrive.rotateFor(390.0, vex::rotationUnits::deg, false);\n}\n\n\nint main() {\n\n\n srand(vex::timer::system());\n\n\n\n // pre event registration\n // register event handlers\n OmNomNom(onevent_OmNomNom_0);\n LiftTray(onevent_LiftTray_0);\n BackUp(onevent_BackUp_0);\n DriveForward1440(onevent_DriveForward1440_0);\n Turn(onevent_Turn_0);\n LiftArms(onevent_LiftArms_0);\n DriveForwardSlightly(onevent_DriveForwardSlightly_0);\n\n task::sleep(15);\n // post event registration\nDriveForward1440.broadcast();\ntask::sleep(static_cast<uint32_t>(5.01000));\nBackUp.broadcast();\ntask::sleep(static_cast<uint32_t>(2.01000));\nTurn.broadcast();\ntask::sleep(static_cast<uint32_t>(2.01000));\nLeftSpinMotor.stop();\nRightSpinMotor.stop();\n\n // when started blocks…\n\n whenStarted1();\n return 0;\n}",“cppStatus”:“true”,“platform”:“V5”,“sdkVersion”:“20190805.09.00.00”,“appVersion”:“1.0.1-344”,“fileFormat”:“0.1.1”,“icon”:""}

Quick update:

In short, I think I found out the problem: although the program was told to broadcast OmNomNom, it instead was broadcasting DriveForward1440. Why? No clue. However, I tried removing the broadcast system entirely and was able to get it to work! So now I just need to make a few tweaks to finish up some turning angles and things, and then, hopefully, it’ll work.

Thanks to all who helped!

1 Like