|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Diagnosing a crash
My C++ code has been working perfectly except for the fact that every minute or so, the code will crash (robot code goes red but comms stay up) and then get restarted automatically. This whole process only results in 3 or so seconds of downtime, but it is pretty annoying. Is there a way to see what error the program is returning? It doesn't show up in the driver station, but could I SSH in and see it? Just a line number or stack trace would speed up the debugging process significantly. Thanks!
Also, I have some un-commented spaghetti code at the moment, which is why I'm not posting it here. Secondly, I tested out a blank program and it doesn't crash, so the error is in my code. Last edited by 1452-Leo : 14-02-2016 at 01:01. |
|
#2
|
|||
|
|||
|
Re: Diagnosing a crash
While this isn't answering your question exactly, I've noticed that when our code crashes, 99% of the time we are trying to access something that doesn't exist.
I assume your code is not crashing randomly; It's happening when something triggers it. Are you pressing certain buttons or doing camera tracking when it crashes? |
|
#3
|
|||
|
|||
|
Re: Diagnosing a crash
Quote:
|
|
#4
|
|||
|
|||
|
Re: Diagnosing a crash
When you say it crashes with zero input:
Does it crash moments after you go into teleop? Or a few minutes after enabling teleop and driving around? If the first situation: You have something being initialized that the code doesn't like. If the second, it's possible you may have a memory leak? But more likely if you're doing stuff with IMAQ, it is related to that. You aren't accidentally dividing by zero are you? I had that problem in 2012 when using the camera for tracking; Sometimes when it lost the target it would give something a value of 0 and try to divide with it. |
|
#5
|
|||
|
|||
|
Re: Diagnosing a crash
Quote:
Here is my IMAQ code in my TeleopPeriodic: Code:
IMAQdxGrab(session, frame, true, NULL);
if(imaqError != IMAQdxErrorSuccess) {
DriverStation::ReportError("IMAQdxGrab error: " + std::to_string((long)imaqError) + "\n");
} else {
if (reversed){
imaqFlip(frame,frame,FlipAxis_enum::IMAQ_VERTICAL_AXIS);
} else {
imaqFlip(frame,frame,FlipAxis_enum::IMAQ_CENTER_AXIS);
}
CameraServer::GetInstance()->SetImage(frame);
}
|
|
#6
|
|||
|
|||
|
Re: Diagnosing a crash
I can't tell off the top of my head, sorry. The way to tell for sure is to comment out that part, but leave the camera plugged in and just view the stream on the dashboard.
If it doesn't crash, then it's something in your IMAQ code. |
|
#7
|
|||
|
|||
|
Re: Diagnosing a crash
Here's a couple ideas for things to try.
1) Stop the robot code from starting up automatically and start it under GDB on the roboRIO. You'll then get good stack traces. 2) Enable core dumps. Once it crashes, copy the core dump back to your laptop and load it and the binary into GDB. You can then get a good stack trace. |
|
#8
|
|||
|
|||
|
Re: Diagnosing a crash
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|