View Single Post
  #10   Spotlight this post!  
Unread 17-09-2013, 21:04
ekapalka's Avatar
ekapalka ekapalka is offline
Registered User
FRC #3216
 
Join Date: Dec 2012
Location: Bermuda
Posts: 277
ekapalka has a spectacular aura aboutekapalka has a spectacular aura about
Re: Coasting Problems

Just for future reference, my favourite deadzone code looks something like this:
Code:
float deadZ (float val) {
	return val > 0.6 || val < -0.6? val: 0;
}
Then you would simply say something like 'tankDrive(deadZ(leftStick), deadZ(rightStick));'
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
Reply With Quote