View Single Post
  #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