Go to Post Our rookie drivers generally get their first "real match" experience at the Florida Regional which is usually a week 2 or week 3 event. That is a much easier "practice event" than IRI. - Kit Gerhart [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
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 08-17-2012, 01:41 PM
F22Rapture's Avatar
F22Rapture F22Rapture is offline
College Student, Mentor
AKA: Daniel A
FRC #3737 (4H Rotoraptors)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Goldsboro, NC
Posts: 476
F22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant future
Re: West Coast Drive Code

@Tom

How does one determine the "gain?" Trial and error, algorithms, etc?

Would something like this be correct?

Code:
// Xbox Controller    
    Joystick Xbox = new Joystick(1);  
           
    // Drivetrain
    public double throttle = Xbox.getRawAxis(3);
    public double turn = applyDeadband(Xbox);
    public double leftMtr = throttle + turn;
    public double rightMtr = throttle + turn;
    //This will need to be tuned
    public double gain = 1;

private double applyDeadband(Joystick Xbox) {
        if(Math.abs(Xbox.getRawAxis(1)) < 0.1) return 0;
        else return Xbox.getRawAxis(1);
    }

 private double skim(double v) {
  // gain determines how much to skim off the top
  if (v > 1.0)
    return -((v - 1.0) * gain);
  else if (v < -1.0)
    return -((v + 1.0) * gain);
  return 0;
}
    
    public double getLeftMotor() {
        return leftMtr + skim(rightMtr);
    }
    
    public double getRightMotor() {
        return rightMtr + skim(leftMtr);
    }
@ Ether what are the benefits of your method vs Tom's? What would that code look like in Java?

Last edited by F22Rapture : 08-17-2012 at 01:44 PM.
Reply With Quote
 


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


All times are GMT -5. The time now is 10:22 AM.

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