Unofficial Re: Autonomus Programming

@Vexnuprogrammer few pepole can answer in official and they’re less likely to try to understand your long code listing.
On high level, I think your previous function never finishes because your exit condition is never satisfied. Consider these 3 lines of your main:

mobileGoal_IME(95, 1080);
move_IME(127, 1800, 90);
mobileGoal_IME(95, 360);

You start the MG lift at speed 95 and wait for 1080 ticks. So far so good (as long as the motor is actually mechanically able to turn that far).
Next you move, I suppose this happens.
The third line is looks problematic to me - you’re moving the mogo lift in the same direction as before and expect it to do another 360 ticks. First, I think you actually wanted to move in opposite direction - for that, you’d need to use negative motor power, but also different structure of the exit condition inside mobileGoal_IME (the encoder would go into negative values too and you’ll need to flip the comparison).
But even if that’s not the case and you actually wanted to move another 360 ticks in the same direction, see my first comment - you’re likely going to run into the physical limit, the motor would keep pushing, but being unable to turn more, it would never satisfy your condition.

A simple way to see what’s going on is to use the datalog - in motor/sensor setup, add logging for your key values (SensorValues of MG and drive, motor power of one of the MG and one of the drive motors, …), then from the debugger window, press start logging before starting yout program. The graph would then show you how far did your sensors get.

Another effective technique is to use debugStream - in key functions, you can add printouts upon entrance, exit, or even for progress logging current value of the sensor.

To prevent this kind of stalling you can add some timeouts to your functions (reset timer at start, add break into the loop in case the elapsed time is over the limit).

I prefer to let you figure the code yourself, but feel free to ask for API pointers or snippets…

In my code however, I was using the PC-Based Emulator instead of the Physical Robot to test my code. I did this so that I can see if my code works. For example, if my code worked on the emulator and not the physical robot, I would know that something is wrong with the robot. Also, the lines of code you included in your post were working. It was the pointTurn_IME(127, 450); that went on forever.

Also, thanks for reminding me to put the function at a (-) motorPower instead of positive.