Go to Post I see people show up to a competition with their masterpiece, and proud of it. They are inspired by what they have accomplished. To make it onto the field is a high-it is the culmination of the thousands of hours of dedication compromises and commitment. They feel on top of the world. That's FIRST. - fox46 [more]
Home
Go Back   Chief Delphi > Technical > Technical Discussion
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 12-08-2014, 21:08
cbale2000's Avatar
cbale2000 cbale2000 is offline
Registered User
AKA: Chris Bale
FRC #0703 (Phoenix)
Team Role: Leadership
 
Join Date: Apr 2006
Rookie Year: 2004
Location: Saginaw, MI
Posts: 919
cbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond reputecbale2000 has a reputation beyond repute
Re: Drivetrain Idea - "Box Drive"

Quote:
Originally Posted by nathannfm View Post
Impressive, probably the most practical way to do that too.

Thanks for that link, it made my day.
  #2   Spotlight this post!  
Unread 12-08-2014, 21:57
pimathbrainiac's Avatar
pimathbrainiac pimathbrainiac is offline
Today, Regionals. Tomorrow, Worlds.
AKA: Philip N
FRC #1127 (Lotus Robotics)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Milton HS
Posts: 49
pimathbrainiac can only hope to improve
Re: Drivetrain Idea - "Box Drive"

So if figured out the math/code for this using cjl2625's version of the drivetrain.

Here's a segment (Java, btw):
Code:
    final double DISTANCE_X = 1.0;
    final double DISTANCE_Y = 1.0;
    private double leftY;
    private double rightY;
    private double frontX;
    private double backX;
    //rotation is cw
    private double rotationX;
    private double rotationY;
    private double pi = 3.1415926;
    private double curr_gyro_angle_degrees = 0.0;
    private double curr_gyro_angle_radians = 0.0;
    private double temp;
    
    public void TakeJoystickInputsAndDrive(Joystick left, Joystick right)
    {
        calculatedDrive(-0.5 * left.getY(), 0.5 * left.getX(), 0.5 * right.getX());
    }
    
    void calculatedDrive(double y, double x, double rotation)
    {
        //Field-centric adjustments. Comment out for robot-centric.
        curr_gyro_angle_degrees = gyro1.getAngle();
        curr_gyro_angle_radians = curr_gyro_angle_degrees * pi/180; 
        temp = y * Math.cos(curr_gyro_angle_radians) - x * Math.sin(curr_gyro_angle_radians);
        x = y * Math.sin(curr_gyro_angle_radians) + x * Math.cos(curr_gyro_angle_radians);
        y = temp;
        
        rotationX = rotation * DISTANCE_X;
        rotationY = rotation * DISTANCE_Y;
        leftY = y - rotationY;
        rightY = y + rotationY;
        frontX = x - rotationX;
        backX = x + rotationX;
        drive(leftY, rightY, frontX, backX);
    }
    
    void drive(double y1, double y2, double x1, double x2)
    {
        //left, right
        robotDrive2Y.drive(y1, y2);
        //front, back
        robotDrive2X.drive(x1, x2);
    }
This code runs in a command called "DriveWithJoysticks," which is the default command for drivetrain.

Any problems with the code/math that you can see at the moment? I want to make sure this is sound before I pitch this to my team.
Closed Thread


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 07:43.

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