robotpy / pyfrc

python3 library designed to make developing RobotPy-based code easier!
MIT License
50 stars 35 forks source link

Provide better error messages if a user reuses a HAL object #208

Closed virtuald closed 1 year ago

virtuald commented 1 year ago

On python 3.11 you get something like this:

>       self.drive.arcadeDrive(fwd, rot)
E       RuntimeError: HAL: A handle parameter was passed incorrectly: Channel 0
E       *** Do not reuse HAL objects in tests! This may occur if you stored a motor/sensor as a global or as a class variable outside of a method.

Not totally happy with the wording yet.

Inspired by @BerkeSinanYetkin's problem