Skip to content

Commit

Permalink
Add way to remote debug with VS Code
Browse files Browse the repository at this point in the history
  • Loading branch information
auscompgeek committed Feb 11, 2019
1 parent 802c319 commit 87aef9b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@
"deploy"
]
},
{
"label": "deploy (debug mode)",
"type": "process",
"group": "build",
"command": "${config:python.pythonPath}",
"args": [
"robot.py",
"deploy",
"--debug",
"--nc"
]
},
{
"label": "test",
"type": "process",
Expand Down
9 changes: 9 additions & 0 deletions robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,5 +269,14 @@ def closest_field_angle(self, robot_heading):
return label


# Allow attaching the Visual Studio/VS Code debugger if ptvsd is installed.
# Deploy with --debug to use this on the roboRIO.
if __debug__:
try:
import ptvsd
ptvsd.enable_attach()
except Exception:
pass

if __name__ == "__main__":
wpilib.run(Robot)

0 comments on commit 87aef9b

Please sign in to comment.