![]() |
Can't get current from PDP, crashes.
Hey guys, I'm experiencing a lil bit of trouble with the PDP's CAN stuff.
I'm trying to make our compressor disable once we're drawing a certain amount of amperage, just cause that current allowance could be better used. For some reason, calling the PDP's getTotalCurrent method is causing our robot to crash with a "CTRE CAN Recieve Timeout" Here's the code and full error: Code:
from wpilib import Compressor, PowerDistributionPanelCode:
ERROR Unhandled exception: |
Re: Can't get current from PDP, crashes.
HAL means hardware abstraction layer. In my experience, if you see this there is probably a probably a mechanical/electrical issue. Not a problem with the code. Do you see the compressor as a node on the RoboRIO's web interface?
|
Re: Can't get current from PDP, crashes.
Quote:
|
Re: Can't get current from PDP, crashes.
EDIT : oops left editor open for too long....
That error occurs when you are trying to get signals from a CAN device you haven't received updates from. If possible you should catch that exception so it doesn't crash your app. Not sure how to do that in Py tho. Maybe someone else can recommend? Is the PDP device ID the correct value, specified under "PDP CAN ID". http://wpilib.screenstepslive.com/s/...ribution-panel Does the PDP show up in the web-based config? http://wpilib.screenstepslive.com/s/...ribution-panel |
Re: Can't get current from PDP, crashes.
Under Java (and probably C++), there's a distinction in the HAL between errors and warnings. In this case, this is a warning, and the Java WPILib would generally just log a warning instead of throwing an exception. Though, in reality, the Java implementation ignores all errors and warnings from the HAL about the PDP, possibly for this exact reason:
Code:
/**Code:
HALUtil.checkStatus(status.asIntBuffer());This may be a bug in the python implementation: it likely should log these as warnings, or ignore them altogether. We ran into the same problem in Java with our custom wrappers (that would log warnings properly, even for PDP accesses) - randomly, the PDP would have chunks of time where it reported this warning on every access. Most of the time, it would work just fine. An example of this from our logs: (the time at the left is in milliseconds from startup) Code:
[238266 WARNING] (Common.java:68) HAL Warning: CTRE CAN Recieve Timeout[1] in ccre.igneous.direct.DirectPDP.getCurrent(DirectPDP.java:42) |
Re: Can't get current from PDP, crashes.
This does appear to be a RobotPy HAL bug, as Colby points out. I've filed a bug to track this at https://github.com/robotpy/robotpy-wpilib/issues/143.
Aero, if you could subscribe to that bug, I'll be pushing a possible fix for it in a few minutes. I won't be able to test it -- but presumably you can :) |
Re: Can't get current from PDP, crashes.
Quote:
It works pretty well, because we can run the same WPILib code for simulation/testing and on the real robot, unlike how the simulation stuff is implemented for Java. Hopefully they'll use our model next year. :) |
Re: Can't get current from PDP, crashes.
Fix posted at https://github.com/robotpy/robotpy-wpilib/pull/144, Aero please try it out and leave a comment to let me know if it works for you.
|
Re: Can't get current from PDP, crashes.
RobotPy 2015.0.14 has been released and should address this issue.
|
| All times are GMT -5. The time now is 01:43. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi