Vexcode IQ Gen 2 max program size? Autonomous program crashing

My elementary team is struggling with Vex IQ slapshot autonomous program and it appears to be hitting a code stack overflow .

Our programmer created a series about 15 steps long. He is able to dump a blue dispenser and shoot the pucks. The last few (4) steps to dump the Yellow dispenser flakes out.

Two years ago ran into similar problem with a lot more steps in Rise above (about 100 lines).

Brain is gen 2 with latest firmware, iPad with Vexcode iq version 2.4.4-10; Gen 2 SDK 20220726.10.00.00.

Summary: robot has an arm that dumps blue dispensers into an internal puck tray that feeds a flywheel to shoot. For the autonomous program, they created about 15 steps to drive forward, turn and wrap arm behind blue dispenser shelf to raise and dump pucks into internal puck tray, then go shoot. After shooting, turn and push green bar of yellow dispenser to dump those pucks. His plan was then go dump and then shoot the second blue dispenser . Pretty straightforward program. About 15 step’s including a block call to flip the puck tray on a loop 5 or 6 times. After shooting, a simple turn left 90 degrees causes the robot to “flake out” and turn randomly (jerking back and forth continuously without advancing to the next steps. They have tried several steps to test (remove shooting block call, embed block directly into steps; repeat loop 5 times? Manually copying shoot steps 5 times to eliminate loop, etc. no matter what they do, the program flakes out.

Is there a program step limit? Is there a max program file size limit?

They have multiple programs (drive, autonomous dump 3 dispensers, shooting autonomous program 1; test autonomous program 2. Is the memory getting full in the brain?

He only has 4 more lines to dump yellow dispenser.

Thanks for any help.


If you can send me the program I will take a look and see what’s going on.

There is a program size limit but it’s not determined by the number of blocks but rather the size of the binary after the blocks have been converted to text internally and then compiled. I would be surprised if you have hit the limit as that would usually cause an error at the compile stage. But there are other potential things you could run into, the number of events, size of variables etc.


Would it help to clean out all extra /remnant code not being used?

Thanks might be tomorrow- iPhone won’t upload.

looks like you submitted feedback earlier with the project attached, was the the program with issues ?


Yes and thanks. The code for when brain button pushed. He added sounds at bottom to detect where it flaked out. Would it help to clean out extra drive related code?

we had an issue on a gen1 brain last year where we graphed out variables for a pid loop onto the iq brain, to help us tune it. While running the program about 1 in 5 times, the program would freeze, and we would have to take the battery out and manually reset it. This happened across two different brains.

If we took out the graphing loop, the freezing would stop. Our theory at the time was that the code would be overloading the brain, since we were running two pid loops, and graphing out multiple variables at the same time.

Wondering- is it better for the brain to call blocks of redundant code or have them place in line ? Programming code and variables always better - but is that overhead killing our program? Running a loop 5 times or copying code 5 times? I know loop tighter - but is it more overhead for Vexcode iq and causing their robot to flake out?

Do they need to clean out program slots down to 1 drive program and one skills program? Like to keep second skills program that dumps 3 and 29 for a backup.


Clean out any extra code sample (drive events, etc.) to lean up compiled code and stay within confines of gen 2 brain? Seems like it should be able to handle at least 4 programs (8 slots), block calls, loops, comments and variables.
Rod Cushman - Team 201B Vex IQ 2022 Slapshot program Line Shooter 03 20221130.pdf.pdf (2.2 MB)

I think this is their latest code.

Thanks all!

No, that should not be necessary.
In very general terms, max size of an IQ2 program is around 100k bytes. The code attached to feedback last night compiles to about 17k. The file system on the IQ2 is 4MB (IIRC), so there should never be an issue using all 8 slots.

I have not had a chance to look at the code from the feedback channel in detail yet, however, it does appear to be more of a driver control program than an autonomous program. I’ll download the one from you post above and look at that also.

edit: Oh, that’s just a pdf above, not much use to me.


One other thing I would add is that as you have the drivetrain connected to the controller in the graphical setup, you need to disable the controller when using blocks to control the drivetrain. Use the “Controller disable” block.


He added the disable controller to the top of when brain pushed and no change. After shooting pucks any turn command flakes out. Thoughts

can you send me the actual project file they are using (not pdf, I need to be able to run it).


line shooter program 05.iqblocks (57.8 KB)
shooter program 04.iqblocks (46.9 KB)

Didn’t look at the code - after shoot picks block he had four lines
Turn left 90; drive reverse 7”
Turn right 45 or 90
Drive reverse 2 inches.


ok, there is an issue in IQ2 somewhere. Playing note C is affecting the inertial sensor for some reason, I will dig into that early next week, in the short term, either remove playing notes or change note C to something else (I tried D and it seemed ok). so change this code here and other places note C is used.

also, last move in only 2 mm ?


actually, other notes may also cause this problem, perhaps avoid them for now until I can figure out what’s wrong.


Thank you!!! He took the play notes out (D did the same) and it is working!

He put the notes for quick debug (which step bombed; removed all of them and it is working great.

Well done Jpearman! Well done. Pass along to developers as a bug but thank you! Our team was really scratching their heads.

1 Like