Go to Post Incidentally, the best Delphi is ChiefDelphi! :) - Max Lobovsky [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #31   Spotlight this post!  
Unread 05-02-2015, 18:17
mmaunu's Avatar
mmaunu mmaunu is offline
Registered User
FRC #2485 (W.A.R. Lords)
Team Role: Mentor
 
Join Date: Mar 2013
Rookie Year: 2010
Location: San Diego, CA
Posts: 89
mmaunu is a jewel in the roughmmaunu is a jewel in the roughmmaunu is a jewel in the roughmmaunu is a jewel in the rough
Re: Limit Swtich Help

Quote:
Originally Posted by curtis0gj View Post
The issue is when I press button 1 one relay goes in reverse and the other goes to kOn (LED BLANK) and when I press button 4 it goes in kForward(GREEN). Also the spike is stuck in kForward because it's always green unlike the other which is yellow.
I'm trying to figure out exactly what the behavior is that you are describing. I think it would help to use the two variable names like spike1 and spike2.

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.
__________________
2014 Las Vegas (Winners with 987, 2478; Excellence in Engineering)
2014 San Diego (Finalists with 987, 3250; Quality Award)
2013 Inland Empire (Winners with 1538, 968; Excellence in Engineering Award)
2013 San Diego (Finalists with 2984, 4322; Creativity Award)
2012 Las Vegas (Finalists with 2034, 3187; Quality Award)
Reply With Quote
  #32   Spotlight this post!  
Unread 05-02-2015, 21:35
curtis0gj curtis0gj is offline
Registered User
FRC #5033 (Beavertronics)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Canada
Posts: 121
curtis0gj will become famous soon enough
Re: Limit Swtich Help

Quote:
Originally Posted by mmaunu View Post
I'm trying to figure out exactly what the behavior is that you are describing. I think it would help to use the two variable names like spike1 and spike2.

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.
Sorry for the confusion, basically when I press button 1 spike1 goes in kReverse and this is good, however, spike2 sets it self to kOn(No LED). When I release button 1 spike1 goes to the orange color but spike2 goes in kForward. When I press button 4 spike1 goes in kForward and this intended but spike2 also is in kForward but it was not activated by the button because it is always in kForward unless I press button 1 then it enters kOn until I release the button.
Reply With Quote
  #33   Spotlight this post!  
Unread 05-02-2015, 22:07
Jon Stratis's Avatar
Jon Stratis Jon Stratis is offline
Mentor, LRI, MN RPC
FRC #2177 (The Robettes)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Minnesota
Posts: 3,827
Jon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond repute
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?
__________________
2007 - Present: Mentor, 2177 The Robettes
LRI: North Star 2012-2016; Lake Superior 2013-2014; MN State Tournament 2013-2014, 2016; Galileo 2016; Iowa 2017
2015: North Star Regional Volunteer of the Year
2016: Lake Superior WFFA
Reply With Quote
  #34   Spotlight this post!  
Unread 05-02-2015, 22:21
curtis0gj curtis0gj is offline
Registered User
FRC #5033 (Beavertronics)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Canada
Posts: 121
curtis0gj will become famous soon enough
Re: Limit Swtich Help

Quote:
Originally Posted by Jon Stratis View Post
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?
Tomorrow afternoon I will post one.
Reply With Quote
  #35   Spotlight this post!  
Unread 06-02-2015, 00:42
mmaunu's Avatar
mmaunu mmaunu is offline
Registered User
FRC #2485 (W.A.R. Lords)
Team Role: Mentor
 
Join Date: Mar 2013
Rookie Year: 2010
Location: San Diego, CA
Posts: 89
mmaunu is a jewel in the roughmmaunu is a jewel in the roughmmaunu is a jewel in the roughmmaunu is a jewel in the rough
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...
__________________
2014 Las Vegas (Winners with 987, 2478; Excellence in Engineering)
2014 San Diego (Finalists with 987, 3250; Quality Award)
2013 Inland Empire (Winners with 1538, 968; Excellence in Engineering Award)
2013 San Diego (Finalists with 2984, 4322; Creativity Award)
2012 Las Vegas (Finalists with 2034, 3187; Quality Award)
Reply With Quote
  #36   Spotlight this post!  
Unread 06-02-2015, 14:52
curtis0gj curtis0gj is offline
Registered User
FRC #5033 (Beavertronics)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Canada
Posts: 121
curtis0gj will become famous soon enough
Re: Limit Swtich Help

Quote:
Originally Posted by mmaunu View Post
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...
I just pulled a spike out of last years bot and it works.
Reply With Quote
  #37   Spotlight this post!  
Unread 06-02-2015, 15:00
mmaunu's Avatar
mmaunu mmaunu is offline
Registered User
FRC #2485 (W.A.R. Lords)
Team Role: Mentor
 
Join Date: Mar 2013
Rookie Year: 2010
Location: San Diego, CA
Posts: 89
mmaunu is a jewel in the roughmmaunu is a jewel in the roughmmaunu is a jewel in the roughmmaunu is a jewel in the rough
Re: Limit Swtich Help

Quote:
Originally Posted by curtis0gj View Post
I just pulled a spike out of last years bot and it works.
Sweet! Congrats on successfully troubleshooting the problem. I hope that you haven't torn too much hair out
__________________
2014 Las Vegas (Winners with 987, 2478; Excellence in Engineering)
2014 San Diego (Finalists with 987, 3250; Quality Award)
2013 Inland Empire (Winners with 1538, 968; Excellence in Engineering Award)
2013 San Diego (Finalists with 2984, 4322; Creativity Award)
2012 Las Vegas (Finalists with 2034, 3187; Quality Award)
Reply With Quote
  #38   Spotlight this post!  
Unread 06-02-2015, 17:58
curtis0gj curtis0gj is offline
Registered User
FRC #5033 (Beavertronics)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Canada
Posts: 121
curtis0gj will become famous soon enough
Re: Limit Swtich Help

Quote:
Originally Posted by mmaunu View Post
Sweet! Congrats on successfully troubleshooting the problem. I hope that you haven't torn too much hair out
lol yeah It's just a part of the process I guess... anyway thanks for all of the help.
Reply With Quote
  #39   Spotlight this post!  
Unread 06-02-2015, 21:36
curtis0gj curtis0gj is offline
Registered User
FRC #5033 (Beavertronics)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Canada
Posts: 121
curtis0gj will become famous soon enough
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);            	
            }
    	}
    }
