Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Introducing SwagDrive. The drive code of the future. (http://www.chiefdelphi.com/forums/showthread.php?t=116538)

drkabob 04-29-2013 11:42 PM

Introducing SwagDrive. The drive code of the future.
 
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. 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 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 04-29-2013 11:44 PM

Re: Introducing SwagDrive. The drive code of the future.
 
This is truly innovative. Can't wait to run it at IRI.

dcarr 04-29-2013 11:46 PM

Re: Introducing SwagDrive. The drive code of the future.
 
Pics/vids or shenanigans.

BigJ 04-29-2013 11:55 PM

Re: Introducing SwagDrive. The drive code of the future.
 
Sounds like the perfect drive for Tem 254: Teh Chesy Pofs.

blackflame2996 04-30-2013 12:04 AM

Re: Introducing SwagDrive. The drive code of the future.
 
I don't know if we would tell the difference; our driver drives like that anyway.

AlecMataloni 04-30-2013 12:26 AM

Re: Introducing SwagDrive. The drive code of the future.
 
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 04-30-2013 12:32 AM

Re: Introducing SwagDrive. The drive code of the future.
 
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 04-30-2013 01:57 AM

Re: Introducing SwagDrive. The drive code of the future.
 
Can someone please actually do this?

Michael Hill 04-30-2013 06:35 AM

Re: Introducing SwagDrive. The drive code of the future.
 
Quote:

Originally Posted by blackflame2996 (Post 1269813)
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 04-30-2013 06:59 AM

Re: Introducing SwagDrive. The drive code of the future.
 
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 04-30-2013 07:10 AM

Re: Introducing SwagDrive. The drive code of the future.
 
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 04-30-2013 07:20 AM

Re: Introducing SwagDrive. The drive code of the future.
 
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 04-30-2013 02:46 PM

Re: Introducing SwagDrive. The drive code of the future.
 
highest # of posts to rep ratio I've ever seen. well done sir.

JesseK 04-30-2013 03:12 PM

Re: Introducing SwagDrive. The drive code of the future.
 
This is almost as cool as a triple-Killough nona-drive.

Gregor 04-30-2013 04:02 PM

Re: Introducing SwagDrive. The drive code of the future.
 
Quote:

Originally Posted by Adrian Clark (Post 1270143)
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. ;)

JohnFogarty 04-30-2013 04:07 PM

Re: Introducing SwagDrive. The drive code of the future.
 
The robnots are already using this I promise.

Yipyapper 04-30-2013 04:07 PM

Re: Introducing SwagDrive. The drive code of the future.
 
#suchshot
#sopiston

JohnFogarty 04-30-2013 04:14 PM

Re: Introducing SwagDrive. The drive code of the future.
 
#sonasa
#clingcnthldus
#printsohard

pmangels17 04-30-2013 05:05 PM

Re: Introducing SwagDrive. The drive code of the future.
 
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 04-30-2013 05:30 PM

Re: Introducing SwagDrive. The drive code of the future.
 
any chance we could get a hold of some c++ up in here?

dubiousSwain 04-30-2013 05:33 PM

Re: Introducing SwagDrive. The drive code of the future.
 
forked. may try to port it to c++ if i get really bored

apalrd 04-30-2013 05:45 PM

Re: Introducing SwagDrive. The drive code of the future.
 
C:

Code:

//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 04-30-2013 05:51 PM

Re: Introducing SwagDrive. The drive code of the future.
 
Quote:

Originally Posted by apalrd (Post 1270315)
C:

Code:

//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 04-30-2013 06:06 PM

Re: Introducing SwagDrive. The drive code of the future.
 
I'm going to try this code on a Vex robot and post video!

rachelholladay 04-30-2013 06:26 PM

Re: Introducing SwagDrive. The drive code of the future.
 
Quote:

Originally Posted by Greg McKaskle (Post 1269883)
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..

Quote:

Originally Posted by Gregor (Post 1270204)
Sorry, I don't think anyone will ever come close to this. ;)

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

JohnFogarty 04-30-2013 06:34 PM

Re: Introducing SwagDrive. The drive code of the future.
 
I heard that the next robot controller can be programmed with lolcode.

FrankJ 04-30-2013 06:41 PM

Re: Introducing SwagDrive. The drive code of the future.
 
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 04-30-2013 06:42 PM

Re: Introducing SwagDrive. The drive code of the future.
 
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 04-30-2013 06:44 PM

Re: Introducing SwagDrive. The drive code of the future.
 
I want swagswerve

themccannman 04-30-2013 07:01 PM

