Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Camera Declaration/Initialization (http://www.chiefdelphi.com/forums/showthread.php?t=83259)

scolbertrocks 21-02-2010 09:20

Camera Declaration/Initialization
 
I know there are lots of threads on the camera, but i havn't seen any on this topic specifically.
I'm just wondering how to declare/initalize the camera in an Iterative Robot based program.
Because (correct me if im wrong) you have to use AxisCamera &camera = AxisCamera::GetInstance(), the &camera is a reference, and MUST be initialized when it is declared.
If i put this line of code in the constructor, or TeleopInit, the reference can't be accessed in any other function.
If i put it in TeleopPeriodic, I will be able to access the camera reference where i need it, but it will be inneficiently called every loop

What is the best, or atleast a working way to get a working variable/reference of the camera that i can access in TeleopPeriodic for tracking?

scolbertrocks 21-02-2010 11:42

Re: Camera Declaration/Initialization
 
Has anybody gotten the camera feed and tracking to work in iterative robot?

mandrews281 22-02-2010 00:05

Re: Camera Declaration/Initialization
 
Yes. We resorted to a global variable so above our robot declaration we have:

AxisCamera &g_camera = AxisCamera::GetInstance();

class Robot281: public IterativeRobot {
etc.
};

byteit101 22-02-2010 07:26

Re: Camera Declaration/Initialization
 
put it in the class:
Code:

public yourrobot:public IterativeRobot
{
...
    AxisCamera &cam;
public:
    yourrobot():
...
      cam(AxisCamera::GetInstance())
      { }

....
};



All times are GMT -5. The time now is 13:05.

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