Closed computer-whisperer closed 8 years ago
What's the use case here?
If at any time in your program you do this:
mymotor = wpilib.Talon(0)
mymotor.free()
After this, any attempts to enable LiveWindow will crash the DS thread, since it will try to run mymotor.set(0)
after mymotor has been freed
bump?
Sorry, sounds like (as usual) you have a good point here. I'm not really planning on working on RobotPy until ~Septemberish, but feel free to make a PR to fix this.
I imagine this probably affects WPILib itself too, yes?
Yes, i think it would affect upstream. When i fix it, do you think it would be important to try and push something to Java WPILib? Or should we wait to see what changes they plan on making for the 2016 season?
If you feel like pushing it upstream, I imagine that would be a good thing. You can either apply for an account on the WPILib collab.net site and submit a branch via gerrit, or you can do a pull request to our allwpilib repository and I can submit the branch for you.
There doesn't seem to be a mechanism for removing components from LiveWindow after they have been freed. I'm not quite sure how this should be handled.
One way would be to add a
removeComponent()
method to LiveWindow and have everyfree()
method call it. Another way (possibly a good idea to do in any case) would be to have LiveWindow catch and log exceptions that it receives from the device objects.@virtuald, @PeterJohnson what do you think?