Go to Post Values aren't really dictated, they are created by everyone involved. - Herodotus [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 14-02-2016, 00:55
1452-Leo 1452-Leo is offline
Registered User
FRC #1452 (Omnicats)
Team Role: Alumni
 
Join Date: Dec 2014
Rookie Year: 2014
Location: Los Angeles
Posts: 44
1452-Leo is an unknown quantity at this point
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   Spotlight this post!  
Unread 14-02-2016, 00:59
nighterfighter nighterfighter is offline
1771 Alum, 1771 Mentor
AKA: Matt B
FRC #1771 (1771)
Team Role: Mentor
 
Join Date: Sep 2009
Rookie Year: 2007
Location: Suwanee/Kennesaw, GA
Posts: 835
nighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant future
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?
__________________
1771- Programmer, Captain, Drive Team (2009-2012)
4509- Mentor (2013-2015)
1771- Mentor (2015)
  #3   Spotlight this post!  
Unread 14-02-2016, 01:06
1452-Leo 1452-Leo is offline
Registered User
FRC #1452 (Omnicats)
Team Role: Alumni
 
Join Date: Dec 2014
Rookie Year: 2014
Location: Los Angeles
Posts: 44
1452-Leo is an unknown quantity at this point
Re: Diagnosing a crash

Quote:
Originally Posted by nighterfighter View Post
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?
The code crashes with zero input. However, this is our first time using a USB camera with Imaq. I'll have to comment it all out and test it next practice. Thanks!
  #4   Spotlight this post!  
Unread 14-02-2016, 01:10
nighterfighter nighterfighter is offline
1771 Alum, 1771 Mentor
AKA: Matt B
FRC #1771 (1771)
Team Role: Mentor
 
Join Date: Sep 2009
Rookie Year: 2007
Location: Suwanee/Kennesaw, GA
Posts: 835
nighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant future
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.
__________________
1771- Programmer, Captain, Drive Team (2009-2012)
4509- Mentor (2013-2015)
1771- Mentor (2015)
  #5   Spotlight this post!  
Unread 14-02-2016, 01:17
1452-Leo 1452-Leo is offline
Registered User
FRC #1452 (Omnicats)
Team Role: Alumni
 
Join Date: Dec 2014
Rookie Year: 2014
Location: Los Angeles
Posts: 44
1452-Leo is an unknown quantity at this point
Re: Diagnosing a crash

Quote:
Originally Posted by nighterfighter View Post
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.
It crashes 30 seconds to a minute after enabling teleop, regardless of movement/action. I was thinking it could be a memory leak earlier today, but the Roborio's free RAM as shown on the Driver Station stayed constant at around 115 mb throughout the testing.

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);
}
As you can see, I am only using IMAQ to mirror the image stream on command, not do any processing with it. Would this cause any issues? Thanks again!
  #6   Spotlight this post!  
Unread 14-02-2016, 01:20
nighterfighter nighterfighter is offline
1771 Alum, 1771 Mentor
AKA: Matt B
FRC #1771 (1771)
Team Role: Mentor
 
Join Date: Sep 2009
Rookie Year: 2007
Location: Suwanee/Kennesaw, GA
Posts: 835
nighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant future
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.
__________________
1771- Programmer, Captain, Drive Team (2009-2012)
4509- Mentor (2013-2015)
1771- Mentor (2015)
  #7   Spotlight this post!  
Unread 14-02-2016, 04:45
AustinSchuh AustinSchuh is offline
Registered User
FRC #0971 (Spartan Robotics) #254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Feb 2005
Rookie Year: 1999
Location: Los Altos, CA
Posts: 803
AustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond repute
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   Spotlight this post!  
Unread 14-02-2016, 15:43
1452-Leo 1452-Leo is offline
Registered User
FRC #1452 (Omnicats)
Team Role: Alumni
 
Join Date: Dec 2014
Rookie Year: 2014
Location: Los Angeles
Posts: 44
1452-Leo is an unknown quantity at this point
Re: Diagnosing a crash

Quote:
Originally Posted by AustinSchuh View Post
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.
Could you explain how to do either of these? Thanks!
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 01:32.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi