View Single Post
  #6   Spotlight this post!  
Unread 03-02-2016, 14:00
MaGiC_PiKaChU's Avatar
MaGiC_PiKaChU MaGiC_PiKaChU is offline
Drive Coach
AKA: Antoine L.
FRC #3360 (Hyperion)
Team Role: Mentor
 
Join Date: Mar 2014
Rookie Year: 2012
Location: Sherbrooke
Posts: 608
MaGiC_PiKaChU has a reputation beyond reputeMaGiC_PiKaChU has a reputation beyond reputeMaGiC_PiKaChU has a reputation beyond reputeMaGiC_PiKaChU has a reputation beyond reputeMaGiC_PiKaChU has a reputation beyond reputeMaGiC_PiKaChU has a reputation beyond reputeMaGiC_PiKaChU has a reputation beyond reputeMaGiC_PiKaChU has a reputation beyond reputeMaGiC_PiKaChU has a reputation beyond reputeMaGiC_PiKaChU has a reputation beyond reputeMaGiC_PiKaChU has a reputation beyond repute
Re: Is my Java code ok?

Quote:
Originally Posted by Lesafian View Post
Thank you, I'll fix that! As far as everything else does it look ok?
i guess the goal with using an axis for your sliding mechanism was to control the speed? Then you should use your joystick axis value instead of 1 and -1 (full speed)

also, your condition testing with Math.abs removes the negative sign, so your second if test will never work

This is how it could be made

Code:
// Move sliding mechanism forwards and backwards
			
                        //if your axis is not between -0.1 and 0.1
			if (Math.abs(xboxController.getRawAxis(5)) > .1) {
                               
                                //set your motor output to the axis value
				slideMotor.set(xboxController.getRawAxis(5));

			
			}else {
				slideMotor.set(0);
                        }
__________________
2012 - 3360 - Junior member
2013 - 3360 - Lead Programmer, Human player
2014 - 3360 - Lead Programmer, Human player
2015 - 3360 - Lead Programmer, Driver
2016 - 3360 - Mentor, Drive coach