Go to Post While in the Navy, we had an apparent leak in one of our systems and it took me 7 months to track it down. Just because you haven't found it, doesn't mean it doesn't exist. - TubaMorg [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 20-11-2015, 17:01
jgrindle's Avatar
jgrindle jgrindle is offline
Losing Sleep
AKA: John Grindle
FRC #5122 (RobOTies)
Team Role: Programmer
 
Join Date: Nov 2014
Rookie Year: 2015
Location: Old Town, ME
Posts: 34
jgrindle will become famous soon enough
Variables hanging?

Hey y'all,

If you search these forums frequently, you'll notice my last post was about a kiwi drive system. We are adding a Frisbee shooter to the top of it (for those that must know, it will be an inline shooter(using 6 inch wheels(direct driven by a CIM and a Mini-CIM))). I created speed selector for it using the D-Pad (code shown below)
Code:
void Shooter::SpeedChanger(int dir){
	switch(dir){
	case 0:
		if (change == false){
			if (sped < 2){
				sped = sped + 1;
				printf("Speed up \n");
				change = true;
			}
		}
		break;
	case 180:
		if(change == false){
			if(sped > 0){
				sped = sped - 1;
				printf("Speed Down \n");
				change = true;
			}
		}

		break;
	default:
		printf("Nothing\n");
		change = false;
		break;
	}
	printf("%d", sped);
	printf("\n");

}
If I get crazy with button pressing, or just wait a while, the code will just hang. The only way to get it out of this hanging state, is to disable it, then re-enable it. I have a video of it when working. When it hangs, it will only stay on the one variable, that it last was on. The code for driving on the other hand, will not hang.
__________________

FRC 2015 Season: Programmer, Electrical, PIDTuner, Safety Captain
FRC 2015 Off-Season: Programmer, CAD Designer, Driver, Drive Team Coach, Electrical, Mechanical, PIDTuner
Reply With Quote
  #2   Spotlight this post!  
Unread 21-11-2015, 08:59
jreneew2's Avatar
jreneew2 jreneew2 is offline
Alumni of Team 2053 Tigertronics
AKA: Drew Williams
FRC #2053 (TigerTronics)
Team Role: Programmer
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Vestal, NY
Posts: 195
jreneew2 has a spectacular aura aboutjreneew2 has a spectacular aura aboutjreneew2 has a spectacular aura about
Re: Variables hanging?

What might help is if you add printfs to every variable in the code segment and go through the logs. This helps track down the problem. If you could post them, other people would be able to help a lot more.
Reply With Quote
  #3   Spotlight this post!  
Unread 21-11-2015, 09:20
jgrindle's Avatar
jgrindle jgrindle is offline
Losing Sleep
AKA: John Grindle
FRC #5122 (RobOTies)
Team Role: Programmer
 
Join Date: Nov 2014
Rookie Year: 2015
Location: Old Town, ME
Posts: 34
jgrindle will become famous soon enough
Re: Variables hanging?

I can get an output of the riolog later, as I am currently at an FLL competition, there are printfs in the code.

John
__________________

FRC 2015 Season: Programmer, Electrical, PIDTuner, Safety Captain
FRC 2015 Off-Season: Programmer, CAD Designer, Driver, Drive Team Coach, Electrical, Mechanical, PIDTuner
Reply With Quote
  #4   Spotlight this post!  
Unread 21-11-2015, 09:22
jreneew2's Avatar
jreneew2 jreneew2 is offline
Alumni of Team 2053 Tigertronics
AKA: Drew Williams
FRC #2053 (TigerTronics)
Team Role: Programmer
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Vestal, NY
Posts: 195
jreneew2 has a spectacular aura aboutjreneew2 has a spectacular aura aboutjreneew2 has a spectacular aura about
Re: Variables hanging?

Alright. I'l look through them when you post them.
Reply With Quote
  #5   Spotlight this post!  
Unread 21-11-2015, 09:23
RufflesRidge RufflesRidge is offline
Registered User
no team
 
Join Date: Jan 2012
Location: USA
Posts: 989
RufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant future
Re: Variables hanging?

This sounds like an excellent time to use a debugger. Get it stuck, then stick a breakpoint at the top of your SpeedChanger method and step through, looking at the variable values. This is the best way to see why the code is not doing what you think it should.

http://wpilib.screenstepslive.com/s/...-robot-program
Reply With Quote
  #6   Spotlight this post!  
Unread 21-11-2015, 17:09
jgrindle's Avatar
jgrindle jgrindle is offline
Losing Sleep
AKA: John Grindle
FRC #5122 (RobOTies)
Team Role: Programmer
 
Join Date: Nov 2014
Rookie Year: 2015
Location: Old Town, ME
Posts: 34
jgrindle will become famous soon enough
Re: Variables hanging?

Jreneew2,
I cannot get to posting a riolog. Eclipse will crash if I try to enter the riolog, when it hangs. Everything but the Frisbee shooter will run when it hangs. I find it odd, I'll limit my code to only the one subsystem, and try to see if that will work.
__________________

FRC 2015 Season: Programmer, Electrical, PIDTuner, Safety Captain
FRC 2015 Off-Season: Programmer, CAD Designer, Driver, Drive Team Coach, Electrical, Mechanical, PIDTuner
Reply With Quote
  #7   Spotlight this post!  
Unread 21-11-2015, 17:52
jgrindle's Avatar
jgrindle jgrindle is offline
Losing Sleep
AKA: John Grindle
FRC #5122 (RobOTies)
Team Role: Programmer
 
Join Date: Nov 2014
Rookie Year: 2015
Location: Old Town, ME
Posts: 34
jgrindle will become famous soon enough
Re: Variables hanging?

Moving it to only the one method in the subsystems seemed to work. I couldn't do anything to get it to hang. I will try to implement everything else in a different way, but for now it seems to work.
__________________

FRC 2015 Season: Programmer, Electrical, PIDTuner, Safety Captain
FRC 2015 Off-Season: Programmer, CAD Designer, Driver, Drive Team Coach, Electrical, Mechanical, PIDTuner
Reply With Quote
Reply


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 14:04.

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