For Squared Away/Programming Sills Challenge, we have split code into blocks and each block would be executed from a starting position (thanks heaven for RCS5). We’re going to have a menu with a list of blocks for the driver to select from (mainly to be able to re-run or skip a block). We’d also like to be able to interrupt/abort a block that’s currently executing. How would we do that?
MyBlocks generate C++ functions behind the scenes, so there’s no real way to interrupt them externally. There’s also no “return” block as of today that would allow you to end the function early (say within a condition).
Would something like this help?
The break block would break out of the repeat 1 block, ending the function.
aah, kinda, it wouldn’t break out of “a bunch of stuff” if that was one or more blocks. I’m just used to the EV3 way of doing things where you could terminate a MyBlock from outside.
OK… You don’t really need any blocking commands, but it would be a bit of a pain. This would to use the bumper to break out in the middle of an arm movement of armDegrees degrees. You would want to stop all relevant motors after the repeat 1 loop because you don’t know which one you’re breaking out of.