Go to Post Do you guys mind if we postpone kick-off to around January 26 or so? We can still keep the ship date on February 20, if that isn't a problem. - dlavery [more]
Home
Go Back   Chief Delphi > FIRST > General Forum
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 12-07-2013, 18:31
Justin Shelley's Avatar
Justin Shelley Justin Shelley is offline
Registered User
FRC #3885 (Shockers)
Team Role: Driver
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Farmington, MO
Posts: 178
Justin Shelley is on a distinguished road
Send a message via MSN to Justin Shelley
Math and Programming Behind Swerve

This will be my senior year in high school and I am completly fascinated by the complexities of true swerve driving and the capabilities of it. I would rate my math skills very high but my programming skills are pretty low, i've never had instruction in programming. I am highly interested in learning how to program swerve drive and what it truly is. If you can help me out I would greatly appreciate it!
Reply With Quote
  #2   Spotlight this post!  
Unread 12-07-2013, 23:19
magnets's Avatar
magnets magnets is offline
Registered User
no team
 
Join Date: Jun 2013
Rookie Year: 2012
Location: United States
Posts: 748
magnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond repute
Re: Math and Programming Behind Swerve

This depends on how the modules are driven. For the sake of this post, I am assuming that you are talking about independently steered and driven modules. There are several different ways to calculate the angles and speeds of each wheel, but the goal is to first find the point around which the robot is turning (it can be inside or outside the frame perimeter), then make sure all the wheels are tangent to a circle that has a center point on the robot turning point, and intersects the wheel. Then, based on the circumference of these circles, you must adjust the speed of each wheel so that the one that travels the farthest distance travels faster (like a differential on a car).

This can be calculated by adding the rotation to the xy movement for each wheel. To find the xy movement, you must first convert the xy to polar coordinates. r = sqrt(x^2+y^2), and theta = atan2(y, x) (note- some software reverses the order of the arguments for atan2 like excel, but LabView, Java, and C++ are like this)

R will be your wheel speed, and theta will be the wheel angle.
Then, you need to normalize r, because it can have a max value of sqrt(2) (at 1,1)
Then, it needs to be converted back to xy so that it can be added to the rotational part.

To find the rotational part, you need to know where the wheels are located relative to the center of the robot like on a coordinate plane so you have x and y coordinates for each wheel. Then, you need to convert these to polar coordinates, add 90 degrees to theta (so that wheels will be like /\)
\/
and multiply r by the desired rotation (this will cause the wheels farther from the center to spin faster so they can travel farther). Take these modified coordinates, convert to xy, add to the translation part, convert back to polar, and you will have your setpoints for wheel speed and angle.


To see a good implementation of programming swerve in java/c++ see Ether's post and look at the very top and very bottom ones.

As for LabView, check out 1094's post here.
Reply With Quote
  #3   Spotlight this post!  
Unread 13-07-2013, 06:58
Foster Foster is offline
Engineering Program Management
VRC #8081 (STEMRobotics)
Team Role: Mentor
 
Join Date: Jul 2007
Rookie Year: 2005
Location: Delaware
Posts: 1,393
Foster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond repute
Re: Math and Programming Behind Swerve

Don't double post. Your answer is in the other thread
__________________
Foster - VEX Delaware - 17 teams -- Chief Roboteer STEMRobotics.org
2010 - Mentor of the Year - VEX Clean Sweep World Championship
2006-2016, a decade of doing VEX, time really flies while having fun
Downingtown Area Robotics Web site and VEXMen Team Site come see what we can do for you.
Reply With Quote
  #4   Spotlight this post!  
Unread 13-07-2013, 07:04
Gdeaver Gdeaver is offline
Registered User
FRC #1640
Team Role: Mentor
 
Join Date: Mar 2004
Rookie Year: 2001
Location: West Chester, Pa.
Posts: 1,368
Gdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond repute
Re: Math and Programming Behind Swerve

I believe our programming team is finishing up a code revue and will post our 2013 swerve code some time this summer.
Reply With Quote
  #5   Spotlight this post!  
