Go to Post - Just because you can buy 50 giant pixie stix with your roommates Sam's club membership does not mean you should eat them all at once. - Not2B [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
  #7   Spotlight this post!  
Unread 17-09-2013, 12:54
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,602
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Coasting Problems

Quote:
Originally Posted by Matt_4505 View Post

Code:
public class DriveControl {
    double leftJoystickValue = 0;
    double rightJoystickValue = 0;
    
    /**
     * Controls the Joystick Read-in.
     * Reads the joystick values and directs values to the motors.
     */
    public void driveRobot() {

        if(Math.abs(Hardware.leftJoystick.getY()) > .25){
            leftJoystickValue = Hardware.leftJoystick.getY();
        }
        if(Math.abs(Hardware.rightJoystick.getY()) > .25){
            rightJoystickValue = Hardware.rightJoystick.getY();
        }
This code will make the speed controllers run at about 0.25 when the joystick ramps down.

Imagine the following scenario
Code:
joystick output
1        1
0.75     0.75
0.5      0.5
0.3      0.3
0.26     0.26
0.25     0.25
0.1      0.25
0.0      0.25
You need to explicitly set the value back to 0 when it is <= 0.25. The initialize to 0 at the top only occurs once.

Last edited by Joe Ross : 17-09-2013 at 16:14.
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 21: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