Go to Post I wouldn't trade my FIRST experiences for the world. - Koko Ed [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
  #6   Spotlight this post!  
Unread 17-09-2013, 12:43
Matt_4505 Matt_4505 is offline
Registered User
FRC #4505
Team Role: Programmer
 
Join Date: Nov 2012
Rookie Year: 2012
Location: United States
Posts: 16
Matt_4505 is on a distinguished road
Re: Coasting Problems

Quote:
Originally Posted by BigJ View Post
Can you elaborate more by what you mean by this:



To me that sounds like you're trying to set a deadzone, but I'm not sure.
Yep, that code is to set a deadzone, although since I have to keep increasing it's size, I'm losing a lot of mobility.

It might be an issue with zeroing the motor controllers, although, it works fine with Labview.

Heres the 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();
}

SmartDashboard.putNumber("leftJoystickValue", leftJoystickValue);
SmartDashboard.putNumber("righttJoystickValue", rightJoystickValue);

//decrease values by 3/4 for each trigger pressed
if (Hardware.leftJoystick.getRawButton(1)) {
leftJoystickValue = leftJoystickValue * (.75);
rightJoystickValue = leftJoystickValue * (.75);
}
SmartDashboard.putBoolean("leftJoystickTrigger Pressed", Hardware.leftJoystick.getRawButton(1));
//reduces values even more
if (Hardware.rightJoystick.getRawButton(1)) {
leftJoystickValue = leftJoystickValue * (.75);
rightJoystickValue = leftJoystickValue * (.75);
}
SmartDashboard.putBoolean("rigbhtJoystickTrigger Pressed", Hardware.rightJoystick.getRawButton(1)); //sends signal to bot with the adjusted drive values

Hardware.chassis.tankDrive(leftJoystickValue, rightJoystickValue);
}
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 10:43.

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