Page 1 of 1

Interruption on the code

Posted: 12 Mar 2018, 15:12
by brunofelt
Greetings,
How can i create a interruption on the code and break a big loop?
i.e in my quadruped robot, i have sensors(gyro and accelerometer) for measure the stability of robot base, when there is a destabilization in the robot movement i need to break fastly the current movement and execute a posture correction. but the code with do the robot movement pattern is extensive and if possible i would not like to put many conditionals 'if' on the middle.

Thanks you.

Re: Interruption on the code

Posted: 12 Mar 2018, 15:56
by fferri
It's difficult to answer without examining some actual code.

Perhaps try to put your main code inside a function, so that you can easily exit from it with a "return" statement in the code.