MelbourneHighSchoolRobotics / ev3sim

A simulator for soccer robots programmed with ev3dev.
https://ev3sim.mhsrobotics.club
Other
11 stars 8 forks source link

Add support for debugging robots #264

Closed emilytrau closed 3 years ago

emilytrau commented 3 years ago

This adds support for debugging robots in VS Code. The debugger is automatically launched on port 15995. To use it just add this to .vscode/launch.json

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Python: Attach to EV3Sim",
      "type": "python",
      "request": "attach",
      "connect": {
        "host": "localhost",
        "port": 15995
      }
    }
  ]
}

There's also a new flag --no-debug to disable launching the debugger as it can potentially be exploited by a malicious bot. A possible enhancement could be to create launch.json automatically if it doesn't exist, but I'm not sure where to do that.

glipR commented 3 years ago

This is so cool! Breakpoints and watching values seems to work fine!