![]() |
Coasting Problems
This summer, I switched my team's robot over from LabView to Java and have successfully moved everything over except for steering. When I attempt to drive with and then release the joysticks, the robot will began crawling in the direction it was previously moving.
From what I can tell, it's an issue reading in joystick values, for which I've set up some wiggle room with a pair of if statements. Unfortunately, the end values of the joysticks keep changing making it near impossible for me to set up a threshold. Any help is appreciated. Thanks in advance, Matt_4505 |
Re: Coasting Problems
You could post your code so others could help you troubleshoot, but first I suggest:
|
Re: Coasting Problems
The following assume you are using the RobotDrive VIs in LabVIEW and the robotDrive object in Java.
LabVIEW, by default, squares the inputs joystick inputs. This makes a small input value even smaller and might account for what you are seeing. The Java library also squares the joystick inputs by default, but makes it easier to change to not squaring. Which are you using? In the Java library, robot drive objects declare jaguars unless speed controller objects are passed to it. If you are using a different type of speed controller (eg Victor or Talon), you may see weird behavior like neutral offsets. In LabVIEW, it's more obvious how to change to the appropriate speed controller type. |
Re: Coasting Problems
I'm using the Java Library. My inputs are from the .getY() values of the joysticks. The motors are being controlled through: tankDrive(leftJoystickValue, rightJoystickValue). I have the values from the Joystick.getY() being fed to the dashboard to view them. They always seem to read between .1<->.3 when the joystick is released. Should I be using the route of the .getY() value to drive the robot?
|
Re: Coasting Problems
Can you elaborate more by what you mean by this:
Quote:
|
Re: Coasting Problems
My team also had this problem but it ended up just being the fact that our talons weren't zeroed, I know they should be fine on shipment, but for some reason that fixed our problems! The information for zeroing talons was in the 2013 control system pdf if i remember correctly
|
Re: Coasting Problems
Quote:
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); } |
Re: Coasting Problems
Quote:
Imagine the following scenario Code:
joystick output |
Re: Coasting Problems
Thank you for your help! I added to the code so the values are zeroed. I'm amazed that I missed that earlier.
|
Re: Coasting Problems
Just for future reference, my favourite deadzone code looks something like this:
Code:
float deadZ (float val) {To me this is the most aesthetically pleasing. But to each his own :P One thing I noticed that would also make it look better (my apologies, I'm really picky about these things) would be to assign 'Hardware.leftJoystick.getRawButton(1)' to a boolean somewhere in the beginning of your code so that you don't have to type that mess every time you need to check it. You could also make a similar method to the one above that takes your boolean as an input as well as a joystick value and clean up the code even more (there's currently a lot of code involved in just getting it to drive). Just my $0.02 :P Take it with a grain of salt |
Re: Coasting Problems
Thanks, I will definitely give those a try.
|
| All times are GMT -5. The time now is 22:34. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi