Log in

View Full Version : Purpose of "boot_initialization_flag" in 'camera.c'


bear24rw
04-03-2006, 22:56
I was wondering what the purpose is of boot_initialization_flag in camera.c is?

It seems like if take the flag out it would solve my problem of the camera not working after a robot reset, and having to turn to whole robot off before the camera works again...


// stuff to do after the camera goes through a power-on reset
if(boot_initialization_flag == 1)
{
// get the camera's attention
Camera_Idle();
// set the command & packet transfer mode
Raw_Mode(5);
// don't execute this code again until the next power on reset
boot_initialization_flag = 0;
}


Whats the point of that flag?

devicenull
04-03-2006, 23:14
So the code doesn't try to initalize the camera over and over.

That variable gets reset when you power cycle the robot controller anyway.

One thing I have noticed, is that if the serial wire is loose, the camera acts very, very funny (Not picking up the reset commnads from the RC, for one).. If you are having that many problems, why not modify the code so it sends a couple of \n's to the camera before it tries to initalize it? It may be the camera has part of a command stuck in its buffer for some reason.

bear24rw
04-03-2006, 23:32
So the code doesn't try to initalize the camera over and over.


Isn't the point of calling Initialize_Camera() to reinitialize it?

That variable gets reset when you power cycle the robot controller anyway.

That's what i find weird...
Since i dont have a robot now, i cant printf it out to see if it gets reset or not

devicenull
04-03-2006, 23:47
If you go through the logic in that function, you find that Raw_Mode(5) is the only thing that is not actually preformed again.. However, that function is something that should only need to be called once. All it does is set up the serial communication with the camera.

Here's the thing: Pressing the robot reset button on the OI is different then pressing it on the actual RC. On the RC, it actually kills power to it. On the OI, I believe it just resets the User Processor. If you have problems with the camera, it's probably better to use the one on the robot. Most of the problems we have seem to start on the camera, rather then the RC. (Camera always thinks it's locked on)

So, I don't think that function would need to be called again to preform a soft-reset of the camera.