View Single Post
  #4   Spotlight this post!  
Unread 07-12-2009, 21:48
kevin51292 kevin51292 is offline
Registered User
FRC #2753
 
Join Date: Dec 2008
Rookie Year: 2006
Location: Hillsborough, NJ
Posts: 8
kevin51292 is an unknown quantity at this point
Re: Camera Error Number

Hey Guys!!

Thanks for the responses. I am actually using WindRiver this year. I found in the FRCError.h header file that my error number is an initialization error, but I'm still not really sure why I'm getting it. I copied my source code in the bottom of this post, so maybe that will help.

#include <iostream.h>
#include "math.h"

#include "AxisCamera.h"
#include "BaeUtilities.h"
#include "FrcError.h"
#include "TrackAPI.h"
#include "Target.h"
#include "WPILib.h"

#include "Gamepad.h"


int SleepingGrandma_debugFlag = 1;

/**
* This is a demo program showing the use of the color tracking API to track two colors.
* It uses the SimpleRobot class as a base of a robot application that will automatically call your
* Autonomous and OperatorControl methods at the right time as controlled by the switches on
* the driver station or the field controls. Autonomous mode tracks color assuming camera is
* mounted on a gimbal with two servos.
*/

class SleepingGrandma : public IterativeRobot
{
RobotDrive *myRobot; // robot drive system
Joystick *rightStick; // joystick 1 (arcade stick or right tank stick)
Joystick *leftStick; // joystick 2 (tank left stick)
DriverStation *ds; // driver station object
Servo *horizontalServo; // first servo object
Servo *verticalServo; // second servo object

public:
/**
* Constructor for this robot subclass.
* Create an instance of a RobotDrive with left and right motors plugged into PWM
* ports 1 and 2 on the first digital module. The two servos are PWM ports 3 and 4.
* Tested with camera settings White Balance: Flurorescent1, Brightness 40, Exposure Auto
*/


public:
/**
* Constructor for this robot subclass.
* Create an instance of a RobotDrive with left and right motors plugged into PWM
* ports 1 and 2 on the first digital module. The two servos are PWM ports 3 and 4.
* Tested with camera settings White Balance: Flurorescent1, Brightness 40, Exposure Auto
*/
SleepingGrandma(void)
{
ds = DriverStation::GetInstance();
myRobot = new RobotDrive(1, 2, 0.5); // robot will use PWM 1-2 for drive motors
rightStick = new Joystick(1); // create the joysticks
leftStick = new Joystick(2);
// remember to use jumpers on the sidecar for the Servo PWMs
SetDebugFlag ( DEBUG_SCREEN_ONLY ) ;


/* stop the watchdog if debugging */
GetWatchdog().SetExpiration(0.5);
GetWatchdog().SetEnabled(false);
}


void DisabledInit(void)
{
}

void DisabledPeriodic(void)
{
}

void DisabledContinuous(void)
{
}

void AutonomousInit(void)
{
}

void AutonomousPeriodic(void)
{
}

void AutonomousContinuous(void)
{
}

void TeleopInit(void)
{

}

void TeleopPeriodic(void)
{

}

void TeleopContinuous(void)
{
int val = StartCameraTask(10, 0, k160x120, ROT_0);
StartImageSignal(val);
StartImageAcquisition();
Image* myImage = frcCreateImage(IMAQ_IMAGE_RGB);
dprintf (LOG_INFO,"\n\n%i\n\n%i",GetImage(myImage,NULL));
dprintf(LOG_INFO,"\n\n%i",GetLastVisionError());

}
};

START_ROBOT_CLASS(SleepingGrandma);