Announcement

Collapse
No announcement yet.

What Exactly Happens when Stop button pressed

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • What Exactly Happens when Stop button pressed

    When the stop button is pressed on the RC, what exactly are the steps performed by the internal RC code? User iterative robot programs can have a stop() method and linear programs can check for a flag indicating of stop requested or if execution should not continue. Each of these constructs suggests the programmer should write some code to stop the program in a clean fashion but you don't have to. So the internal code is managing the stop function and apparently allows your code some time(?) to wind things up before it will do it for you. I'd like to know what exactly happens when the stop button is pressed and what role does the user written stop method or user code executing (linear) can do when it detects the opmode should stop executing.

  • #2
    When the stop button on the DS is pressed, it sends a command to the RC, which sets a flag. It also starts a watchdog. Your user code then has either 1 or 5 seconds (don't remember off the top of my head) to exit before the watchdog kills the entire app. For regular OpModes, stop() is called immediately after the last iteration of loop() before the flag was set. Also, for regular OpModes, each iteration of loop() is monitored by a watchdog, and if the iteration takes more than 5 seconds the entire app is killed also.

    Comment

    Working...
    X