Go to Post Either way, FIRST works. You just have to keep the big picture in mind. - Lux [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 02-08-2012, 08:17 PM
Method's Avatar
Method Method is offline
Registered User
no team
 
Join Date: Jan 2012
Rookie Year: 2011
Location: Ca
Posts: 38
Method is an unknown quantity at this point
Camera bug

z:
sumtin 0.0000000

Hi! Im trying to get my camera working. Above is my output (should be num targets followed by fraction of distance of the first target to center)
I made this simple V of code to debug but no luck
help plz


#include "WPILib.h"
#include "nivision.h"
#include <stdlib.h>
#define IO (DriverStation::GetInstance()->GetEnhancedIO())
static AxisCamera &camera = AxisCamera::GetInstance("10.16.71.11");
//output from cameras to driverstation (so we can see it)
static ColorImage image(IMAQ_IMAGE_HSL);
//create an image to buffer pics
static DriverStationLCD* driverOut = DriverStationLCD::GetInstance();
BinaryImage* binImg;
class RobotDemo : public SimpleRobot
{
Joystick stick; // only joystick

public:
RobotDemo(void):
stick(1) // as they are declared above.
{
GetWatchdog().Kill();
binImg = image.ThresholdHSL(0, 250, 30, 200, 130, 270);
//HSL values (MUST BE FOUND BY EXPERIMENT)
camera.WriteMaxFPS(30);
//FPS
camera.WriteBrightness(30);
//
camera.WriteWhiteBalance(AxisCamera::kWhiteBalance _Hold);
//white balance -- set manually via internet connection w/hold
camera.WriteResolution(AxisCamera::kResolution_320 x240);
//resolution
camera.WriteColorLevel(100);
//low color
camera.WriteCompression(30);
//lower easier on CRIO and harder on cam
}
void Autonomous(void)
{
GetWatchdog().Kill();
}
void OperatorControl(void)
{
GetWatchdog().Kill();
while (IsOperatorControl())
{
camera.GetImage(&image);
vector<ParticleAnalysisReport>* particles = binImg->GetOrderedParticleAnalysisReports();
ParticleAnalysisReport& par = (*particles)[1];
driverOut->Clear();
if (stick.GetRawButton(1))
{
driverOut->PrintfLine(DriverStationLCD::kUser_Line1, "Z: %n", particles->size());//output num targets
driverOut->PrintfLine(DriverStationLCD::kUser_Line2, "sumtin %f", par.center_mass_y);
//output fraction of anle to target 1 in center of screen
}
driverOut->UpdateLCD();
}
}
};

START_ROBOT_CLASS(RobotDemo);
Reply With Quote
 


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 10:02 AM.

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