![]() |
Axis Camera in C++; code error??
Hi! Currently, I am trying to program the camera and the bot so that when it detects green, it aligns itself with the traget, but since i epicly phailed at that, I decided to do something simpler and just make the bot go forward when it detects green! I made this code *well, technically I used the guide and didnt really MAKE it* and i am getting 2 errors.... And i cant figure out whats wrong! help would be appreciated! THANKS!
So here are the headers I used: #include "WPILib.h" #include "AxisCamera.h" #include "Servo.h" #include "SimpleRobot.h" #include "SensorBase.h" #include "Error.h" #include "ErrorBase.h" #include "FrcError.h" This is the rest of the defining and stuff! class RobotDemo : public SimpleRobot { RobotDrive *Bot; // robot drive system Joystick *stickRight; Joystick *stickLeft; DriverStation *ds; // driver station public: RobotDemo(void) { if (StartCameraTask ()== -1) { printf( "Failed to spawn camera task; Error code %s", GetErrorText (GetLastError()) }; ds = DriverStation::GetInstance(); Bot = new RobotDrive(1, 2); // create robot drive base stickRight = new Joystick(1); stickLeft = new Joystick(2); Range greenHue, greenSat, greenLum; greenHue.minValue = 65; greenHue.maxValue = 80; greenSat.minValue =100; greenSat.maxValue = 255; greenLum.minValue = 100; greenLum.maxValue = 255; GetWatchdog().SetExpiration(100); } and here is the autonomous: void Autonomous(void) { GetWatchdog().SetEnabled(false); while(IsAutonomous()) { if( FindColor(IMAQ_HSL, &greenHue, &greenSat, &greenLum, &par) && par.particleToImagePercent < MAX_PARTICLE_TO_IMAGE_PERCENT && par.particleToImagePercent > MIN_PARTICLE_TO_IMAGE_PERCENT ) {Bot->Drive(1.0, (float)par.center_mass_x_normalized);} else Bot->Drive(0.0, 0.0); Wait(50); } Bot->Drive(0.0, 0.0); // stop robot } and the very end line of the code: START_ROBOT_CLASS(RobotDemo); I highlighted the lines where i get an error; basically on the get error one, they say the function was not defined.... and it also highlights the Start Robot Class thing as wrong. And is camera initiated/used right? Because in the guide, there are different things on different pages and I did not know what to use... Sorry for the lengthy question. |
Re: Axis Camera in C++; code error??
You're missing a closing round-bracket on the 1st line. You have a ')' for GetLastError, then a ')' for GetErrorText, but you're missing a ')' for printf. It should be
Code:
if (StartCameraTask ()== -1) |
Re: Axis Camera in C++; code error??
Change the lines
Code:
if (StartCameraTask ()== -1) {Code:
if (StartCameraTask() == -1)(P.S. Your #includes for servo.h, simplerobot.h, sensorbase.h, error.h and errorbase.h are extraneous, since they are included by wpilib.h) |
Re: Axis Camera in C++; code error??
THANK U!!!!!!!!!! :ahh:
and really?? :) I thought maybe the get error thing would be in one of them, but YAY! ty!!! |
| All times are GMT -5. The time now is 18:26. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi