OCCRA
Go to Post What am I going to do with all of these torches and pitchforks now? - PayneTrain [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 03-22-2004, 12:35 AM
activemx's Avatar
activemx activemx is offline
A M X
AKA: Akshay Dodeja
no team
Team Role: College Student
 
Join Date: Jan 2002
Rookie Year: 2000
Location: Portland, Oregon
Posts: 312
activemx is a glorious beacon of lightactivemx is a glorious beacon of lightactivemx is a glorious beacon of lightactivemx is a glorious beacon of lightactivemx is a glorious beacon of light
Send a message via AIM to activemx Send a message via Yahoo to activemx
Need help programming our swerve with feedback?

Our programmers need help and guidance in programming a swerve drive with Pot feed bnack

--------
| \\ \\ |


| \\ \\ |
--------

joystick
-----
| \ |
-----


thats pretty much how its set up
all the wheels are linked up by one chain and a Window motor. there is aidler nylon sprocket on the chain witha potentiometer.

we want the pot to give us the angle of the wheel and want the wheels to turn to the position where the joystick is pointed to.
I hope those illustrations help.

If team who have tackled this type of problem befoer please help us out. aka wildstang or anyothers would be great.
__________________
2005 - Present - FIRST Volunteer(Inspector, Ref, Judge)
2000-2004 MVRT 115
  #2   Spotlight this post!  
Unread 03-22-2004, 02:44 AM
Cyris12 Cyris12 is offline
Registered User
AKA: Ajay Reddy
#0254 (Cheesy Poofs)
Team Role: Programmer
 
Join Date: Feb 2004
Location: San Jose, CA
Posts: 6
Cyris12 is an unknown quantity at this point
Send a message via AIM to Cyris12
Re: Need help programming our swerve with feedback?

Have you tried a PID loop? We faced a similar problem with our arms. We needed to drive the motors just enough to reach a position and fight gravity, but not enough to overshoot. The trick is to set your motor value proportional to the distance you want to go.

A solution (run through this every so often with timers):
1) Find the difference between your current pot position and your target position. This is your error value.
2) You want your motor value to be proportional to the error. Multiply the error by a constant (you'll have to figure it out through experimentation). This gives you your proportional value.
3) As your wheels approach the right orientaion, your motor value will decrease more and more. To compensate for this, integrate the error (ie add the current error to a running total). Multiply this by another constant (again, you'll have to figure it out). This will give you your integral value.
4) Add the two values together to get your motor value.

It sounds a little complicated, but the code is actually pretty simple. The object does tend to overshoot some, and then oscillate a little. This can be minimized by adjusting the constants.

This system may allow you to plug in a certain angle and have your wheels find that position automatically. On our robot, we use this to create preset arm positions. You might be able to do the same with wheel positions.

EDIT: On second thought, using an integral probably wouldn't be best for you. Instead, you might want to just use a proportional value. To get the wheel to its target position when the proportional drops too low, you could have a range close to the target with a different constant (to multiply by).

Last edited by Cyris12 : 03-22-2004 at 02:58 AM.
  #3   Spotlight this post!  
Unread 03-22-2004, 03:16 AM
10intheCrunch's Avatar
10intheCrunch 10intheCrunch is offline
Who's John V-Neun?
AKA: Alex Baxter
None #0254 (Cheesy Poofs)
Team Role: College Student
 
Join Date: Feb 2004
Rookie Year: 2004
Location: San Jose, CA
Posts: 129
10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough
Send a message via AIM to 10intheCrunch
Re: Need help programming our swerve with feedback?

You are probably going to need a trig table in order to interpret the x and y axes of the joystick. This can be a slow process and dramatically slow down your performance, the same (or worse) as using floating point numbers. I don't really know all the machinations of EEPROM (Ajay knows more than I), or much about swerve, but you are going to need to find that angle if you want to get anywhere...

From there I would use a proportional value to move the motors that decreases as you close on the right position.
__________________
~Alex Baxter
Programming, Arms operation, Team 254
  #4   Spotlight this post!  
Unread 03-22-2004, 03:20 AM
FotoPlasma FotoPlasma is offline
\: |
no team
 
Join Date: Jul 2001
Rookie Year: 2001
Location: San Jose
Posts: 1,900
FotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond repute
Send a message via AIM to FotoPlasma
Re: Need help programming our swerve with feedback?

Akshay, if you could have Rebecca IM me sometime in the next week or two, I'll do everything I can to help you out with your system.

Pretty much, if you can determine the arctangent of the joystick position, you can determine the angle you want your wheel modules at, and using the Pythagorean Theorem, you can determine magnitude of your drive motors.

Because of the fact that you cannot rotate your wheel modules around completely, I think that if the sine of your joystick value is negative (id est, less than or equal to 127) you should invert the cosine value and the magnitude, in order to have the wheel modules only travel 180degrees, total.

This could prove to be a problem when you make the transition from some small positive angle from normal to an angle just below normal (300+degrees), in which case your wheel modules would have to traverse almost all of 180 degrees in order wind up pointing in the proper direction.

