Log in

View Full Version : Introducing SwagDrive. The drive code of the future.


drkabob
29-04-2013, 23:42
So I attended the World Championships this year. It was great seeing all these high level robots. However, I had a problem with them, they drove too straight. They drove with too much precision. There was no sense of "YOLO", the robots did not drive with enough swag.

So I decided to remedy this issue at the programming level, by creating SwagDrive. SwagDrive increases the robot's level of swag by at least ten-fold. By using new and innovative algorithms (or rather "swagorithms"), SwagDrive decreases the robot's consistency and accuracy so that when it drives on the playing field it looks a lot cooler.

It is similar to ArcadeDrive with some important modifications. If the change on an axis is not larger than the "swag barrier", it will multiplied by the "swag multiplier" in order to "swag up" the driver's inputs. If the input is larger then the "swag barrier" for that particular cycle, then the robot's "swag level" increases by one. If the "swag level" becomes over 9000 the robot enters a moment of ultimate swag and rotates for one "swag period" (truly a YOLO move). Many of these values still need to be tuned and modified to achieve optimal swag.

You can find an example implementation written in Java by clicking here (https://gist.github.com/drkabob/4a3dad13601a95a9e39b). While I have yet to test SwagDrive on a real robot, I can assure you that it will swag up your robot.

I look forward to your comments and hope that we can improve SwagDrive for future competitions.

(If you haven't figured it out yet, this is a joke. You can find 1836's robot code here (https://github.com/Sinani201/UltAscent1836) by our main coder. I would strongly recommend not using the SwagDrive code on your robot, as you will likely lose control and possibly hurt the robot and the people around it.)

connor.worley
29-04-2013, 23:44
This is truly innovative. Can't wait to run it at IRI.

dcarr
29-04-2013, 23:46
Pics/vids or shenanigans.

BigJ
29-04-2013, 23:55
Sounds like the perfect drive for Tem 254: Teh Chesy Pofs.

blackflame2996
30-04-2013, 00:04
I don't know if we would tell the difference; our driver drives like that anyway.

AlecMataloni
30-04-2013, 00:26
What happens when everything becomes fully swagged out? Also, does my robot need to have collar-popping functionality to use every feature? Otherwise, looks like it's pretty easy to turn my swag on even as a rookie.

I should totally try this out. I don't know much about code, but oh well , you only live once.

saikiranra
30-04-2013, 00:32
I guess it won't be much of a change compared to us veering right when sending an only forward signal...

This would have been perfect for Team Harlem Shake videos.




We will be testing this tomorrow.

Jackladd
30-04-2013, 01:57
Can someone please actually do this?

Michael Hill
30-04-2013, 06:35
I don't know if we would tell the difference; our driver drives like that anyway.

Just multiply the inputs by -1 and it's drive CORRECTING code.

thinker&planner
30-04-2013, 06:59
We already have a program that does this, because we have mecanum wheels and a gyro, we spin in circles down the field. We haven't actually used this in a match (except for a mishap with our autonomous in a practice match (http://www.theroboshow.net/ ep.1 about 10:00)), but at public events it is great.

2789_B_Garcia
30-04-2013, 07:10
I've been working on a holla-nomic drive train where the wheels are angled to give alliance partners rep, props and street cred, but I've run into some electrical feedback problems with the wheels giving the props only to the chassis that they are mounted to...I've been calling this phenomenon "hollaback" lol

Greg McKaskle
30-04-2013, 07:20
One of the CSA's told a story at dinner about a team with a robot that would inexplicably stutter. They search the code looking for parallel updates to motors, bad math, etc.

They ultimately stumbled across a parallel VI stuck in the corner named "Harlem Shake". Not sure who the joke was on, but its one they will remember for awhile.

Greg McKaskle

Adrian Clark
30-04-2013, 14:46
highest # of posts to rep ratio I've ever seen. well done sir.

JesseK
30-04-2013, 15:12
This is almost as cool as a triple-Killough nona-drive.

Gregor
30-04-2013, 16:02
highest # of posts to rep ratio I've ever seen. well done sir.

Sorry, I don't think anyone will ever come close to this. (http://www.chiefdelphi.com/forums/showthread.php?p=1175817#post1175817) ;)

JohnFogarty
30-04-2013, 16:07
The robnots are already using this I promise.

Yipyapper
30-04-2013, 16:07
#suchshot
#sopiston

JohnFogarty
30-04-2013, 16:14
#sonasa
#clingcnthldus
#printsohard

pmangels17
30-04-2013, 17:05
Add in pneumatic cylinders to the wheels and bumpers, and when the "swag barrier" is broken, have the robot slow down, drop down the back bumper, and lift up the front wheels. Instant thug life rollin'.

Sparkyshires
30-04-2013, 17:30
any chance we could get a hold of some c++ up in here?

dubiousSwain
30-04-2013, 17:33
forked. may try to port it to c++ if i get really bored

apalrd
30-04-2013, 17:45
C:


//Constants
#define SWAG_BARRIER 0.1
#define SWAG_GAIN 1
#define SWAG_MAX 9000
#define SWAG_PERIOD 500

//Local variables
double old_throttle = 0;
double old_wheel = 0;
double diff_throttle = 0;
double diff_wheel = 0;
double out_throttle;
double out_wheel;
int swag_level = 0;
int swag_period = 0;

//SwagDrive
void SwagDrive(double throttle, double wheel, double* left, double* right)
{
out_throttle = throttle;
out_wheel = wheel;

if(0 == swag_period)
{
diff_throttle = abs(throttle) + abs(old_throttle);
diff_wheel = abs(wheel) + abs(old_wheel);
if(diff_throttle < SWAG_BARRIER)
{
out_throttle = (diff_throttle * SWAG_GAIN) + throttle;
}
else
{
swag_level++;
}
if(diff_wheel < SWAG_BARRIER)
{
out_wheel = (diff_wheel * SWAG_GAIN) + wheel;
}
else
{
swag_level++;
}

if(swag_level > SWAG_MAX)
{
swag_period = SWAG_PERIOD;
swag_level = 0;
}
}
else
{
out_throttle = 0;
out_wheel = 0;
}

//arcade drive
left = out_throttle + out_wheel;
right = out_throttle - out_wheel;

old_throttle = throttle;
old_wheel = wheel;
}

dubiousSwain
30-04-2013, 17:51
C:


//Constants
#define SWAG_BARRIER 0.1
#define SWAG_GAIN 1
#define SWAG_MAX 9000
#define SWAG_PERIOD 500

//Local variables
double old_throttle = 0;
double old_wheel = 0;
double diff_throttle = 0;
double diff_wheel = 0;
double out_throttle;
double out_wheel;
int swag_level = 0;
int swag_period = 0;

//SwagDrive
void SwagDrive(double throttle, double wheel, double* left, double* right)
{
out_throttle = throttle;
out_wheel = wheel;

if(0 == swag_period)
{
diff_throttle = abs(throttle) + abs(old_throttle);
diff_wheel = abs(wheel) + abs(old_wheel);
if(diff_throttle < SWAG_BARRIER)
{
out_throttle = (diff_throttle * SWAG_GAIN) + throttle;
}
else
{
swag_level++;
}
if(diff_wheel < SWAG_BARRIER)
{
out_wheel = (diff_wheel * SWAG_GAIN) + wheel;
}
else
{
swag_level++;
}

if(swag_level > SWAG_MAX)
{
swag_period = SWAG_PERIOD;
swag_level = 0;
}
}
else
{
out_throttle = 0;
out_wheel = 0;
}

//arcade drive
left = out_throttle + out_wheel;
right = out_throttle - out_wheel;

old_throttle = throttle;
old_wheel = wheel;
}
thank you

z_beeblebrox
30-04-2013, 18:06
I'm going to try this code on a Vex robot and post video!

rachelholladay
30-04-2013, 18:26
One of the CSA's told a story at dinner about a team with a robot that would inexplicably stutter. They search the code looking for parallel updates to motors, bad math, etc.

They ultimately stumbled across a parallel VI stuck in the corner named "Harlem Shake". Not sure who the joke was on, but its one they will remember for awhile.

Greg McKaskle

I'm really hoping someone took a screenshot of that VI. I'd be really interested to see what the VI had and then using it..

Sorry, I don't think anyone will ever come close to this. (http://www.chiefdelphi.com/forums/showthread.php?p=1175817#post1175817) ;)

I think Frank Merrick would be able come close / surpass.

JohnFogarty
30-04-2013, 18:34
I heard that the next robot controller can be programmed with lolcode.

FrankJ
30-04-2013, 18:41
It doesn't. We tried it & our robot went straighter. It apparently counteracted our mechanum's natural squirrellyness. It did turn it into a pretty good pusher though. :confused:

saikiranra
30-04-2013, 18:42
We modified the code today to provide us with more #YOLO strength. We will be testing this on Thursday, and will hopefully film our results.

Woolly
30-04-2013, 18:44
I want swagswerve

themccannman
30-04-2013, 19:01
I want swagswerve

Whoa, dude that's gonna be way to much swag.

Woolly
30-04-2013, 19:06
Whoa, dude that's gonna be way to much swag.

Is there such a thing as too much swag? YOLO!

TrevorKN
30-04-2013, 19:34
If you watch some of our early matches at champs, you'll see that we already have implemented SWAG-drive in autonomous. In fact, our robot YOLOs so hard it does drive-bys on the refs.

drkabob
30-04-2013, 19:57
We modified the code today to provide us with more #YOLO strength. We will be testing this on Thursday, and will hopefully film our results.

Its good to see some people modifying and optimizing the "swagorithms" to achieve optimal-swag. I'm regretting putting the code on a GitHub gist as opposed to a dedicated Git repo, but if you could send the code back in any form I would really appreciate it and I'll be sure to credit you!

It doesn't. We tried it & our robot went straighter. It apparently counteracted our mechanum's natural squirrellyness. It did turn it into a pretty good pusher though.

Wat. (http://www.youtube.com/watch?v=THERgYM8gBM) Try tuning the swag-constants?

Alexa Stott
01-05-2013, 00:38
I heard that the next robot controller can be programmed with lolcode.

Really?

I've been waiting for years to be able to program robots in Chef. Thought that or Shakespeare would've come first at the very least. I also would've been fine with a whitespace implementation. But lolcode?! Ugh.

FIRST just doesn't seem to care about those of us that prefer esoteric programming languages.

JohnFogarty
01-05-2013, 01:34
I mean who does want to write their code like this...
[CODE]
CANHAZ.VICTOR;
GIMME.VICTOR;
VROOMVROOM.VICTOR(1);
KTHNXBAI;
[\CODE]

Chadfrom308
01-05-2013, 07:48
If you watch some of our early matches at champs, you'll see that we already have implemented SWAG-drive in autonomous. In fact, our robot YOLOs so hard it does drive-bys on the refs.

wow this is amazing

ace94x
01-05-2013, 09:26
I have been working on something like what you are, if you have ever seen the beginning of Speed Racer, on that wicked track, and how the car flips around, I have created and tested on small robots, a formula to do exactly that.

I used FTC parts to create this system but to get it fully working there are 8wheels instead of 4,

4 are swerve drive wheels and 2 are omni and 2 are tread, the small FTC bot can now run perfectly like the Speed Racer car, and is still very fast at zipping around the field. I am in the process of tweaking it so that it works flawless ly, because right now if I want to do an up-spin, it goes straight for about 2sec then does the spin, that is just one up the many errors...

S2K JDM
01-05-2013, 09:31
this has to be the best thread ever made.

JohnFogarty
01-05-2013, 10:23
Sounds like the Alaskan FTC team I met at world. They used 18 wheel HOLOSWAG drive. 14765

coalhot
01-05-2013, 13:09
Sorry guys, but someone already did SwagDrive.

heh heh heh (http://www.youtube.com/watch?v=5MgdGtwQQIo)

depth_Finder
01-05-2013, 14:53
QWOP drive is the TRUE drive train of the future. For those of you who do not know of QWOP drive, click this link http://www.foddy.net/Athletics.html

Ginto8
01-05-2013, 15:19
I heard that the next robot controller can be programmed with lolcode.

I was voting for J (http://www.jsoftware.com/). For those of you unfamiliar, here's a sample:
fibUpTo =: (],}:@]`]@.>&(+/@{.~&_2))^:_&0 1
Obviously, this defines a function which returns an array of all Fibonacci numbers up to the argument you provide.

Mykey
01-05-2013, 15:23
The SwagDrive seems to go very well with the spinners we are sportin'.

Kevin Sevcik
01-05-2013, 15:52
I have no idea what this code does. All I know is there better not be any robots doing it on my lawn. *shakes cane*

Chadfrom308
02-05-2013, 07:54
Sorry guys, but someone already did SwagDrive.

heh heh heh (http://www.youtube.com/watch?v=5MgdGtwQQIo)

I wasn't around for 2004, but what is the point of that, it seems like, literally pointless... No offense or anything

coalhot
02-05-2013, 10:17
I wasn't around for 2004, but what is the point of that, it seems like, literally pointless... No offense or anything

Watch the whole video, they use the drive for what it was intended near the end.

Still pretty sick...

Hypnotoad
03-05-2013, 18:42
So i got the code to work. Its actually not terrible to drive. unfortunately, the driver has to have enough SWAG to make use of the YOLO move. I myself was only able to make use of it once since I am on programming team and don't have enough swag. Saikranra should post a video soon, if not, someone else should.

I had to tune the MAX_SWAG_LEVEL to about five hundred, since as I mentioned earlier, it is fairly difficult for someone like me to achieve a swag level of over 9000. If you wish, I could post the code later. Having it as a separate class was problematic, so i had to integrate it into the main code. Putting it back into a class would only do good if anyone else wants it.

Hypnotoad
04-05-2013, 01:58
Note. This isn't a processing caused error. This happens when we attempt to use network tables on the robot side too. Anyone familiar with this error?

techkid86
04-05-2013, 16:41
I like it! I was thinking something similar. our auto was working well enough to the point where I wanted the robot to do a full circle and then get auto points so our team can yell "NO SCOPE 360!" unfortunately, the rest of the team had doubts.... lol. anyway, this is epic, and is on my to do list. you know judges love swag.

drkabob
04-05-2013, 19:35
So i got the code to work. Its actually not terrible to drive. unfortunately, the driver has to have enough SWAG to make use of the YOLO move. I myself was only able to make use of it once since I am on programming team and don't have enough swag. Saikranra should post a video soon, if not, someone else should.

I had to tune the MAX_SWAG_LEVEL to about five hundred, since as I mentioned earlier, it is fairly difficult for someone like me to achieve a swag level of over 9000. If you wish, I could post the code later. Having it as a separate class was problematic, so i had to integrate it into the main code. Putting it back into a class would only do good if anyone else wants it.
I personally think that the SWAG_BARRIER is too high and SWAG_MULTIPLIER is too low, it would explain the "not too terrible to drive" part, as well as why it is so difficult to enter an "Ultimate #YOLOSWAG2013 Moment". I really need a kit-bot (and a lot of safety goggles) to test this on so I can tune the constants.

Joey Milia
04-05-2013, 19:36
After reading through this tread I thought it would be a great place to share an idea that 192 is thinking of prototyping in the fall and will certainly be using in the 2014 game.
Three wheel mecanumSwagSwerve. We came to this idea because swerve can do some crazy maneuvers but sometimes you just want to drive in a straight line, so we're going to use the mecanum wheels to cancel out the crazy swerve maneuvers. After thinking about it we realized all the great advantages of this new drive system. First the mecanum wheels will lower our CoF so that we can't stall our 6 cim drive tripping our main breaker #tehchesypofs. Second, we will only be using three mecanum wheels increasing our efficently during strafing, only three wheels sapping energy instead of four. Lastly, our drive team wanted as maneuverable a robot as possible and we decided that full independent swerve just didn't give us enough axes of movement so by using mecanum wheels we can now move in all three axes.

Our controls team was finding the swerve code they were working on a bit boring so I think this will provide a nice little challenge for them :)
#YOLO swag

Randaline
04-08-2013, 22:29
This is definitely great... So many of today's robots are deprived of the brilliance that is swag when I look on the field.

This should certainly advance the coolness level of any robot ;)

JohnFogarty
04-01-2014, 09:26
Is swag drive ready for 2014?

Hypnotoad
04-01-2014, 09:35
Team 696 will have code ready in a few days.Will post when swag constants are tuned.

one4robots
25-01-2014, 17:59
I think we used something similar last year.