|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#31
|
||||
|
||||
|
Re: Limit Swtich Help
Quote:
When you press button 1, spike1 goes in reverse and spike2 goes to kOn? When you press button 4, which spike goes to kForward: spike1 or spike2? What does the other do? Whichever goes to kForward, are you saying that it is now stuck in the kForward state no matter which buttons you push? When you say yellow, is that possibly orange? The manual says that the possible colors are red, green, and orange. Do you see all three of those colors and a yellow? In addition to checking the orientation of the PWM cable, check the power leads (both into the spikes and then out of the spikes) so that you are correctly getting power to power and ground to ground. |
|
#32
|
|||
|
|||
|
Re: Limit Swtich Help
Quote:
|
|
#33
|
||||
|
||||
|
Re: Limit Swtich Help
This is really sounding like a wiring issue, it's definitely not something in the code you posted. Can you post a pic of your wiring?
|
|
#34
|
|||
|
|||
|
Re: Limit Swtich Help
Tomorrow afternoon I will post one.
|
|
#35
|
||||
|
||||
|
Re: Limit Swtich Help
I agree 100% with Jon...you construct the two objects in the same way (so they should default to the same settings) and you call the same methods on the objects under the same conditions. When you look at the wires, check all power inputs and outputs as well as the PWM wires. I hate to be a software guy that blames the hardware, but...
|
|
#36
|
|||
|
|||
|
Re: Limit Swtich Help
Quote:
|
|
#37
|
||||
|
||||
|
Re: Limit Swtich Help
Sweet! Congrats on successfully troubleshooting the problem. I hope that you haven't torn too much hair out
![]() |
|
#38
|
|||
|
|||
|
Re: Limit Swtich Help
lol yeah It's just a part of the process I guess... anyway thanks for all of the help.
|
|
#39
|
|||
|
|||
|
Re: Limit Swtich Help
I have one final question, I noticed that when my victors are set in reverse and I press the limit switch the victors don't stop very well. Is there anyway to fix this or is it fine the way it is. Here's the code
Code:
public void operatorControl() {
while (isOperatorControl() && isEnabled()) {
double leftaxis = xbox.getRawAxis(1);
robot.arcadeDrive(stick.getY() * 0.5, stick.getX() * 0.5); //Change the 0.5 for sensitivity, I removed get throttle I may need it again.
limitPressed = limit.get();
limitPressed2 = limit2.get();
limitPressed3 = limit3.get();
limitPressed4 = limit4.get();
/*limitPressed will be the bottom of the lead screw.
* limitPressed2 will be the top of the lead screw.
* limitPressed3 will the for the left minimum arm distance.
* limitPressed4 will be for the max arm distance.
* The print lines are helpful for testing boolean states.
//System.out.println("limitPressed=" + limitPressed); //Read the RoboRIO log for some values.
//System.out.println("limitPressed2=" + limitPressed2);
//System.out.println("limitPressed3=" + limitPressed3);
//System.out.println("limitPressd4=" + limitPressed4);
*/
if(limitPressed || limitPressed2 == false || limitPressed3 == false || limitPressed4 == false) {
victor1.set(0);
victor2.set(0);
} else if (-leftaxis > 0.5) {
victor1.set(1);
victor2.set(1);
} else {
victor1.set(0);
victor2.set(0);
}
if(leftaxis > 0.5) {
victor1.set(-1);
victor2.set(-1);
} else {
victor1.set(0);
victor2.set(0);
}
if(xbox.getRawButton(4)) {
spike1.set(Relay.Value.kForward);
spike2.set(Relay.Value.kForward);
} else if(xbox.getRawButton(1)) {
spike1.set(Relay.Value.kReverse);
spike2.set(Relay.Value.kReverse);
} else {
spike1.set(Relay.Value.kOff);
spike2.set(Relay.Value.kOff);
}
}
}
|
|
#40
|
||||
|
||||
|
Re: Limit Swtich Help
Quote:
|
|
#41
|
|||
|
|||
|
Re: Limit Swtich Help
Sorry, I hate to sound like a complete rookie but how can I change the jumpers setting?
|
|
#42
|
||||
|
||||
|
Re: Limit Swtich Help
Quote:
Type "Victor" into the search box. Click on the link for Victor888 (or SP). Find the link for the user manual and click on it. Search for "brake". Follow the instructions you find there. Last edited by Ether : 06-02-2015 at 22:13. |
|
#43
|
|||
|
|||
|
Re: Limit Swtich Help
Thank's I will try the break setting on Monday.
|
|
#44
|
||||
|
||||
|
Re: Limit Swtich Help
Stay away from the break setting. Try the brake setting instead.
|
|
#45
|
||||
|
||||
|
Re: Limit Swtich Help
While the brake setting will help, it may not be your issue. It depends on what, exactly, the behavior is.
Take a look at this portion of the code: Code:
if(limitPressed || limitPressed2 == false || limitPressed3 == false || limitPressed4 == false) {
victor1.set(0);
victor2.set(0);
} else if (-leftaxis > 0.5) {
victor1.set(1);
victor2.set(1);
} else {
victor1.set(0);
victor2.set(0);
}
if(leftaxis > 0.5) {
victor1.set(-1);
victor2.set(-1);
} else {
victor1.set(0);
victor2.set(0);
}
There are two if/else blocks here. The first one controls going up, the second going down, I assume. However, your limit switch at the bottom of the lead screw is being checked in the first if statement. What this may be doing is telling your motors to stop in the first if statement, then in the second telling them to go down. So you end up with a fast oscillation between stop and down. When I'm working with a motor, I try to combine all control of the motor into a single if/else block, or in a single set command, just to make sure I don't get into a situation where I'm telling it two different things every loop through. For this situation, I might do something like: Code:
if (operator says to go up AND I haven't hit the top limit switch yet)
{
go up
}
else if (operator says to go down AND I haven't hit the bottom limit switch yet)
{
go down
}
else
{
stop
}
![]() Also, check the third and fourth limit switches... your comments say they are for controlling left to right motion of the gripper, but in your code they're set up to work with the up/down motion of the elevator. Are you controlling the left/right motion with the relays? If so, you'll want to work those into the if/else block that deals with the relays! |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|