Re: Introducing SwagDrive. The drive code of the future.
 
Quote:

Originally Posted by Woolly (Post 1270376)
I want swagswerve

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

Woolly 04-30-2013 07:06 PM

Re: Introducing SwagDrive. The drive code of the future.
 
Quote:

Originally Posted by themccannman (Post 1270385)
Whoa, dude that's gonna be way to much swag.

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

TrevorKN 04-30-2013 07:34 PM

Re: Introducing SwagDrive. The drive code of the future.
 
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 04-30-2013 07:57 PM

Re: Introducing SwagDrive. The drive code of the future.
 
Quote:

Originally Posted by saikiranra (Post 1270374)
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!

Quote:

Originally Posted by FrankJ
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. Try tuning the swag-constants?

Alexa Stott 05-01-2013 12:38 AM

Re: Introducing SwagDrive. The drive code of the future.
 
Quote:

Originally Posted by John_1102 (Post 1270366)
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 05-01-2013 01:34 AM

I mean who does want to write their code like this...
[code]
CANHAZ.VICTOR;
GIMME.VICTOR;
VROOMVROOM.VICTOR(1);
KTHNXBAI;
[\CODE]

Chadfrom308 05-01-2013 07:48 AM

Re: Introducing SwagDrive. The drive code of the future.
 
Quote:

Originally Posted by TrevorKN (Post 1270407)
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 05-01-2013 09:26 AM

Re: Introducing SwagDrive. The drive code of the future.
 
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 05-01-2013 09:31 AM

Re: Introducing SwagDrive. The drive code of the future.
 
this has to be the best thread ever made.

JohnFogarty 05-01-2013 10:23 AM

1 Attachment(s)
Sounds like the Alaskan FTC team I met at world. They used 18 wheel HOLOSWAG drive. Attachment 14765

coalhot 05-01-2013 01:09 PM

Re: Introducing SwagDrive. The drive code of the future.
 
Sorry guys, but someone already did SwagDrive.

heh heh heh

depth_Finder 05-01-2013 02:53 PM

Re: Introducing SwagDrive. The drive code of the future.
 
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 05-01-2013 03:19 PM

Re: Introducing SwagDrive. The drive code of the future.
 
Quote:

Originally Posted by John_1102 (Post 1270366)
I heard that the next robot controller can be programmed with lolcode.

I was voting for J. For those of you unfamiliar, here's a sample:
Code:

fibUpTo =: (],}:@]`]@.>&(+/@{.~&_2))^:_&0 1
Obviously, this defines a function which returns an array of all Fibonacci numbers up to the argument you provide.

Mykey 05-01-2013 03:23 PM

Re: Introducing SwagDrive. The drive code of the future.
 
The SwagDrive seems to go very well with the spinners we are sportin'.

Kevin Sevcik 05-01-2013 03:52 PM

Re: Introducing SwagDrive. The drive code of the future.
 
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 05-02-2013 07:54 AM

Re: Introducing SwagDrive. The drive code of the future.
 
Quote:

Originally Posted by coalhot (Post 1270755)
Sorry guys, but someone already did SwagDrive.

heh heh heh

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

coalhot 05-02-2013 10:17 AM

Re: Introducing SwagDrive. The drive code of the future.
 
Quote:

Originally Posted by Chadfrom308 (Post 1271215)
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 05-03-2013 06:42 PM

Re: Introducing SwagDrive. The drive code of the future.
 
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 05-04-2013 01:58 AM

Re: Introducing SwagDrive. The drive code of the future.
 
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 05-04-2013 04:41 PM

Re: Introducing SwagDrive. The drive code of the future.
 
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 05-04-2013 07:35 PM

Re: Introducing SwagDrive. The drive code of the future.
 
Quote:

Originally Posted by Hypnotoad (Post 1272083)
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 05-04-2013 07:36 PM

Re: Introducing SwagDrive. The drive code of the future.
 
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 08-04-2013 10:29 PM

Re: Introducing SwagDrive. The drive code of the future.
 
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 01-04-2014 09:26 AM

Re: Introducing SwagDrive. The drive code of the future.
 
Is swag drive ready for 2014?

Hypnotoad 01-04-2014 09:35 AM

Re: Introducing SwagDrive. The drive code of the future.
 
Team 696 will have code ready in a few days.Will post when swag constants are tuned.

one4robots 01-25-2014 05:59 PM

Re: Introducing SwagDrive. The drive code of the future.
 
I think we used something similar last year.


All times are GMT -5. The time now is 12:19 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi