|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
||||
|
||||
|
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?
|
|
#2
|
|||
|
|||
|
Re: Can't get current from PDP, crashes.
Yeah, should have mentioned; I can see the PDP fine in the RoboRIO's web interface. It has CAN ID 0, and it passes the self-test fine. It's weird, because the HAL is throwing the error, it's nowhere in RobotPy's WPIlib implementation.
|
|
#3
|
||||
|
||||
|
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 |
|
#4
|
|||
|
|||
|
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:
/**
* Query the current of a single channel of the PDP
* @return The current of one of the PDP channels (channels 0-15) in Amperes
*/
public double getCurrent(int channel) {
ByteBuffer status = ByteBuffer.allocateDirect(4);
status.order(ByteOrder.LITTLE_ENDIAN);
double current = PDPJNI.getPDPChannelCurrent((byte)channel, status.asIntBuffer());
checkPDPChannel(channel);
return current;
}
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) [238283 WARNING] (Common.java:68) HAL Warning: CTRE CAN Recieve Timeout[1] in ccre.igneous.direct.DirectPDP.getCurrent(DirectPDP.java:42) [238285 WARNING] (Common.java:68) HAL Warning: CTRE CAN Recieve Timeout[1] in ccre.igneous.direct.DirectPDP.getCurrent(DirectPDP.java:42) [238289 WARNING] (Common.java:68) HAL Warning: CTRE CAN Recieve Timeout[1] in ccre.igneous.direct.DirectPDP.getCurrent(DirectPDP.java:42) [238304 WARNING] (Common.java:68) HAL Warning: CTRE CAN Recieve Timeout[1] in ccre.igneous.direct.DirectPDP.getCurrent(DirectPDP.java:42) [238306 WARNING] (Common.java:68) HAL Warning: CTRE CAN Recieve Timeout[1] in ccre.igneous.direct.DirectPDP.getCurrent(DirectPDP.java:42) [238311 WARNING] (Common.java:68) HAL Warning: CTRE CAN Recieve Timeout[1] in ccre.igneous.direct.DirectPDP.getCurrent(DirectPDP.java:42) Last edited by Cel Skeggs : 25-02-2015 at 10:39. |
|
#5
|
||||
|
||||
|
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 ![]() |
|
#6
|
||||
|
||||
|
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. ![]() |
|
#7
|
||||
|
||||
|
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.
|
|
#8
|
||||
|
||||
|
Re: Can't get current from PDP, crashes.
RobotPy 2015.0.14 has been released and should address this issue.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|