Go to Post Don't be affraid of trying new things... Even if people say you are crazy, even if you get insulted, even if it involves a lot of time and money, try it. You can't know if it'll work or not if you didn't try it yet. - EDesbiens [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 14-01-2010, 22:15
DuskProgrammer DuskProgrammer is offline
Registered User
FRC #2421
 
Join Date: Jan 2010
Location: VA
Posts: 2
DuskProgrammer is an unknown quantity at this point
Swerve Drive

This year my team is thinking of using swerve drive for the first time. We are planning to use the ones off AndyMark since we can't make our own.
http://andymark.biz/swervemodules.html

However, since this will be our first time (if we use it), I don't know much about how to program it. I would appreciate help in knowing if I need to get any other sensors for it. Additionally (and the main reason I'm posting it here), I would like some help in figuring out how to program it in Java/C++.

I would like sample code if you can provide, as well as different ways I can implant the driving while trying to keep it simple enough that the drivers can figure out how to drive it.

Thanks.
  #2   Spotlight this post!  
Unread 14-01-2010, 22:28
DonRotolo's Avatar
DonRotolo DonRotolo is offline
Back to humble
FRC #0832
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Atlanta GA
Posts: 7,011
DonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond repute
Re: Swerve Drive

A swerve drive is the most challenging kind of drive to implement. You might want to consider that if you've never done it before.

Here's a hint on the programming: Use polar coordinates for your joystick inputs. The direction of the joystick determines the direction of motion for the robot; the distance from the center 'neutral' position determines the magnitude of the motor speed.

Easy to drive, very intuitive. Programming, not so easy.
__________________

I am N2IRZ - What's your callsign?
  #3   Spotlight this post!  
Unread 14-01-2010, 22:51
Dave McLaughlin's Avatar
Dave McLaughlin Dave McLaughlin is online now
Registered User
no team
Team Role: Alumni
 
Join Date: Sep 2006
Rookie Year: 2007
Location: Pullman, WA
Posts: 299
Dave McLaughlin has a reputation beyond reputeDave McLaughlin has a reputation beyond reputeDave McLaughlin has a reputation beyond reputeDave McLaughlin has a reputation beyond reputeDave McLaughlin has a reputation beyond reputeDave McLaughlin has a reputation beyond reputeDave McLaughlin has a reputation beyond reputeDave McLaughlin has a reputation beyond reputeDave McLaughlin has a reputation beyond reputeDave McLaughlin has a reputation beyond reputeDave McLaughlin has a reputation beyond repute
Re: Swerve Drive

I might also recommend a three axis joystick on the control side of things. Off the top of my head I know that Team 1983 and Team 179 implemented a single three axis joystick for control of there respective swerves last year.
  #4   Spotlight this post!  
Unread 14-01-2010, 22:54
James Tonthat James Tonthat is offline
Registered User
FRC #0148 (Robowranglers)
Team Role: Mentor
 
Join Date: Feb 2008
Rookie Year: 2008
Location: Greenville, TX
Posts: 303
James Tonthat has a reputation beyond reputeJames Tonthat has a reputation beyond reputeJames Tonthat has a reputation beyond reputeJames Tonthat has a reputation beyond reputeJames Tonthat has a reputation beyond reputeJames Tonthat has a reputation beyond reputeJames Tonthat has a reputation beyond reputeJames Tonthat has a reputation beyond reputeJames Tonthat has a reputation beyond reputeJames Tonthat has a reputation beyond reputeJames Tonthat has a reputation beyond repute
Re: Swerve Drive

We had a similar system designed before the season and didn't look like we'd be able to use it wouldn't be able to climb a ramp, look at the approach angle of the Team 221 swerve module you're looking at. It doesn't look like it will clear the ramp.
__________________
James Tonthat

Mechanical Engineer, RackSolutions, a subsidiary of Innovation First International

Lead Engineer - Texas Torque - 2009-2014
Mentor - Robowranglers - 2015-
  #5   Spotlight this post!  
Unread 15-01-2010, 17:36
DuskProgrammer DuskProgrammer is offline
Registered User
FRC #2421
 
Join Date: Jan 2010
Location: VA
Posts: 2
DuskProgrammer is an unknown quantity at this point
Re: Swerve Drive

Thanks for the quick replies.

I was wondering if I would need to get sensors if we use swerve drive. If so, what kind of sensors do I need?

Also, it would be nice if one of the teams that use swerve drive could provide a sample of the drive code. It would be helpful in showing me how to implant it and saving me time. Otherwise, I'll probably end up writing code that doesn't work as well and not having much time to improve it.
  #6   Spotlight this post!  
Unread 15-01-2010, 17:45
EricH's Avatar
EricH EricH is offline
New year, new team
FRC #1197 (Torbots)
Team Role: Engineer
 
Join Date: Jan 2005
Rookie Year: 2003
Location: SoCal
Posts: 19,814
EricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond repute
Re: Swerve Drive

