View Single Post
  #8   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,586
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