Interruption on the code

Typically: "How do I... ", "How can I... " questions
Post Reply
brunofelt
Posts: 1
Joined: 09 Mar 2018, 13:20

Interruption on the code

Post by brunofelt » 12 Mar 2018, 15:12

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.

fferri
Posts: 246
Joined: 09 Sep 2013, 19:28

Re: Interruption on the code

Post by fferri » 12 Mar 2018, 15:56

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.

Post Reply