Go to Post Remind me to wear my kevlar vest to any event you're at. - Andrew Schreiber [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

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 17-01-2014, 20:11
weaversam8 weaversam8 is offline
Team Captain
AKA: Sam Weaver
FRC #4534 (Wired Wizards)
Team Role: Leadership
 
Join Date: Jan 2014
Rookie Year: 2014
Location: Wilmington, North Carolina
Posts: 137
weaversam8 is a splendid one to beholdweaversam8 is a splendid one to beholdweaversam8 is a splendid one to beholdweaversam8 is a splendid one to beholdweaversam8 is a splendid one to beholdweaversam8 is a splendid one to behold
Question Need Help With Robot Jumpyness

Hey guys!

(First post on CD, yay! )

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);
        }
        }
Reply With Quote
  #2   Spotlight this post!  
Unread 17-01-2014, 20:49
mwtidd's Avatar
mwtidd mwtidd is offline
Registered User
AKA: mike
FRC #0319 (Big Bad Bob)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 2003
Location: Boston, MA
Posts: 714
mwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond repute
Re: Need Help With Robot Jumpyness

Quote:
Originally Posted by weaversam8 View Post
Hey guys!

(First post on CD, yay! )

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.
__________________
"Never let your schooling interfere with your education" -Mark Twain

Last edited by mwtidd : 17-01-2014 at 20:56.
Reply With Quote
  #3   Spotlight this post!  
Unread 18-01-2014, 12:28
weaversam8 weaversam8 is offline
Team Captain
AKA: Sam Weaver
FRC #4534 (Wired Wizards)
Team Role: Leadership
 
Join Date: Jan 2014
Rookie Year: 2014
Location: Wilmington, North Carolina
Posts: 137
weaversam8 is a splendid one to beholdweaversam8 is a splendid one to beholdweaversam8 is a splendid one to beholdweaversam8 is a splendid one to beholdweaversam8 is a splendid one to beholdweaversam8 is a splendid one to behold
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.
Reply With Quote
Reply


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 12:42.

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