![]() |
Coding
Code:
/*----------------------------------------------------------------------------*/ |
Re: Coding
Quote:
From what I'm reading the robot will: Drive forward at 35% speed for 1 second. Wait one second. Turn on the shooter motor at full speed for one second. Wait 7 seconds. Without knowing what your shooter is I can't really tell you if it is correct or not. |
Re: Coding
Your teleop shooter is wrong, it should be like this
if(condition1) shooter.set(speed) else if(condition2) shooter.set(otherspeed) else shooter.set(0) endif the way you have it up is if(condition1) shooter.set(speed) else shooter.set(0) endif if(condition2) shooter.set(other) else shooter.set(0) endif If conditon1 is met, it will still be 0 because the second time around, its setting it to 0 |
Re: Coding
Quote:
|
Re: Coding
Quote:
|
Re: Coding
Quote:
|
Re: Coding
I want to make sure that you understand what Arhowk is trying to say, and make sure you made the change correctly. Your if-else statements are sending conflicting signals to the motor controllers. The Java Virtual Machine (JVM) will evaluate the two if statements separately the way you have them written. The first one will be evaluated, and send either a full-speed signal or stop motion signal. Then the second one will be evaluated, sending either a half-speed signal or a stop signal. This results in several possible combinations such as full-speed and zero, half-speed and zero, or full-speed and half-speed. The usual result of the first two is a jumpy motion where the movement stops and then starts again, especially if the button is held down.
Combining the code to have an else-if statement should prevent that paticular kind of jumpy motion. An else-if statement is evaluated as one statement, and will therefore only set your motor to one speed, rather than trying to set it to two speeds at once. The code for an else-if statement would look like this: Code:
if(stickDriverRight.getButton(Joystick.ButtonType.kTrigger)) {Code:
if(stickDriverRight.getButton(Joystick.ButtonType.kTrigger)) {Also, the more details you give us on what you're looking to do and the problems you're having, the more we can help:) |
| All times are GMT -5. The time now is 22:38. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi