Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   cRIO FRC_RobotTask error (http://www.chiefdelphi.com/forums/showthread.php?t=105128)

ss9090 27-03-2012 15:16

cRIO FRC_RobotTask error
 
Hey guys. I don't have much time before my competition and I just got this error from the NetConsole;

0x28bffe8 (FRC_RobotTask): task 0x28bffe8 has had a failure and has stopped.

A search brings up no hits. Does anybody have any idea about what causes this task error and what I can do to solve this?

Will post code if necessary.
Quick replies would be lovely.

EDIT:
Got rid of my Initial error by fixing up my pointers, however I now get a new error upon clicking 'Enable' on the driver station:

0x28c00e0 (FRC_RobotTask): task 0x28c00e0 has had a failure and has stopped.
0x28c00e0 (FRC_RobotTask): fatal kernel task-level exception!

Again, help is much appreciated.

Bharat Nain 27-03-2012 15:29

Re: cRIO FRC_RobotTask error
 
I saw an issue in Orlando where we were trying to gather input from the Analog Input on the DS Software. Sometimes, it returned a null and caused a null-pointer exception. I can't say if that is your issue but it is possible. Thanks to Andrew Schreiber for helping me track that bug down.

ss9090 27-03-2012 15:43

Re: cRIO FRC_RobotTask error
 
Thanks Bharat. I'm currently going through looking for a similar issue. Figured it must be a an improper pointer assignment, so I'm scouring through the lines hehe. Glad to know I'm on the right track.

bob.wolff68 27-03-2012 19:59

Re: cRIO FRC_RobotTask error
 
I agree - most likely the use of a null pointer. As a general rule of C/C++ programming, this is a MUST -- check all pointers before using them. **ALSO** if you 'delete' a pointer, set that pointer to NULL afterwards as well. The programming is a little more 'verbose', but it is SAFER. Crashing in a real-time robot is the PITS.

For instance: (Writing a sample that should be rather 'real' but is from memory so may come with issues...this is intended to show the use of pointer checking -- not syntax and running code)

Code:

ColorImage* pImage;
pImage = NULL;
AxisCamera& cam=AxisCamera::GetInstance();
BinaryImage* pBin;
pBin = NULL;

while(IsOperatorControl())
{
  if (cam.IsFreshImage())
  {
    pImage = cam.GetImage();
    if (pImage)
    {
      pBin = pImage->ThresholdHSL(x,y,z,zz,p,d,NULL);
      if (pBin)
      {
        // Do something using pBin like particle report ...
      }
      else
        printf("ERROR: ThresholdHSL() failed.\n");
    }
    else
      printf("ERROR: GetImage() failed.\n");

    // Done with the image -- must dispose of it.
    // But *SHOULD* also reset it to NULL so it doesn't get used accidentally.
    if (pImage)
    {
      delete pImage;
      pImage = NULL;
    }

    // Done with the image -- must dispose of it.
    // But *SHOULD* also reset it to NULL so it doesn't get used accidentally.
    if (pBin)
    {
      delete pBin;
      pBin = NULL;
    }
  }
}



All times are GMT -5. The time now is 17:36.

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