There're many other considerations when you're programming a system like this, and I'm really more than willing to help you guys out with anything I can. I really want to say that I'm sorry that I didn't get to help you at Sacramento, this weekend.

<edit>
About PID control, we used a P control loop on our swerve, last year (with the BasicStamp-based control system), so I don't think that getting too far (farther than P) into feedback control systems is very necessary.
</edit>
__________________
I played hacky sack with Andy Baker.

2001-2004: Team 258, The Sea Dawgs
2005: Team 1693, The Robo Lobos

Last edited by FotoPlasma : 03-22-2004 at 03:26 AM.
  #5   Spotlight this post!  
Unread 03-22-2004, 03:34 PM
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: Need help programming our swerve with feedback?

Why not just make a look-up table custom made for your bot?
  #6   Spotlight this post!  
Unread 03-23-2004, 02:58 AM
Alex1072 Alex1072 is offline
Registered User
AKA: Alex
#1072 (Harker Robotics Team)
Team Role: Leadership
 
Join Date: Jan 2003
Rookie Year: 2003
Location: San Jose
Posts: 110
Alex1072 is an unknown quantity at this point
Send a message via AIM to Alex1072 Send a message via Yahoo to Alex1072
Re: Need help programming our swerve with feedback?

If you need help getting the wheels to servo to angle, I can give you the PID code for our arm. We use a window motor to servo it to a pot angle. Works like a charm (after a adjusting the constants to hell).
__________________
--------------------------------------
Alex
President
Team 1072 Harker Robotics
  #7   Spotlight this post!  
Unread 03-23-2004, 04:47 PM
TomJoseph TomJoseph is offline
The Pirate
#0247 ('Da Bears)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Michigan
Posts: 3
TomJoseph is an unknown quantity at this point
Send a message via ICQ to TomJoseph Send a message via AIM to TomJoseph
Re: Need help programming our swerve with feedback?

It's much easier to try to map joystick values to pot values than to try to determine the angle and everything. The end effect is just the same, and it's much easier to code. Here's some pseudo code to start you out:
Code:
Compare joystick to pot:
JOYSTICK > POT + LEEWAY:  Check to see how far apart
  JOYSTICK > SET RANGE > POT + LEEWAY:
    Power motor fast
  SET RANGE > JOYSTICK > POT + LEEWAY:
    Power motor slower
  POT - LEEWAY <= JOYSTICK <= POT + LEEWAY:
    Set motor Neutral

POT - LEEWAY > JOYSTICK:
  JOYSTICK < SET RANGE < POT - LEEWAY:
    Set motor fast opposite dir
  SET RANGE < JOYSTICK < POT - LEEWAY:
    Set motor slower opp dir

ELSE
    Set motor neutral
If you're keeping the joystick in a set position (like a dial for example), then it's silly to use proportional speeds. Just make sure that the slower speed is slow enough for it to stop without much drift. The friction between the tires and the floor should take care of the rest. Last year we had unidirectional drive with a dial-control, and used almost the exact same code (IIRC, we used two set ranges instead of one)
  #8   Spotlight this post!  
Unread 03-23-2004, 05:19 PM
KenWittlief KenWittlief is offline
.
no team
Team Role: Engineer
 
Join Date: Mar 2003
Location: Rochester, NY
Posts: 4,211
KenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond repute
Re: Need help programming our swerve with feedback?

why not simply use a potentiometer on the operator interface?

then all your control loop has to do is get the feedback pot to match the OI pot

and your wheels will turn in the direction the pot is pointing on the OI - like a steering wheel?
  #9   Spotlight this post!  
Unread 03-23-2004, 06:10 PM
Mike Soukup's Avatar
Mike Soukup Mike Soukup is offline
Software guy
FRC #0111 (Wildstang)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1996
Location: Schaumburg, IL
Posts: 797
Mike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond repute
Re: Need help programming our swerve with feedback?

Quote:
Originally Posted by KenWittlief
why not simply use a potentiometer on the operator interface?

then all your control loop has to do is get the feedback pot to match the OI pot

and your wheels will turn in the direction the pot is pointing on the OI - like a steering wheel?
He is using a potentiometer, the one built into the joystick. Have you ever tried driving a robot with a pot? It's not easy. It's essential to have a controller that bounces back to the neutral position, exactly like the joystick does.

The controls may not be a 1:1 mapping, in most cases for crab/swerve it is not. We map the full range of the joystick to 180 degrees of motion - full left to full right. That ends up being about 66% of the full pot range. Besides the scaling, we calibrate the crab pot such that 127 does not have to be the center position, this makes putting the pot in its place much easier.
  #10   Spotlight this post!  
Unread 03-23-2004, 06:46 PM
KenWittlief KenWittlief is offline
.
no team
Team Role: Engineer
 
Join Date: Mar 2003
Location: Rochester, NY
Posts: 4,211
KenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond repute
Re: Need help programming our swerve with feedback?