Quote:
Originally Posted by DuskProgrammer View Post
Thanks for the quick replies.

I was wondering if I would need to get sensors if we use swerve drive. If so, what kind of sensors do I need?
That's NOT a question--if you're doing swerve and you don't have at least one sensor monitoring module rotation per set of independently rotating modules, you're probably doing something wrong. You need a sensor that can tell what angle the modules (and therefore the wheels) are at relative to the robot. Backups are also a good idea for redundancy. I think a lot of teams use encoders or pots; exactly which one depends on the team.

Oh, and for the programmer: Have an "emergency" tank drive mode that can be used if rotation fails or if you simply want to drive tank style, if your mechanical design will allow for it. With those, yes, you should be able to do it.
__________________
Past teams:
2003-2007: FRC0330 BeachBots
2008: FRC1135 Shmoebotics
2012: FRC4046 Schroedinger's Dragons

"Rockets are tricky..."--Elon Musk

  #7   Spotlight this post!  
Unread 15-01-2010, 18:12
Guopeter Guopeter is offline
Registered User
AKA: Pie
FRC #0296 (Northern Knights)
Team Role: College Student
 
Join Date: Mar 2008
Rookie Year: 2008
Location: Guelph, Ontario
Posts: 21
Guopeter is just really niceGuopeter is just really niceGuopeter is just really niceGuopeter is just really nice
Re: Swerve Drive

Quote:
Originally Posted by DuskProgrammer View Post
Thanks for the quick replies.

I was wondering if I would need to get sensors if we use swerve drive. If so, what kind of sensors do I need?

Also, it would be nice if one of the teams that use swerve drive could provide a sample of the drive code. It would be helpful in showing me how to implant it and saving me time. Otherwise, I'll probably end up writing code that doesn't work as well and not having much time to improve it.
Hi there,
I was the programmer for team 2609 last year and I coded the their swerve drive system that worked very well.

Programming could be simple, if you can understand the main concepts. It's NOT that scary.

The goal of the program is to keep all four wheels in the same orientation. The programming depends on how you link the swerve modules.

There are three ways to link:
1. Use two chains to link the four modules into two systems (left and right)
2. Same as 1, but add a third chain to link the two systems (left and right) to "synchronize" them
3. Use no chains (have the four modules individually driven by a motor)

With BeaverworX last year, we used Method 1; TWO quadrature encoders were used, one for the left side, one for the right side.

1. Set the "setpoint" for the encoders as the "Axis-X" of the joystick
2. Do some math to find a conversion factor so that at the left-most (or the right-most) value of Axis-X becomes the setpoint for a 90 degree turn to the left (or to the right, if you're using right-most value from x-axis)

The math is this:
Conversion factor = (Leftmost value of X-Axis) / (Number of pulses per 1 revolution/4)

*watch the brackets
*the conversion factor is an absolute value
*make sure at the original position, all wheels point straight ahead (not angled), at this point, the encoder reading is set to 0.
*The values of X-Axis should be from -128 to +128 or a range of numbers from negative to positive. If not, convert it so it is, this makes programming smooooooooooooooooooooooother

SETPOINT = (Value of Axis-X) / Conversion Factor

3. Once you have a setpoint, use that number as the SETPOINT for your PID motor control to turn the module.

4. Tune your PID constants

Now, if you want to control the wheel rotation speed as well as well its swerve using one joystick with two axes (x and y), it is possible (2609 used last year). The algorithm is a bit more complicated in which I wont get into if it's not something you'd like to have.

I hope you're using Labview. You can create some panels to make the tuning part fairly easier.

First time programming this could take around 5~10 hours, including tuning.

Good luck,
Pie Man
__________________
-Northern Knights 296
-Beaverworx 2609

Last edited by Guopeter : 15-01-2010 at 18:22.
  #8   Spotlight this post!  
Unread 16-01-2010, 09:29
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,086
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: Swerve Drive

Our team did swerve drive last year, the math for doing it isn't too bad. We found that the harder problem was that we ended up with (essentially) 4 custom servos, and getting them all to line up properly was the harder problem since we were using 2 different sets of motors, and we weren't using absolute encoders (dont ask).

Our C++ code from last year is available at my website: http://www.virtualroadside.com/FRC/

Quote:
I hope you're using Labview. You can create some panels to make the tuning part fairly easier.
I created a tool in C++ called WebDMA (http://code.google.com/p/webdma/), that installs a webserver on the robot, which integrates easily with your code and allows you to do tuning tasks. Its quite nice. Theres a demo of the interface on the project site.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
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
Swerve Drive Team1710 Technical Discussion 11 07-03-2009 09:58
Swerve drive 4, 2+2? kirtar Technical Discussion 18 02-04-2008 06:58
A Swerve Drive Question lndnny Technical Discussion 10 20-07-2006 08:09
Swerve Drive on a Jeep Karthik Math and Science 3 01-02-2005 17:50
Swerve Drive Jeff Waegelin Technical Discussion 14 17-09-2001 08:06


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

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