Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Need Help With Robot Jumpyness (http://www.chiefdelphi.com/forums/showthread.php?t=124808)

weaversam8 17-01-2014 20:11

Need Help With Robot Jumpyness
 
Hey guys!

(First post on CD, yay! :D )

I need some help making our robot less sensitive to the joystick, or some relative acceleration. I am using the basic tutorial code and an arcade drive.

Code:

RobotDrive chassis = new RobotDrive(1,2);
    Joystick main = new Joystick(1);

Code:

public void operatorControl() {
        chassis.setSafetyEnabled(true);
        while(isOperatorControl() && isEnabled()) {
       
          chassis.arcadeDrive(main);       
          Timer.delay(0.01);
        }
        }


mwtidd 17-01-2014 20:49

Re: Need Help With Robot Jumpyness
 
Quote:

Originally Posted by weaversam8 (Post 1328673)
Hey guys!

(First post on CD, yay! :D )

I need some help making our robot less sensitive to the joystick, or some relative acceleration. I am using the basic tutorial code and an arcade drive.

Code:

RobotDrive chassis = new RobotDrive(1,2);
    Joystick main = new Joystick(1);

Code:

public void operatorControl() {
        chassis.setSafetyEnabled(true);
        while(isOperatorControl() && isEnabled()) {
        double y = main.getY();
        //scale down the max y
        y = y * .6;
        double x = main.getX();
        //scale down the max x
        x = x * .6;
       
        //dynamically scale x
        if(x > 0){
            x = 1.0057*x*x - 0.0537*x + 0.0237;
        }else if (y < 0){
            x = -1.0057*x*x - 0.0537*x - 0.0237;
        }
       
        //dynamically scale y
        if(y > 0){
            y = 1.0057*y*y - 0.0537*y + 0.0237;
        }else if (y < 0){
            y = -1.0057*y*y - 0.0537*y - 0.0237;
        }
        chassis.arcadeDrive(y,x);   
          Timer.delay(0.01);
        }
        }


I've updated your code with a simple scalar function.

I just used excel and plotted a 2 order polynomial trendline.

Here are the scalars I used:

for less than 0:
in : out
-1 -1
-0.75 -0.5
-0.5 -0.25
-0.25 -0.12

0 0

for greater than 0:
in : out
0.25 0.12
0.5 0.25
0.75 0.5
1 1

If its still too fast I would start by reducing the starting scalar.

weaversam8 18-01-2014 12:28

Re: Need Help With Robot Jumpyness
 
Thanks, that worked! A note to anyone else who wants to use this, 0.6 is too low of a scale factor for the 2 motor long AM14u chassis, we use 0.9. Also, there was a small error in the code above, one place where it says Y is supposed to be X. I am sure you can see that easily. Thanks again everyone. :D


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

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi