|
Re: Winpdb Remote Debugger ported to RobotPy
Quote:
Originally Posted by blakeelias
Speaking of debugging, have you found a way to compile and check your scripts *before* running on the robot?
In Java NetBeans would compile our code locally and show where we had syntax errors or improper API calls, but with Python we don't find this out until runtime. This makes it hard to work on code when there is no robot access, since someone's usually working on it mechanically.
So far I can check syntax with:
python3.1 -c "import py_compile; py_compile.compile('robot.py')"
However that does not seem to catch many of the problems we'll run into, like misspelling function names and other common errors.
Any ideas?
|
Indeed that's the downside of using a dynamic language.. static analysis is pretty much impossible (look up the halting problem). The long term solution will be a robot simulator (written in Python?) that provides an emulated Python wpilib so you can test your code offline. I've started looking at this but it's a pretty large project (the simulator is hard enough but there's also a LOT of wpilib classes to write emulated versions of).
__________________
Author of cscore - WPILib CameraServer for 2017+
Author of ntcore - WPILib NetworkTables for 2016+
Creator of RobotPy - Python for FRC
2010 FRC World Champions ( 294, 67, 177)
2007 FTC World Champions (30, 74, 23)
2001 FRC National Champions (71, 294, 125, 365, 279)
|