Go to Post This just in: moving sideways still a colossal waste of time. - TheOtherGuy [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 20-01-2012, 20:53
Cody Trey's Avatar
Cody Trey Cody Trey is offline
Programing = hard + fun
FRC #2582 (Panther Bots)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2009
Location: US
Posts: 31
Cody Trey is an unknown quantity at this point
Send a message via Yahoo to Cody Trey
Post Particle Analysis Report Problems

I am trying to use camera tracking to track the reflective tape, but I am having problems with the frcParticleAnalysis function. I'm not sure how to use it. my code is:


#include "WPILib.h"

/**
* This is a demo program showing the use of the RobotBase class.
* The SimpleRobot class is the 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.
*/
class RobotDemo : public SimpleRobot
{
RobotDrive myRobot; // robot drive system
Joystick stick; // only joystick
Jaguar jag1;
Jaguar jag2;
Solenoid Sol1 ;
Joystick stick2;
HSLImage image;
ParticleAnalysisReport par;
BinaryImage image2;



public:
RobotDemo(void):
myRobot(1, 3, 2, 10), // front left, rear left, front right, rear right
stick(1), //these must be initialized in the same order
jag1(7),
jag2(8),
Sol1(8),
stick2(2)


{
myRobot.SetExpiration(0.1);
}

/**
* Drive left & right motors for 2 seconds then stop
*/
void Autonomous(void)
{
myRobot.SetSafetyEnabled(false);
AxisCamera &camera = AxisCamera::GetInstance();
camera.WriteBrightness(0);
Wait(3.0);
myRobot.MecanumDrive_Cartesian(0.0, 0.0, 0.0, 0.0); // stop robot
while (!IsOperatorControl())
{
camera.GetImage();
frcParticleAnalysis(image2, 5, par); /*the error says "cannot convert 'BinaryImage' to 'Image*' for argument '1' to 'int frcParticleAnalysis (Image*, int, ParticleAnalysisReport*)'*/
}
}


/*
* Runs the motors with single stick holonomic steering.
* comment
*/
void OperatorControl(void)
{
while (IsOperatorControl())
{
myRobot.SetSafetyEnabled(true);
myRobot.MecanumDrive_Cartesian(stick.GetX(), stick.GetY(), stick.GetThrottle(), 0); // drive with arcade style (use right stick)
if(stick.GetTrigger())
jag2.SetSpeed(.8);
jag1.SetSpeed(.5);
Wait(.2);
Sol1.Set(true);
if(stick2.GetTrigger())
jag1.SetSpeed(.5);
else
Sol1.Set(false);
jag1.SetSpeed(0);
jag2.SetSpeed(0);
Wait(0.005); // wait for a motor update time
}
}


};

START_ROBOT_CLASS(RobotDemo);
__________________
Love, Peace, and Robot Grease
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 17:39.

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