|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Only One side of the "mock elevator" is working
When we have one of the two mock sides commented out they work but when placed together they don't work only one dose
**This is on a prototype for testing code** Jaguar E1 = new Jaguar(5); Jaguar E2 = new Jaguar(4); float Elivate = 1f; float Elivate2 = 1f; if(totestick.getRawButton(4)){ E1.set(-Elivate); E2.set(Elivate2); Relay1.set(Relay.Value.kForward); Relay2.set(Relay.Value.kReverse); }else if (totestick.getRawButton(1)){ // turns the elevator to Reverse E1.set(Elivate); E2.set(-Elivate2); Relay1.set(Relay.Value.kOff); Relay2.set(Relay.Value.kOn); } else { E1.set(0.0); E2.set(0.0); // else it is off } |
|
#2
|
|||||
|
|||||
|
Re: Only One side of the "mock elevator" is working
I'm trying to figure out what you're doing here.
Do you have two separate sides of the elevator which run in opposite directions to lift, controlled by jaguars? If so, it would probably make more sense to have the Elevator2 "constant" equal -1, then when you set the speeds, the code inside the loop is either both positive or both negative. Also, what is the function of the relays in your setup? Should you set them to some value when stopped? Finally, just to verify that you are only declaring/assigning objects to E1 and E2 once in initialization, not once per loop? Re-declaring controller and sensor objects repeatedly can cause them to work inconsistently as they cycle through shutdown and startup. Re-declaring the floats would be a waste of CPU cycles, but is less likely to be noticeable in terms of performance. Oh, also to verify -- java, right? Last edited by GeeTwo : 30-03-2015 at 10:22. |
|
#3
|
|||
|
|||
|
Re: Only One side of the "mock elevator" is working
The beginning part is set up during iterative robot then the if and else if loop is set up during the teleop Periodic the relays are for lights I just forgot to remove that part of the code
|
|
#4
|
||||
|
||||
|
Re: Only One side of the "mock elevator" is working
Have you checked the motor/jag connections to make sure they are the same polarity?
If so, and it jams while lifting, remove the negation from the second elevator jag. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|