Unread 13-07-2013, 09:38
Justin Shelley's Avatar
Justin Shelley Justin Shelley is offline
Registered User
FRC #3885 (Shockers)
Team Role: Driver
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Farmington, MO
Posts: 178
Justin Shelley is on a distinguished road
Send a message via MSN to Justin Shelley
Re: Math and Programming Behind Swerve

Quote:
Originally Posted by Foster View Post
Don't double post. Your answer is in the other thread
sorry, i couldn't figure out where the post had went but i found it now. I greatly appreciate your answer in the other one and i'll take it down now to prevent confusion
Reply With Quote
  #6   Spotlight this post!  
Unread 13-07-2013, 11:49
jcbc's Avatar
jcbc jcbc is offline
Registered User
AKA: Julie
no team
 
Join Date: Aug 2010
Rookie Year: 2011
Location: PA
Posts: 53
jcbc is a jewel in the roughjcbc is a jewel in the roughjcbc is a jewel in the roughjcbc is a jewel in the rough
Re: Math and Programming Behind Swerve

In case you hadn't found this yet, see this post for our 2011 drive code (in LabVIEW library form): http://www.chiefdelphi.com/media/papers/2704

We are putting the finishing touches on releasing our competition season code, which includes the drive code. I'll be posting the link to the GitHub repository as well as a zip file (if it isn't too large), hopefully before we leave for IRI.
Reply With Quote
  #7   Spotlight this post!  
Unread 13-07-2013, 20:17
brennonbrimhall brennonbrimhall is offline
Free Agent
AKA: Brennon Brimhall
no team
Team Role: Alumni
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Clifton Park, NY
Posts: 222
brennonbrimhall is a name known to allbrennonbrimhall is a name known to allbrennonbrimhall is a name known to allbrennonbrimhall is a name known to allbrennonbrimhall is a name known to allbrennonbrimhall is a name known to all
Re: Math and Programming Behind Swerve

I believe that Ether has posted a whitepaper that goes through the math and pseudocode for a true swerve drive. It's sounding that that's really what you want.

Quote:
I greatly appreciate your answer in the other one and i'll take it down now to prevent confusion
Would you mind re-posting the answer, for posterity's sake? If it's a greatly appreciated answer, chances are that someone else would also be able to greatly appreciate it.
__________________
Team 20, 2012-2014: 4 blue banners, 5 medals, and 9 team awards.
Church of Jesus Christ of Latter-day Saints, 2014-2016: Missionary, Colorado Denver South Mission.
Reply With Quote
  #8   Spotlight this post!  
Unread 13-07-2013, 20:48
Foster Foster is offline
Engineering Program Management
VRC #8081 (STEMRobotics)
Team Role: Mentor
 
Join Date: Jul 2007
Rookie Year: 2005
Location: Delaware
Posts: 1,393
Foster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond reputeFoster has a reputation beyond repute
Re: Math and Programming Behind Swerve

1640s swerve repository is here http://wiki.team1640.com/index.php?title=Swerve_Central

Go for it.
__________________
Foster - VEX Delaware - 17 teams -- Chief Roboteer STEMRobotics.org
2010 - Mentor of the Year - VEX Clean Sweep World Championship
2006-2016, a decade of doing VEX, time really flies while having fun
Downingtown Area Robotics Web site and VEXMen Team Site come see what we can do for you.
Reply With Quote
  #9   Spotlight this post!  
Unread 13-07-2013, 22:33
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,101
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Math and Programming Behind Swerve

Quote:
Originally Posted by brennonbrimhall View Post
I believe that Ether has posted a whitepaper that goes through the math and pseudocode for a true swerve drive. It's sounding that that's really what you want.
Here are links to the documents:

Derivation of the equations:
http://www.chiefdelphi.com/media/papers/download/3027

How to use the equations:
http://www.chiefdelphi.com/media/papers/download/3028

Excel spreadsheet swerve calculator:
http://www.chiefdelphi.com/media/papers/download/3104

Miscellaneous additional documents:
http://www.chiefdelphi.com/media/papers/2426


Reply With Quote
Reply


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


All times are GMT -5. The time now is 17:59.

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