with crab steering I would think you would want a pot that stays where you left it - because the bot does not turn in an arc like a car or a bot with conventional 2 or 4 wheel drive - it goes where you point it

why would you want your bot to always default to pointing straight down the field?
  #11   Spotlight this post!  
Unread 03-24-2004, 02:37 PM
Mike Soukup's Avatar
Mike Soukup Mike Soukup is offline
Software guy
FRC #0111 (Wildstang)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1996
Location: Schaumburg, IL
Posts: 797
Mike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond repute
Re: Need help programming our swerve with feedback?

Quote:
Originally Posted by KenWittlief
with crab steering I would think you would want a pot that stays where you left it - because the bot does not turn in an arc like a car or a bot with conventional 2 or 4 wheel drive - it goes where you point it

why would you want your bot to always default to pointing straight down the field?
It's not a bot that defaults to pointing straight down the field, it's a bot that defaults to wheels pointing straight ahead. Our driver doesn't want to mess around with centering a pot when he wants to drive straight forward. He wants to let the springs in the stick find the center point for him & have the wheels snap to straight ahead without much effort or thought.
  #12   Spotlight this post!  
Unread 03-24-2004, 02:52 PM
Matt Reiland's Avatar
Matt Reiland Matt Reiland is offline
'The' drive behind the drive
None #0226 (TEC CReW Hammerheads)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1999
Location: Troy Michigan
Posts: 712
Matt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond repute
Re: Need help programming our swerve with feedback?

Activemx

Here is the code we used 2 years ago in pBasic. It was the identical setup to yours with a 4 wheels linked and one pot and one steering motor. When the top joystick button was pressed, the wheels followed the joystick around, when released they went forward and steered like a tank.
Attached Files
File Type: zip Sidestep.zip (4.5 KB, 105 views)
__________________
Robonaut Next Generation Control System Development

2003 GLR Champions (302,67,226)
2003 Buckeye Semi-Finalists(902,494,226)
2002 Nationals QuarterFinalists
2001 West MI QuarterFinalists
2000 GLR Semi-Finalists
  #13   Spotlight this post!  
Unread 03-24-2004, 04:57 PM
activemx's Avatar
activemx activemx is offline
A M X
AKA: Akshay Dodeja
no team
Team Role: College Student
 
Join Date: Jan 2002
Rookie Year: 2000
Location: Portland, Oregon
Posts: 312
activemx is a glorious beacon of lightactivemx is a glorious beacon of lightactivemx is a glorious beacon of lightactivemx is a glorious beacon of lightactivemx is a glorious beacon of light
Send a message via AIM to activemx Send a message via Yahoo to activemx
Re: Need help programming our swerve with feedback?

I would like to thank all of you: Matt, Mike, Jay, Alex, Jim, ken and whoever i missed

I am going to get our programmers to get some help from this post and i will keep you guys update.THanks again!

Akshay
__________________
2005 - Present - FIRST Volunteer(Inspector, Ref, Judge)
2000-2004 MVRT 115
  #14   Spotlight this post!  
Unread 03-25-2004, 10:41 PM
rosebud rosebud is offline
Registered User
#0115 (MVRT)
 
Join Date: Sep 2002
Location: California
Posts: 24
rosebud is on a distinguished road
Re: Need help programming our swerve with feedback?

hi everyone,
thanks for all ur answers to the swerve program! i think the table i made for inverse tangent was incorrect. also, when i compared and displayed the pot value and the value the pot should be at according to the joystick, printf displays garbage. but when i use it in an equation, it works, so maybe its something with printf, although both variables are signed ints, so it should be ok. anyways, i used the taylor power series expansion to find inverse tangent, and used the difference between pot and where pot should be to find a variable speed of rotation, so the code works. thanks again everyone, and check out mvrt 115 in silicon valley.
rebecca
  #15   Spotlight this post!  
Unread 03-26-2004, 08:10 PM
Alex1072 Alex1072 is offline
Registered User
AKA: Alex
#1072 (Harker Robotics Team)
Team Role: Leadership
 
Join Date: Jan 2003
Rookie Year: 2003
Location: San Jose
Posts: 110
Alex1072 is an unknown quantity at this point
Send a message via AIM to Alex1072 Send a message via Yahoo to Alex1072
Re: Need help programming our swerve with feedback?

If you use only a P term you should be careful of resonance. That may not be an issue becaue the wheels don't have much momentum when they start turning, but if they start shaking back and forth it means you need a D term.
__________________
--------------------------------------
Alex
President
Team 1072 Harker Robotics
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
Programming Compatition Angela06 Programming 30 04-08-2005 11:12 PM
Feedback LEDs on OI bstempi Programming 1 02-22-2004 09:18 PM
A few questions on programming the Control System Avarik Control System 21 02-08-2004 11:42 AM
Help On Coding 2K1 Controller GregTheGreat Programming 9 12-05-2003 06:35 PM
Chamionship Qualification - feedback needed ASAP! dlavery General Forum 97 10-11-2003 07:17 AM


All times are GMT -5. The time now is 11:28 AM.

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