Reply With Quote
  #40   Spotlight this post!  
Unread 06-02-2015, 21:37
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,102
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Limit Swtich Help

Quote:
Originally Posted by curtis0gj View Post
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 the jumper set for coast or brake? If coast, try changing it to brake.


Reply With Quote
  #41   Spotlight this post!  
Unread 06-02-2015, 21:46
curtis0gj curtis0gj is offline
Registered User
FRC #5033 (Beavertronics)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Canada
Posts: 121
curtis0gj will become famous soon enough
Re: Limit Swtich Help

Quote:
Originally Posted by Ether View Post
Is the jumper set for coast or brake? If coast, try changing it to brake.


Sorry, I hate to sound like a complete rookie but how can I change the jumpers setting?
Reply With Quote
  #42   Spotlight this post!  
Unread 06-02-2015, 21:56
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,102
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Limit Swtich Help

Quote:
Originally Posted by curtis0gj View Post
Sorry, I hate to sound like a complete rookie but how can I change the jumpers setting?
Go to the VEX web site.

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.
Reply With Quote
  #43   Spotlight this post!  
Unread 06-02-2015, 22:52
curtis0gj curtis0gj is offline
Registered User
FRC #5033 (Beavertronics)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Canada
Posts: 121
curtis0gj will become famous soon enough
Re: Limit Swtich Help

Quote:
Originally Posted by Ether View Post
Go to the VEX web site.

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.


Thank's I will try the break setting on Monday.
Reply With Quote
  #44   Spotlight this post!  
Unread 06-02-2015, 23:27
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,102
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Limit Swtich Help

Quote:
Originally Posted by curtis0gj View Post
Thank's I will try the break setting on Monday.
Stay away from the break setting. Try the brake setting instead.


Reply With Quote
  #45   Spotlight this post!  
Unread 06-02-2015, 23:40
Jon Stratis's Avatar
Jon Stratis Jon Stratis is offline
Mentor, LRI, MN RPC
FRC #2177 (The Robettes)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Minnesota
Posts: 3,827
Jon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond repute
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
}
Obviously, that's pseudocode... its up to you to figure out how to translate that to real code

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!
__________________
2007 - Present: Mentor, 2177 The Robettes
LRI: North Star 2012-2016; Lake Superior 2013-2014; MN State Tournament 2013-2014, 2016; Galileo 2016; Iowa 2017
2015: North Star Regional Volunteer of the Year
2016: Lake Superior WFFA
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 13:18.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi