Go to Post If the GDC doesn't want better teams to strap components on to other robots, they should design a game that doesn't require better teams to strap components on to other robots to win. - Tom Bottiglieri [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 08-02-2007, 16:27
team 888's Avatar
team 888 team 888 is offline
Registered User
FRC #0888
 
Join Date: Jan 2007
Location: Maryland
Posts: 7
team 888 is an unknown quantity at this point
OI potentiometer for controlling turret

We want to put a potentiometer on our control board for controlling our turret. I think i know how to program it if we were to put another potentiometer on the actual robot but there's no room and i don't want to mess around with the gear tooth sensor. Is there anyway to rotate the potentiometer and based on how many degrees it rotated turn the motor for the turret on for a certain amount of time???
  #2   Spotlight this post!  
Unread 08-02-2007, 16:53
CrashOverride's Avatar
CrashOverride CrashOverride is offline
Registered User
FRC #1831
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Gilford, NH
Posts: 16
CrashOverride is an unknown quantity at this point
Re: OI potentiometer for controlling turret

Yes it can easily be done.
Goto http://www.ifirobotics.com/docs/oi-r...de-1-30-07.pdf and check out page 7-10 it will show you how to wire a potentiometer to one of the joystick analog ports. Treat it exactly like a joystick input. You should receive a value between 0-255 all you have to do is map that to 360 degrees.
  #3   Spotlight this post!  
Unread 08-02-2007, 16:56
kaszeta's Avatar
kaszeta kaszeta is offline
Registered User
FRC #0095 (Grasshoppers)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2002
Location: Lebanon, NH
Posts: 334
kaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of light
Re: OI potentiometer for controlling turret

Quote:
Originally Posted by team 888 View Post
We want to put a potentiometer on our control board for controlling our turret. I think i know how to program it if we were to put another potentiometer on the actual robot but there's no room and i don't want to mess around with the gear tooth sensor. Is there anyway to rotate the potentiometer and based on how many degrees it rotated turn the motor for the turret on for a certain amount of time???
The best way to do this is a PID control loop, with two inputs:

1. The potentiometer hooked up to one port of your OI telling it the desired angle of your robot

2. A potentiometer on the bot telling the current angle of the turret.

For the PID loop itself, it will look something like

Code:
error=phi-theta;  // phi is current turrent angle, theta is desired angle
                       // make sure that the units match on both
	
Kp=20;  

omega=(long)Kp*(long)error/2000L;

// Set limit bands
if(omega>64){omega=64;}
if(omega<-64){omega=-64;}

motor_pwm+=omega;
  #4   Spotlight this post!  
Unread 08-02-2007, 17:36
team 888's Avatar
team 888 team 888 is offline
Registered User
FRC #0888
 
Join Date: Jan 2007
Location: Maryland
Posts: 7
team 888 is an unknown quantity at this point
Re: OI potentiometer for controlling turret

Quote:
Originally Posted by CrashOverride View Post
You should receive a value between 0-255 all you have to do is map that to 360 degrees.
how would i go about doing this in the code?? i'm really new to this programing stuff and don't understand alot of it
  #5   Spotlight this post!  
Unread 08-02-2007, 23:28
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: OI potentiometer for controlling turret

If you want any decent control of the turret (or any other mechanism), you need to put sensors on it. Period. Potentiometers are pretty small. Surely you can find someplace around the turret that isn't crowded out. (I've never seen a robot that full.) If this is a problem for you, I think you're doing something wrong. (Also, limit switches of some kind at the ends of travel would not be out of order. Partly for calibrating the "pots", mostly for keeping the bot from tearing itself apart.)

What you're suggesting is to basically "dead recon" the turret. Yes this can be done, but as soon as a robot runs into whatever is attached to the turret and turns it, you're hosed; all your movement will be off. (And heaven forbid you don't put the turret in the same place at the start of every match. It starts off wrong, then.)

Any closed control loop (something with a sensor) will compensate for such movement.

All of these are important factors in FIRST, especially this year, because you can't always see so well if your robot is on the far side of the field.

Bottom line: yes, you could do it, but it is far more worth your time to squeeze in those sensors.
  #6   Spotlight this post!  
Unread 09-02-2007, 00:16
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: OI potentiometer for controlling turret

I agree with Jamie, sensors, sensors, sensors, very important, for your robot to do anything more intelligent than blindly firing motors it needs information. Also, shameless plug, in my signature is a paper on PID control theory, and lots of examples, and common pitfalls and some tricks, let me know if you use it and if its any help!

In reply to kaszeta's post, what you've described is a P loop only, there is no ID control in that, see the formulas in my paper for further examples of that control.
With just P you're either going to under or overshoot a lot, and it will probably slip more because small errors won't generate a significant output. Also I would never ever recommend starting with such a high gain, you're just asking for something to snap around at full speed, but you did remember to include a speed limiter sanity check after, so it's not really a problem, but you won't see anything other than 64 in either direction until you have a really tiny error, which means more than likely an overshoot.
__________________
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!)

Last edited by Matt Krass : 09-02-2007 at 00:40. Reason: Additional comment
  #7   Spotlight this post!  
Unread 09-02-2007, 00:32
kaszeta's Avatar
kaszeta kaszeta is offline
Registered User
FRC #0095 (Grasshoppers)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2002
Location: Lebanon, NH
Posts: 334
kaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of light
Re: OI potentiometer for controlling turret

Quote:
Originally Posted by Astronouth7303 View Post
If you want any decent control of the turret (or any other mechanism), you need to put sensors on it. Period.
I'm tempted to make T-shirts that say this that the programmers can wear during the build season, since this seems to get forgotten most years, with the sensors being badly installed at the last minute.
  #8   Spotlight this post!  
Unread 10-02-2007, 14:31
Anime-niac_2.9's Avatar
Anime-niac_2.9 Anime-niac_2.9 is offline
Japanese-crap freak(NOTE AVATAR)
AKA: Alex Abenoja, A-Squared, & Anime
FRC #0599 (Robodox)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Northridge, California
Posts: 88
Anime-niac_2.9 will become famous soon enough
Re: OI potentiometer for controlling turret

are motors or servos being used?
__________________
THE ROBODOX FORUM

Reading: Suzumiya Haruhi no Yuutsu by Tanigawa Nagaru
Religion: Haruhiism
  #9   Spotlight this post!  
Unread 12-02-2007, 14:22
team 888's Avatar
team 888 team 888 is offline
Registered User
FRC #0888
 
Join Date: Jan 2007
Location: Maryland
Posts: 7
team 888 is an unknown quantity at this point
Re: OI potentiometer for controlling turret

we are using a window motor. I went over the final design robot this morning and the drive train is in the way for placing the potentiometer. Eliminating this problem would call for some major design changes that we don't want to start at this point. Does anyone one have a simple code that will measure the rotation of the potentiometer on the oi?
  #10   Spotlight this post!  
Unread 12-02-2007, 14:53
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: OI potentiometer for controlling turret

Reading the OI potentiometer is easy -- just connect it between +5 and one of the OI analog inputs (x, y, wheel, or aux) on a joystick connector.

But without a position sensor on your turret, you won't be able to do much with the value coming back from the OI. How will you know which way to drive the turret motor if you don't know where it's pointing at any given moment?

If you don't have room for a pot on the window motor, how about putting a gear on the shaft it's turning and putting the pot on a matching gear connected to it?
  #11   Spotlight this post!  
Unread 12-02-2007, 14:57
kaszeta's Avatar
kaszeta kaszeta is offline
Registered User
FRC #0095 (Grasshoppers)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2002
Location: Lebanon, NH
Posts: 334
kaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of light
Re: OI potentiometer for controlling turret

Quote:
Originally Posted by Matt Krass View Post
In reply to kaszeta's post, what you've described is a P loop only, there is no ID control in that, see the formulas in my paper for further examples of that control.
Yeah, I should've been clear that the example I gave is P-only code (the code I lifted it from was a full PID loop, but I figure it was best to leave some of it for the reader to implement themselves).
  #12   Spotlight this post!  
Unread 12-02-2007, 15:05
kaszeta's Avatar
kaszeta kaszeta is offline
Registered User
FRC #0095 (Grasshoppers)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2002
Location: Lebanon, NH
Posts: 334
kaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of light
Re: OI potentiometer for controlling turret

Quote:
Originally Posted by team 888 View Post
I went over the final design robot this morning and the drive train is in the way for placing the potentiometer.
If I had a dollar for every time this has happened... Too many times the sensors get added in as an afterthought.

You won't get anything useful from the OI, you need feedback from the actual rotating turret to have a real control loop. Anything else is just open-loop control and prayer.

Methods for retrofitting some sort of feedback sensor include:

1. The abovementioned technique of adding a gear to the turning shaft, and hook a pot or encoder to that shaft.

2. Similarly, Team 95 has used friction wheels against the turning shaft. I don't recommend this, since it almost always will have a bit of slip.

3. Depending on the shaft size, you might be able to put a gear or nubs on it and use the Gear Tooth Sensor (note that with just one sensor, you won't be able to tell direction of rotation).

4. You can get shaft encoders that slip over an existing shaft, but you might have trouble procuring these in time.

5. I've seen string potentiometers (both professional and jury-rigged) used in all sorts of interesting setups where nothing else fit, if you can find or make one in time.
  #13   Spotlight this post!  
Unread 12-02-2007, 16:45
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: OI potentiometer for controlling turret

Quote:
Originally Posted by team 888 View Post
we are using a window motor. I went over the final design robot this morning and the drive train is in the way for placing the potentiometer. Eliminating this problem would call for some major design changes that we don't want to start at this point. Does anyone one have a simple code that will measure the rotation of the potentiometer on the oi?
I want to see the picture of this turret with absolutely no space in its entire 360° for a ¼" by ¼" potentiometer. (You couldn't point it the other way and have it over the drivetrain?)

Bottom line: You MUST put in a pot if you expect any decent control. (How can I emphasize it further?)

Give me sensors or give me death!

A sensor is worth a thousand words.

A sensor in hand is worth two in the bush.

Early to wire and early to read makes a robot healthy, wealthy, and wise.

When the pot's away, the arms will play.

A sensor a day keeps the mentor away.

A pot is a bot’s best friend.

The sensor is always nicer on the other side.

Hell hath no fury like a sensor ignored.

Knowledge is power.

Sensors are made, not born.

It’s not whether you win or lose, it’s how you read your pots.

A bot is known by the sensors it keeps.
  #14   Spotlight this post!  
Unread 12-02-2007, 17:59
nicolabot nicolabot is offline
little sleep but still going
AKA: nik cola
FRC #1891 (Bull bots)
Team Role: Mechanical
 
Join Date: Jan 2007
Rookie Year: 2007
Location: boise
Posts: 1
nicolabot is an unknown quantity at this point
Send a message via Yahoo to nicolabot
Re: OI potentiometer for controlling turret

i was wondering how much your arm weighs now
  #15   Spotlight this post!  
Unread 12-02-2007, 21:09
Dad1279 Dad1279 is offline
Registered User
FRC #1279 (Cold Fusion)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2004
Location: NJ
Posts: 511
Dad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud of
Re: OI potentiometer for controlling turret

You can use one of the gear tooth sensors suplied with the kit, with a sprocket on the window motor.
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
Best source for a potentiometer? railerobotics Electrical 20 28-11-2007 22:24
Turret or No Turret? Leo 1529 Technical Discussion 5 16-01-2006 15:47
Code for use of a potentiometer wonderdog5 Programming 2 06-11-2002 23:15
Code for use of a potentiometer wonderdog5 OCCRA 2 06-11-2002 23:15
Code for Potentiometer wonderdog5 Programming 4 06-11-2002 15:19


All times are GMT -5. The time now is 00:27.

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