Go to Post The Pet Rock was very original, but not necessarily a great thing. - IKE [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 09-04-2006, 00:30
kiettyyyy's Avatar
kiettyyyy kiettyyyy is offline
Registered User
FRC #1538 (The Holy Cows)
Team Role: Engineer
 
Join Date: Mar 2006
Rookie Year: 2005
Location: San Diego, CA
Posts: 181
kiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond repute
Send a message via AIM to kiettyyyy
Camera without servos

Hey all,

If I were to mount the camera without servos and just use the drive base to allign the camera to center.... what should i do?

I've been looking through the code and I saw that it was checking if the target pixels are within center of the camera view..

I just don't know what i should do to make the bot track without the servos.. please help

Thanks
__________________
-Kiet Chau

2004-2008 - Software Developer/Driver on Team #968
2008-2011 - Software Developer/Coach/Mentor/"Engineer" on Team #968
2011-Present - Mentor & Engineer on Team #1538
www.team1538.com
  #2   Spotlight this post!  
Unread 09-04-2006, 08:04
JJG13's Avatar
JJG13 JJG13 is offline
Yoda
AKA: Joshua Graffman
None #0180 (SPAM)
Team Role: Alumni
 
Join Date: Dec 2002
Rookie Year: 2003
Location: Martin County, Florida
Posts: 105
JJG13 has a spectacular aura aboutJJG13 has a spectacular aura aboutJJG13 has a spectacular aura about
Re: Camera without servos

First you need to find how far the camera is off from target using the same method you would when using the camera servos.

Relevent code:
Code:
pan_error = (int)T_Packet_Data.mx - PAN_TARGET_PIXEL_DEFAULT;
if the pan_error is less than zero you have to drive the robot\turret one way and if it is greater than zero, you have to drive the robot\turret the other way.
__________________
Behold the power of SPAM.
  #3   Spotlight this post!  
Unread 09-04-2006, 13:27
lemoneasy lemoneasy is offline
Registered User
AKA: Evan Crawford
FRC #1334
Team Role: Programmer
 
Join Date: Feb 2006
Rookie Year: 2004
Location: Oakville, Ontario
Posts: 21
lemoneasy is on a distinguished road
Re: Camera without servos

Do you also mean without a tilt servo? I think its simpler with servos, have the camera parallel to the side of your bot, and just turn until the pan angle on your camera is 0, or within 1 to -1 degrees. Otherwise, the pan error method would work. As for tilt you would have to decide how close you want your bot, if you have your camera tilted at 19-20 degrees, your bot will be centered at around 25 feet from the net. Just put the bot however close you want it to the net, point the camera's tilt at the light, fasten it tight. Then just use the pan error method with the tilt_error instead.
__________________
  #4   Spotlight this post!  
Unread 09-04-2006, 16:07
kiettyyyy's Avatar
kiettyyyy kiettyyyy is offline
Registered User
FRC #1538 (The Holy Cows)
Team Role: Engineer
 
Join Date: Mar 2006
Rookie Year: 2005
Location: San Diego, CA
Posts: 181
kiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond repute
Send a message via AIM to kiettyyyy
Re: Camera without servos

I actually mean without BOTH servos... our mentors dont want them because something could potentially happen :-/ who knows. Any way, im thinking now to run a little loop thats similar to a pid that just compares the error in certain directions, if its towards the right, move the left motor, if its toward the left, move the right motor... hopefully that would work..

Please put some suggestions

Thanks!
__________________
-Kiet Chau

2004-2008 - Software Developer/Driver on Team #968
2008-2011 - Software Developer/Coach/Mentor/"Engineer" on Team #968
2011-Present - Mentor & Engineer on Team #1538
www.team1538.com
  #5   Spotlight this post!  
Unread 09-04-2006, 16:41
kiettyyyy's Avatar
kiettyyyy kiettyyyy is offline
Registered User
FRC #1538 (The Holy Cows)
Team Role: Engineer
 
Join Date: Mar 2006
Rookie Year: 2005
Location: San Diego, CA
Posts: 181
kiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond repute
Send a message via AIM to kiettyyyy
Re: Camera without servos

Okay, I have something mocked up now.. How does this look??

if (swt_camera)
{
// If the image is not center, check with the allowable error range
if (pan_error > PAN_ALLOWABLE_ERROR_DEFAULT)
{
// Attempt to turn left
pwm_rightDrive_cim = pwm_rightDrive_cim = 200;
pwm_leftDrive_cim = pwm_leftDrive_fp = 120;
}
else if(pan_error < -1 * PAN_ALLOWABLE_ERROR_DEFAULT)
{
// Attempt to turn right
pwm_rightDrive_cim = pwm_rightDrive_cim = 120;
pwm_leftDrive_cim = pwm_leftDrive_fp = 200;
}
else
{
// Set drive motors to neutral
pwm_rightDrive_cim = pwm_rightDrive_cim = 127;
pwm_leftDrive_cim = pwm_leftDrive_fp = 127;

// Tell the controller that it is now on target
Tracking_State += STATE_PAN_ON_TARGET;
}
}


Should this work?
__________________
-Kiet Chau

2004-2008 - Software Developer/Driver on Team #968
2008-2011 - Software Developer/Coach/Mentor/"Engineer" on Team #968
2011-Present - Mentor & Engineer on Team #1538
www.team1538.com
  #6   Spotlight this post!  
Unread 09-04-2006, 16:55
kiettyyyy's Avatar
kiettyyyy kiettyyyy is offline
Registered User
FRC #1538 (The Holy Cows)
Team Role: Engineer
 
Join Date: Mar 2006
Rookie Year: 2005
Location: San Diego, CA
Posts: 181
kiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond repute
Send a message via AIM to kiettyyyy
Re: Camera without servos

Oops.. I just realized that we need to set what color to track with Track_color(????????).. What has your team been using for these values? And where should track_color go? Should it be where the switch is turned on? Or is this already pre set? *IM USING THE STREAMLINED VERSION *
__________________
-Kiet Chau

2004-2008 - Software Developer/Driver on Team #968
2008-2011 - Software Developer/Coach/Mentor/"Engineer" on Team #968
2011-Present - Mentor & Engineer on Team #1538
www.team1538.com

Last edited by kiettyyyy : 09-04-2006 at 17:05.
  #7   Spotlight this post!  
Unread 09-04-2006, 17:16
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: Camera without servos

Quote:
Originally Posted by kiettyyyy
Oops.. I just realized that we need to set what color to track with Track_color(????????).. What has your team been using for these values? And where should track_color go? Should it be where the switch is turned on? Or is this already pre set? *IM USING THE STREAMLINED VERSION *
All the tracking is done in tracking.c.

It should track out of the box.
And it would send the values to the pwm outs, you would just not have anything connected to those outs.
__________________
  #8   Spotlight this post!  
Unread 09-04-2006, 18:01
kiettyyyy's Avatar
kiettyyyy kiettyyyy is offline
Registered User
FRC #1538 (The Holy Cows)
Team Role: Engineer
 
Join Date: Mar 2006
Rookie Year: 2005
Location: San Diego, CA
Posts: 181
kiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond repute
Send a message via AIM to kiettyyyy
Re: Camera without servos

I just commented out the parts where it sent data to the pwm outs so that my code that I wrote earlier today -^ should have the camera control the bot instead of servos.. It sounds risky to me
__________________
-Kiet Chau

2004-2008 - Software Developer/Driver on Team #968
2008-2011 - Software Developer/Coach/Mentor/"Engineer" on Team #968
2011-Present - Mentor & Engineer on Team #1538
www.team1538.com
  #9   Spotlight this post!  
Unread 09-04-2006, 18:04
Matt Krass's Avatar
Matt Krass Matt Krass is offline
"Old" and Cranky. Get off my lawn!
AKA: Dark Ages
FRC #0263 (Sachem Aftershock)
Team Role: Mentor
 
Join Date: Oct 2002
Rookie Year: 2002
Location: Long Island, NY
Posts: 1,187
Matt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond repute
Send a message via AIM to Matt Krass
Re: Camera without servos

Quote:
Originally Posted by kiettyyyy
Okay, I have something mocked up now.. How does this look??

if (swt_camera)
{
// If the image is not center, check with the allowable error range
if (pan_error > PAN_ALLOWABLE_ERROR_DEFAULT)
{
// Attempt to turn left
pwm_rightDrive_cim = pwm_rightDrive_cim = 200;
pwm_leftDrive_cim = pwm_leftDrive_fp = 120;
}
else if(pan_error < -1 * PAN_ALLOWABLE_ERROR_DEFAULT)
{
// Attempt to turn right
pwm_rightDrive_cim = pwm_rightDrive_cim = 120;
pwm_leftDrive_cim = pwm_leftDrive_fp = 200;
}
else
{
// Set drive motors to neutral
pwm_rightDrive_cim = pwm_rightDrive_cim = 127;
pwm_leftDrive_cim = pwm_leftDrive_fp = 127;

// Tell the controller that it is now on target
Tracking_State += STATE_PAN_ON_TARGET;
}
}


Should this work?
It's going to be a bumpy ride. Chances are your robot isn't going to stop dead right on target, it will glide, spin back quickly, glide...overshooting back and forth. A basic P loop would help, but that would always introduce a steady state error.

P = error * gain;

Error is the pan_error, gain is the factor at which the motor responds, the higher, the more the motor responds. The problem is as you get close, the error decreases, meaning motor output decreases. Eventually the power level will get low enough that you stop moving. This is called "Steady state error" you can only get so close before the power output is insufficient to move. You can turn up the gain, but that will very likely make it oscillate again. You should look in to PID control, or even PI, if you search around here and on google I'll bet you can find some nice references. Also, if by experimenting you determine you need a minimum PWM value of Z to keep moving, you can do a check that if the error is past the deadband and the PWM is below Z, set it to Z, that's a crude PI, with a fixed I output. That should work but it won't be as precise as PI. Does this reply make any sense?
__________________
Matt Krass
If I suggest something to try and fix a problem, and you don't understand what I mean, please PM me!

I'm a FIRST relic of sorts, I remember when we used PBASIC and we got CH Flightsticks in the KoP. In my day we didn't have motorized carts, we pushed our robots uphill, both ways! (Houston 2003!)
  #10   Spotlight this post!  
Unread 09-04-2006, 18:14
kiettyyyy's Avatar
kiettyyyy kiettyyyy is offline
Registered User
FRC #1538 (The Holy Cows)
Team Role: Engineer
 
Join Date: Mar 2006
Rookie Year: 2005
Location: San Diego, CA
Posts: 181
kiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond repute
Send a message via AIM to kiettyyyy
Re: Camera without servos

I kind of understand it, but how would i impelement it into the code?
__________________
-Kiet Chau

2004-2008 - Software Developer/Driver on Team #968
2008-2011 - Software Developer/Coach/Mentor/"Engineer" on Team #968
2011-Present - Mentor & Engineer on Team #1538
www.team1538.com
  #11   Spotlight this post!  
Unread 09-04-2006, 18:48
Bharat Nain's Avatar
Bharat Nain Bharat Nain is offline
Registered User
no team
Team Role: Alumni
 
Join Date: Jan 2004
Rookie Year: 2003
Location: New York
Posts: 2,000
Bharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond repute
Send a message via AIM to Bharat Nain Send a message via MSN to Bharat Nain
Re: Camera without servos

Quote:
Originally Posted by kiettyyyy
I kind of understand it, but how would i impelement it into the code?
Look at Kevin Watson's navigation code from 2005. http://www.kevin.org/frc/2005/

Although that is probably too complex for your use, it should give you a good idea of how PID loops work and how you can make yours. Good luck and feel free to ask more questions.
__________________
-= Bharat Nain =-

Whatever you do, you need courage. Whatever course you decide upon, there is always someone to tell you that you are wrong. There are always difficulties arising that tempt you to believe your critics are right. To map out a course of action and follow it to an end requires some of the same courage that a soldier needs. Peace has its victories, but it takes brave men and women to win them. - Ralph Waldo Emerson
  #12   Spotlight this post!  
Unread 09-04-2006, 19:31
kiettyyyy's Avatar
kiettyyyy kiettyyyy is offline
Registered User
FRC #1538 (The Holy Cows)
Team Role: Engineer
 
Join Date: Mar 2006
Rookie Year: 2005
Location: San Diego, CA
Posts: 181
kiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond repute
Send a message via AIM to kiettyyyy
Re: Camera without servos

:-/ I don't really understand the pid code.. It seems a tad bit complex I think i might have to hope the bot doesnt over shoot, or i can just move the values by a little bit or make a different if and then loop that compares the values of the pan error and the allowable error that just changes the values of the motors instead of being high speed or low speed..
__________________
-Kiet Chau

2004-2008 - Software Developer/Driver on Team #968
2008-2011 - Software Developer/Coach/Mentor/"Engineer" on Team #968
2011-Present - Mentor & Engineer on Team #1538
www.team1538.com

Last edited by kiettyyyy : 09-04-2006 at 20:01.
  #13   Spotlight this post!  
Unread 09-04-2006, 20:08
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: Camera without servos

During user mode, you can just pulse the button that alligns the robot, and have a feedback that shows whether the bot is within the allowable deadband....and thus lessening the overshoot.
__________________
  #14   Spotlight this post!  
Unread 09-04-2006, 20:26
kiettyyyy's Avatar
kiettyyyy kiettyyyy is offline
Registered User
FRC #1538 (The Holy Cows)
Team Role: Engineer
 
Join Date: Mar 2006
Rookie Year: 2005
Location: San Diego, CA
Posts: 181
kiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond repute
Send a message via AIM to kiettyyyy
Re: Camera without servos

So you mean something like this?

Code:
if (swt_camera)
{
	if (pan_error < 5 | pan_error > -5)
	{
		// Set drive motors to neutral
		pwm_rightDrive_cim = pwm_rightDrive_cim = 127;
		pwm_leftDrive_cim = pwm_leftDrive_fp = 127;

		// Tell the controller that it is now on target 
		Tracking_State += STATE_PAN_ON_TARGET;
	}
	else
	{
		// If the image is not center, check with the allowable error range
		if (pan_error > PAN_ALLOWABLE_ERROR_DEFAULT)
		{
			// Attempt to turn left
			pwm_rightDrive_cim = pwm_rightDrive_cim = 200;
			pwm_leftDrive_cim = pwm_leftDrive_fp = 120;
		}
		else if(pan_error < -1 * PAN_ALLOWABLE_ERROR_DEFAULT)
		{
			// Attempt to turn right
			pwm_rightDrive_cim = pwm_rightDrive_cim = 120;
			pwm_leftDrive_cim = pwm_leftDrive_fp = 200;
		}
		else
		{
			// Set drive motors to neutral
			pwm_rightDrive_cim = pwm_rightDrive_cim = 127;
			pwm_leftDrive_cim = pwm_leftDrive_fp = 127;

			// Tell the controller that it is now on target 
			Tracking_State += STATE_PAN_ON_TARGET;
		}
	}
}
Sorry I can't really format it inside this little form :-/

Thanks for the help!
__________________
-Kiet Chau

2004-2008 - Software Developer/Driver on Team #968
2008-2011 - Software Developer/Coach/Mentor/"Engineer" on Team #968
2011-Present - Mentor & Engineer on Team #1538
www.team1538.com

Last edited by kiettyyyy : 09-04-2006 at 21:01.
  #15   Spotlight this post!  
Unread 09-04-2006, 20:59
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,559
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Camera without servos

Quote:
Originally Posted by kiettyyyy
Sorry I can't really format it inside this little form :-/
You can use the [code ] vbcode tag to keep your formatting.
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
Camera shows no love to drive motors anifinder Programming 4 13-02-2006 10:31
How To Use the Google Camera generalbrando Kit & Additional Hardware 2 07-02-2006 16:00
Servos controlling camera and purple screen ryan_f Programming 6 17-01-2006 23:21
servos and the camera incognito_NICK Programming 5 09-02-2005 00:00
Servos for the camera MV_Hirsch Programming 4 24-01-2005 16:35


All times are GMT -5. The time now is 10:35.

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