Go to Post OPR will not get you to Einstein - Paul Copioli [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 04-02-2007, 18:48
Mitch's Avatar
Mitch Mitch is offline
Registered User
FRC #1197 (TorBots)
Team Role: Programmer
 
Join Date: Feb 2006
Rookie Year: 2006
Location: Southern California
Posts: 7
Mitch is an unknown quantity at this point
Enabling Multiple Light Tracking Using Kevin's Code

I am attempting to enable multiple light tracking by inserting code into Kevin's. How should I do this? I have read the code over multiple times and I am aware at how it all works, but I am unsure where I should set the poll mode to 1 and also what I should do when I send the VirtualWindow commands. Do I wait for an ACK and new T-Data for each? (And after receiving, set the new VW, so on and so forth?)

Thank you
  #2   Spotlight this post!  
Unread 04-02-2007, 18:57
Mitch's Avatar
Mitch Mitch is offline
Registered User
FRC #1197 (TorBots)
Team Role: Programmer
 
Join Date: Feb 2006
Rookie Year: 2006
Location: Southern California
Posts: 7
Mitch is an unknown quantity at this point
Re: Enabling Multiple Light Tracking Using Kevin's Code

After thinking about this more... this is my plan, feedback would be appreciated. It is not implemented yet, I am currently in the process.

1. "extern" the camera_acks and ncks variables in camera.c so that they are global (so I can put all the multi-light tracking in another file). Also globalize the camera_initialized variable.

2. I create a function which is run every loop from main. This function will first check if the camera is initialized and if so, set the camera to poll mode (once).

3. Wait for a T-Packet

4. If the bounds received are too large, designating itself as a "blob" we now do what team 250 has said (split the window in two and retrack each side to receive two bounds)

5. Rinse and repeat.
  #3   Spotlight this post!  
Unread 04-02-2007, 19:47
JBotAlan's Avatar
JBotAlan JBotAlan is offline
Forever chasing the 'bot around
AKA: Jacob Rau
FRC #5263
Team Role: Mentor
 
Join Date: Sep 2004
Rookie Year: 2004
Location: Riverview, MI
Posts: 723
JBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond repute
Send a message via AIM to JBotAlan Send a message via Yahoo to JBotAlan
Re: Enabling Multiple Light Tracking Using Kevin's Code

It sounds like what you are planning will work. However, I'm not going to put the effort in. After looking at the field, I can't see many situations where you'd actually see two lights. And in my case, if I did, I'd make sure that the camera was in position on one of the lights for a moment, save that position (with some of my magic code...I'll probably explain later but not yet) and then move the camera on--continue the search pattern--and find the other light and save its position.

I don't see that many chances to see two lights at once, though.

JBot
__________________
Aren't signatures a bit outdated?
  #4   Spotlight this post!  
Unread 04-02-2007, 20:26
Mitch's Avatar
Mitch Mitch is offline
Registered User
FRC #1197 (TorBots)
Team Role: Programmer
 
Join Date: Feb 2006
Rookie Year: 2006
Location: Southern California
Posts: 7
Mitch is an unknown quantity at this point
Re: Enabling Multiple Light Tracking Using Kevin's Code

I was also wondering the usefulness of implementing multiple light tracking...but I thought I'd try it out since most other things are finished.

I am having a problem which is very strange... I am just going to go ahead and post the C here. This is the function to set the camera to poll mode. Just to test it, I'm actually setting it in STATE_TWO of the camera initialization since nothing is happening there. Is this okay? Furthermore, I am not receiving an ACK or NCK, leading me to believe the way I am setting PM to 1 is incorrrect.

Code:
void Set_Poll_Mode(void)
{
	Write_Camera_Serial_Port('P');
	Write_Camera_Serial_Port('M');
	Write_Camera_Serial_Port(' ');
	Write_Camera_Serial_Port('1');
	Write_Camera_Serial_Port('\r');
}
  #5   Spotlight this post!  
Unread 04-02-2007, 20:31
DanDon's Avatar
DanDon DanDon is offline
ohhh MY god
AKA: Dan Hoizner
FRC #0375 (The Robotic Plague)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Staten Island, NY
Posts: 1,432
DanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond repute
Send a message via ICQ to DanDon Send a message via AIM to DanDon Send a message via MSN to DanDon
Re: Enabling Multiple Light Tracking Using Kevin's Code

Quote:
void Set_Poll_Mode(void)
{
Write_Camera_Serial_Port('P');
Write_Camera_Serial_Port('M');
Write_Camera_Serial_Port(1);
Write_Camera_Serial_Port(1);
}
That should set the camera into poll mode if the camera was set into raw mode before this function call.
__________________
  #6   Spotlight this post!  
Unread 04-02-2007, 20:36
Mitch's Avatar
Mitch Mitch is offline
Registered User
FRC #1197 (TorBots)
Team Role: Programmer
 
Join Date: Feb 2006
Rookie Year: 2006
Location: Southern California
Posts: 7
Mitch is an unknown quantity at this point
Re: Enabling Multiple Light Tracking Using Kevin's Code

Quote:
Originally Posted by dhoizner View Post
That should set the camera into poll mode if the camera was set into raw mode before this function call.
Thank you, I'll try this. I thought every command needed to be ended with a carriage return? No?
  #7   Spotlight this post!  
Unread 04-02-2007, 23:44
JohnC's Avatar
JohnC JohnC is offline
my other name is nigel
FRC #0360 (360 Revolution)
Team Role: Programmer
 
Join Date: Mar 2005
Rookie Year: 2005
Location: user_routines.c
Posts: 100
JohnC is a jewel in the roughJohnC is a jewel in the roughJohnC is a jewel in the roughJohnC is a jewel in the rough
Send a message via AIM to JohnC
Re: Enabling Multiple Light Tracking Using Kevin's Code

Quote:
Originally Posted by Mitch View Post
Thank you, I'll try this. I thought every command needed to be ended with a carriage return? No?
From what I understand, no, not if the camera is in poll mode. You send at least 4 characters: two for the command, one for the number of arguments, and one for each argument. That's why there are 2 "1"s being sent. One of them is an argument count, and the other is the actual argument. In poll mode no carriage returns are sent.
__________________
What place are we at? ... TODAI!
  #8   Spotlight this post!  
Unread 05-02-2007, 06:17
JBotAlan's Avatar
JBotAlan JBotAlan is offline
Forever chasing the 'bot around
AKA: Jacob Rau
FRC #5263
Team Role: Mentor
 
Join Date: Sep 2004
Rookie Year: 2004
Location: Riverview, MI
Posts: 723
JBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond repute
Send a message via AIM to JBotAlan Send a message via Yahoo to JBotAlan
Re: Enabling Multiple Light Tracking Using Kevin's Code

Quote:
Originally Posted by Mitch View Post
Thank you, I'll try this. I thought every command needed to be ended with a carriage return? No?
Nope--Kevin's code by default sets the camera to "Raw mode"--see the command RM in the CMUcam manual. His code sends a "RM 5" command; 5 = 101; that means input and output are in raw bytes instead of the normal "XX 1 2 3\r" style. As you can see, "XX 1 2 3\r" is 9 bytes, "XX3123" is only 6. Raw mode is there to trim the fat out of the communications. Just a quote from the manual:

Quote:
If bit 2 is set, input will be read as raw byte values, too. In this mode, after the two command byte values are sent, send 1 byte telling how many arguments are to follow. (i.e. DF followed by the raw byte value 0 for no arguments) No \r character is required.
It's not explained very well, but basically, you send the two-byte command, a byte with the number of arguments, and each argument after that is sent as a single byte.

Good luck,
JBot

EDIT: John, it has nothing to do with when the camera is in poll mode, rather, if it is in raw mode, it will act as I described above. If it is in poll mode, TC (track color) sends 1 T packet, if not, it sends them repeatedly until interrupted by a \r.
__________________
Aren't signatures a bit outdated?
Closed Thread


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Light Tracking with Distinct Light Boxes MaHaGoN Programming 30 19-02-2007 10:46
Kevin's Code? winners Programming 5 27-01-2006 16:32
Question about kevin's code ImmortalAres Programming 3 23-06-2005 11:13
Team THRUST - Kevin's Code and Camera Code Combine Chris_Elston Programming 3 31-01-2005 22:28
Autonomous Code Enabling Gusman1188 Programming 1 12-02-2003 21:33


All times are GMT -5. The time now is 23:50.

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