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)

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.


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