Go to Post They have obviously figuered out something special. I want to learn from them. - dlavery [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 19-02-2011, 22:35
CodeMonkeyMatt CodeMonkeyMatt is offline
Registered User
FRC #2605
 
Join Date: Jan 2011
Rookie Year: 2008
Location: WA
Posts: 46
CodeMonkeyMatt is on a distinguished road
Enabling PIDController Crashes Windriver

I'm attempting to use a PIDController for positioning the robot. I created a PIDSource class based on the camera, and a PIDOutput that goes to all four drive motors. All this is created in the robot constructor without a hitch (that I can see at least). I'm using CANJaguars and the IterativeRobot template.

The problem comes when I attempt to enable the PIDController in the AutonomousInit function. At that line, the program crashes and when Windriver attaches the debugger, it goes into the assembly code. I've followed it to the "strafeController.Enable();" line though, so I'm sure it's that. It's our first year of PID, so I'm still a little lost.

Code:
45         ShsAlignCam *alignCam;  
46         ShsStrafePID *strafer;  
47         PIDController *strafeController;  
...
 BuiltinDefaultCode(void):  
96         camera(AxisCamera::GetInstance())  
97         {  
...
157                 alignCam = new ShsAlignCam();  
158                 strafer = new ShsStrafePID(leftFront, rightFront, leftBack, rightBack);  
159                 strafeController = new PIDController(1, 0.001, 0.0, alignCam, strafer);  
...
183         }  
...
 void AutonomousInit(void) {  
...
227                 strafeController->SetSetpoint(0);  
228                 strafeController->Enable();  
...    
237         }
Any ideas? Happy to answer questions if you have them.

Edit: Just realized what I typed in as the title. It crashes my program, not windriver. Windriver tells me that it crashed. I'm tired.

Another Edit: I'm going to call it a night due to the English paper due Monday hanging over my head. Here's hoping that someone sees this by tomorrow and can help.

Last edited by CodeMonkeyMatt : 19-02-2011 at 22:50.
Reply With Quote
  #2   Spotlight this post!  
Unread 20-02-2011, 18:26
CodeMonkeyMatt CodeMonkeyMatt is offline
Registered User
FRC #2605
 
Join Date: Jan 2011
Rookie Year: 2008
Location: WA
Posts: 46
CodeMonkeyMatt is on a distinguished road
Re: Enabling PIDController Crashes Windriver

With the help from one of my mentors (who I was having trouble reaching last night), I figured out the problem. The camera PIDSource was probably taking to long to calculate it, so I extended the time on the PIDController and hashed down the PIDGet() function to just return the value (had some debugging things in there like writing the color image and the binary image... woops).
Reply With Quote
  #3   Spotlight this post!  
Unread 20-02-2011, 19:12
garyk garyk is offline
Programming Mentor: 668, 972, 2643
FRC #0668 (Apes of Wrath)
Team Role: Mentor
 
Join Date: Dec 2006
Rookie Year: 2005
Location: Santa Clara (Silicon Valley) Calif.
Posts: 93
garyk is a jewel in the roughgaryk is a jewel in the roughgaryk is a jewel in the roughgaryk is a jewel in the rough
Re: Enabling PIDController Crashes Windriver

Quote:
Originally Posted by CodeMonkeyMatt View Post
With the help from one of my mentors (who I was having trouble reaching last night), I figured out the problem. The camera PIDSource was probably taking to long to calculate it, so I extended the time on the PIDController and hashed down the PIDGet() function to just return the value (had some debugging things in there like writing the color image and the binary image... woops).
THANK YOU for posting the fix rather than saying nothing. It's a great example of GP.
__________________

Silicon Valley Regional 2005, 2006 972
Silicon Valley Regional 2007 668 Xerox Creativity Award
Championship Event 2007 668
Portland Regional 2008 668
Silicon Valley Regional 2008 668, 972
Beta Test Team 2008 668 (with 100 & 254)
Silicon Valley Regional 2009 668 Regional Chairman's Award; 2643
Sacramento Regional 2009 668 Winning Alliance (thanks, 1717 & 2473!), 2010 Winning Alliance 3256
CalGames 2006, 2007, 2008, 2009, 2010, 2011 Field Tech
NorCal FTC Regional 2008, 2009 Inspector
Championship Event 2009
San Diego, Silicon Valley Regionals; Champ. Event 2010 668, 2643, 3256
Silicon Valley, Madera Regional 2012 2643
WRRF Programming Instructor 2006-2016
Regional Woodie Flowers Award 2014 2643 Utah Regional

Reply With Quote
  #4   Spotlight this post!  
Unread 20-02-2011, 19:21
CodeMonkeyMatt CodeMonkeyMatt is offline
Registered User
FRC #2605
 
Join Date: Jan 2011
Rookie Year: 2008
Location: WA
Posts: 46
CodeMonkeyMatt is on a distinguished road
Re: Enabling PIDController Crashes Windriver

No problem. Chief Delphi's my main source of troubleshooting help (still left over from when we didn't have any mentors who knew a thing about programming), and it always bugs me when I run into a thread that described my problem exactly, but never had a solution. Hopefully I'll help some other people out and maybe they'll post solutions to their own problems later. The programmers' version of the Liberty Mutual commercial.
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 15:05.

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