Go to Post There's nothing like getting your butt kicked by the best! :D - Jared Russell [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Spotlight this post!  
Unread 20-01-2010, 15:26
byteit101's Avatar
byteit101 byteit101 is offline
WPILib maintainer (WPI)
AKA: Patrick Plenefisch
no team (The Cat Attack (Formerly))
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Worcester
Posts: 699
byteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of light
Re: Semi-Omni-Arcade Drive

what would be the average gyro drift for a 2 minute match?
Next meeting we are going to test a basic form of this. I wrote up a basic drive:
PHP Code:
(In Telopgy is a gyrodrive is a RobotDrivestick is a Joystick)
double offset=0;
double offset=0;
while (
IsOperatorControl())
{
    
//(1+cos(pi*x))/2; speed function
    //-xx+2x; turn function, graph these at http://www.walterzorn.com/grapher/grapher_e.htm
    
GetWatchdog().Feed();
    
float speed=0;
    
float turn=0;
    if (
stick.GetX()!=0&&stick.GetY()!=0)//UN Preliminary check for are we moving. this might be unnesecary?
    
{
        
//get the diff in the gyro and joystick, making sure no overflow occurs, and normalizing to 0 to 359
        
offset=((int)((int)(stick.GetDirectionDegrees()-(((int)(gy.GetAngle()*360))%360))+360)%360);
        
//Detect the location, and change speed/turn multipliers
        
switch ((int)(offset/90))
        {
            case 
0//top right
                
speed=1;
                
turn=1;
                break;
            case 
1//bottom right
                
speed=-1;
                
turn=1;
                break;
            case 
2//bottom left
                
speed=-1;
                
turn=-1;
                break;
            case 
3//top left
                
speed=1;
                
turn=-1;
                break;
            default: 
//should never occur, print error?
                
speed=1;
                
turn=1;
                break;
        }
        if (
offset>180)//start folding into 90 range
        
{
            
offset=fabs(offset-360);//escape greedy %
        
}
        
//bring into normalized values in 0-90 then 0-1
        
offset=((int)offset%90)/90;
       
        
speed*=((1+cos(Pi*offset))/2)*stick.GetMagnitude();//multiply turn (switch from above) times function, times speed
        
turn*=(-(offset*offset)+(2*offset))*offset;//multiply turn (switch from above) times function, times dir
    
}
    
drive.ArcadeDrive(speed,turn,false);//DRIVE!
    
Wait(0.01);                // wait for a motor update time (using victors)

__________________
Bubble Wrap: programmers rewards
Watchdog.Kill();
printf("Watchdog is Dead, Celebrate!");
How to make a self aware robot: while (∞) cout<<(sqrt(-∞)/-0);
Previously FRC 451 (The Cat Attack)
Now part of the class of 2016 at WPI & helping on WPILib
 


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
Programming Arcade Drive kyungjin C/C++ 4 06-04-2009 11:28
Arcade Drive Issue and Pnuematics chenvoy NI LabVIEW 10 23-02-2009 20:03
Arcade/Tank Drive Malfunction piedmont Programming 2 19-01-2009 17:37
Arcade Drive Anfony VEX 4 08-11-2006 19:46
vex programming arcade drive setting Michael Leicht FIRST Tech Challenge 3 17-10-2005 21:26


All times are GMT -5. The time now is 01:56.

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