View Single Post
  #5   Spotlight this post!  
Unread 13-02-2007, 10:28
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,186
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: I'm having trouble with this camera stuff

Quote:
Originally Posted by Ianuser View Post
Will Camera_Idle() stop the Camera from functioning so the robot will no longer track the light? It does, right? Cuz it stops the initialization of it. So, doesn't Restart_Camera() do the opposite of Camera_Idle()? If not, please tell me if there's a way in which I can do this? Maybe I'm mapping the button incorrectly, but its not working, I know that.

p.s. The camera works fine (sorta, thats another story though), it just doesn't stop searching when I press the button. I want it to stop searching when I press the button.
When the camera has a green color blob in its view, it sends T packets over the serial port to the RC.

Servo_track() looks to see if there are new t packets in the input buffer. If there are, the RC knows that the camera sees a color blob and locks on to it. If there are no new t packets, the camera will go into its search routine (as it does not see any color blobs..)

Camera_Idle() writes a "\r" to the camera serial port. This tells the camera to stop what its doing, and to stop sending t packets.

Restart_camera() simply sets an initialization flag to 0, so when the Initialize_Camera() function is called, it will return all of the internal workings of the camera back to their default (this is probably for users who want to mess around with polling mode, virtual windows, gains, etc..)

The problem you are having is you are Initializing the camera (default in user_routines.c from the camera workspace), stopping the camera from sending t packets, and then clearing the init flag. You are never telling the camera to turn back on. You can do this in one of two ways.
A) Call Initialize_Camera() again.
B) Call Track_Color() with the default stuff as arguments.
I would do the latter as re-initializing the camera will cause it to go through a bunch of code that isnt going to do anything. Also, you don't need to call Reset_Camera() ever.