Go to Post FIRST is just a single step in a multi-step process. Rome wasn't built in a day, and neither are solutions to the world's problems. - Tim Baird [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
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
  #1   Spotlight this post!  
Unread 09-02-2014, 17:22
MichaelB MichaelB is offline
Registered User
FRC #3573 (The Ohms)
Team Role: Programmer
 
Join Date: Feb 2014
Rookie Year: 2011
Location: Conyers
Posts: 8
MichaelB is an unknown quantity at this point
Negative Joystick Values Don't Control Mecanum Wheels

In my team's mecanum drive system, negative joystick values don't control the wheels, while positive ones do. Can anyone help with this? I've tried looking in the WPILib code, but can't find anything that would do it.

Relevant code:
DriveWithJoystick
Code:
protected void execute() {
        double x = oi.getRightStick().getX();
        double y = oi.getRightStick().getY();
        double twist = ((oi.getLeftStick().getX())-0.5)*2; //This is because all the way to the left is being interpreted as 0, while all the way to the right is 1.
        driveTrain.driveWithJoystick(x, y, twist);
        lcd.println(DriverStationLCD.Line.kUser2, 1, "Y: " + ((int)(y*10))/10.0);
        lcd.println(DriverStationLCD.Line.kUser3, 1, "Y: " + ((int)(y*10))/10.0);
        lcd.println(DriverStationLCD.Line.kUser4, 1, "Twist: " + ((int)(twist*10))/10.0);
        lcd.updateLCD();
    }
DriveTrain
Code:
    public void driveWithJoystick(double x, double y, double twist) {
        //x = -((x - Robot3573.initialX) / (1 - Robot3573.initialX));
        //y = (y - Robot3573.initialY) / (1 - Robot3573.initialY);
        //twist = (twist - Robot3573.initialTwist) / (1 - Robot3573.initialTwist);
        x = x > RobotMap.joystickTolerance ? x : 0;
        y = y > RobotMap.joystickTolerance ? y : 0;
        twist = twist > RobotMap.joystickTolerance ? twist : 0;
        driveTrain.mecanumDrive_Cartesian(x,y,twist, 0);
        System.out.println("X: " + x + "Y: " + y + "Twist: " + twist);
        //driveTrain.mecanumDrive_Polar(x,y,twist);
    }
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 09:32.

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