Go to Post Successful teams - in almost any aspect of life (i.e. not just robotics) - don't make excuses and assign blame when something goes wrong. They improvise. They adapt. They overcome. They correct the problem and move on. - dlavery [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 18-02-2010, 16:42
Mr. Stone Mr. Stone is offline
Registered User
FRC #1622 (Spyder)
Team Role: Programmer
 
Join Date: Feb 2010
Rookie Year: 2009
Location: California
Posts: 5
Mr. Stone is an unknown quantity at this point
Spike Relay works only in Reverse

Hi,
We want a button to start the relay in reverse, and one for it to go forward. We also have a button to make it stop. The problem is that the spike is only getting the signals to send it in reverse and to stop.

our code for it is as follows:
Code:
// We need to decide what buttons belong to which functions.
			AvoidTipOver(joyBtnShooter7Pushed,
						 joyBtnShooter8Pushed,
						 joyBtnShooter9Pushed,
						 joyBtnShooter5Pushed);
//these are all configured properly, at one point, we were using this for our pneumatics




void AvoidTipOver(bool btn7,
					  bool btn8,
					  bool btn9,
					  bool btn5)
	{
		// tells the tipBarLeft/Right to be able to work both directions, but it does not seem to
		// be working at the moment, tweak this to make it work better.  
		tipBarLeft->SetDirection(Relay::kBothDirections);
		tipBarRight->SetDirection(Relay::kBothDirections);

		
		if (btn8)
		{
			tipBarLeft->Set(Relay::kForward);//when btn8 is pressed we want it to be set in the forward position.  
		}
		if (btn9)
		{
			tipBarLeft->Set(Relay::kReverse);//when btn9 is pressed we want it to be set in the reverse position.
		}
		if (btn5)
		{
			tipBarLeft->Set(Relay::kOff);//when btn 5 is pressed we want it to stop.  
			
		}
	}




		tipBarLeft = new Relay(TipBarLeft);
		tipBarRight = new Relay(TipBarRight);//not used at the moment, we are just testing on a mock-up board.  
		tipBarLeft->Set(Relay::kOff);
		tipBarRight->Set(Relay::kOff);
The relay is on channel 1 and is getting power. When we press button 9, it goes in reverse. When we press button 5, it stops. When we press button 8, it stays in the off position.


thanks,
Mr. Stone
Reply With Quote
  #2   Spotlight this post!  
Unread 18-02-2010, 17:00
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,754
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Spike Relay works only in Reverse

Does the Relay LED on the Digital Sidecar go green, red,and off when you push the buttons?

If those are not working either, then it's a coding problem.
If those are working, then it's a Sipke problem.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Reply With Quote
  #3   Spotlight this post!  
Unread 18-02-2010, 17:05
Mr. Stone Mr. Stone is offline
Registered User
FRC #1622 (Spyder)
Team Role: Programmer
 
Join Date: Feb 2010
Rookie Year: 2009
Location: California
Posts: 5
Mr. Stone is an unknown quantity at this point
Re: Spike Relay works only in Reverse

The Led only works when I push it to reverse. It goes red.
Besides we tried a different Spike
Reply With Quote
  #4   Spotlight this post!  
Unread 18-02-2010, 21:56
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Spike Relay works only in Reverse

Tracing backwards from the lack of green light on the Relay port, I don't see anything wrong with the code you posted. How is joyBtnShooter8Pushed being set?
Reply With Quote
  #5   Spotlight this post!  
Unread 19-02-2010, 14:30
Mr. Stone Mr. Stone is offline
Registered User
FRC #1622 (Spyder)
Team Role: Programmer
 
Join Date: Feb 2010
Rookie Year: 2009
Location: California
Posts: 5
Mr. Stone is an unknown quantity at this point
Re: Spike Relay works only in Reverse

[code]
///////////////////////////////////////////////////////////////////////////
// Read the values of the joysticks and buttons on both operator pads.
///////////////////////////////////////////////////////////////////////////
void ReadOperatorPads()
{
GetWatchdog().Feed();
joyYDriverLeft = operatorPadDriver->GetLeftY();
joyYDriverRight = operatorPadDriver->GetRightY();
joyBtnDriver1Pushed = operatorPadDriver->GetNumberedButton(1);
joyBtnDriver2Pushed = operatorPadDriver->GetNumberedButton(2);
joyBtnDriver3Pushed = operatorPadDriver->GetNumberedButton(3);
joyBtnDriver4Pushed = operatorPadDriver->GetNumberedButton(4);
joyBtnDriver5Pushed = operatorPadDriver->GetNumberedButton(5);
joyBtnDriver6Pushed = operatorPadDriver->GetNumberedButton(6);

joyYShooterLeft = operatorPadShooter->GetLeftY();
joyYShooterRight = operatorPadShooter->GetRightY();
joyBtnShooter1Pushed = operatorPadShooter->GetNumberedButton(1);
joyBtnShooter2Pushed = operatorPadShooter->GetNumberedButton(2);
joyBtnShooter3Pushed = operatorPadShooter->GetNumberedButton(3);
joyBtnShooter4Pushed = operatorPadShooter->GetNumberedButton(4);
joyBtnShooter5Pushed = operatorPadShooter->GetNumberedButton(5);
joyBtnShooter6Pushed = operatorPadShooter->GetNumberedButton(6);
joyBtnShooter7Pushed = operatorPadShooter->GetNumberedButton(7);
joyBtnShooter8Pushed = operatorPadShooter->GetNumberedButton(8);
joyBtnShooter9Pushed = operatorPadShooter->GetNumberedButton(9);
[code]

they are being set correctly because, we used that button earlier in our code to operate a solenoid, and it worked perfectly.
EDIT:
there is an error that comes up in the message log in the diagnostics tab of the driver station:
"Fatal error "Attempting to reuse an allocated resource" in Allocate() in C:/WindRiver/workspace/WPILib/resource.cpp at line 79"
I get this 6 times when the robot starts up.

Also, when i put in a new command to make it go kForward, in the beginning of the loop "avoidtipover" It does nothing. it acts as if I set it to kOff. i can press down the btn9 and it will run but the second that I release it, it turns off.

Last edited by Mr. Stone : 19-02-2010 at 14:55. Reason: forgot to add error
Reply With Quote
  #6   Spotlight this post!  
Unread 19-02-2010, 15:32
oddjob oddjob is offline
Registered User
no team
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Earth
Posts: 118
oddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to behold
Re: Spike Relay works only in Reverse

Quote:
Originally Posted by Mr. Stone View Post
there is an error that comes up in the message log in the diagnostics tab of the driver station:
"Fatal error "Attempting to reuse an allocated resource" in Allocate() in C:/WindRiver/workspace/WPILib/resource.cpp at line 79"
I get this 6 times when the robot starts up.
That means you have multiply allocated a single resource, and that must be found and fixed. Here's an example:

Code:
    m_gyro = new Gyro(1);
    m_analogChannel_1 = new AnalogChannel(1);
Analog channel #1 has been allocated twice. Check all your resources.
Reply With Quote
  #7   Spotlight this post!  
Unread 19-02-2010, 18:12
Mr. Stone Mr. Stone is offline
Registered User
FRC #1622 (Spyder)
Team Role: Programmer
 
Join Date: Feb 2010
Rookie Year: 2009
Location: California
Posts: 5
Mr. Stone is an unknown quantity at this point
Re: Spike Relay works only in Reverse

thanks, as of writing this, we still cannot find the duplicate allocation, but our mentor will be arriving later today to help us out. thanks a lot.

P.S. finding and fixing the allocate error will most likely solve the original problem, because we are using a spike to operate our compressor.

Last edited by Mr. Stone : 19-02-2010 at 18:25.
Reply With Quote
  #8   Spotlight this post!  
Unread 20-02-2010, 01:31
Mr. Stone Mr. Stone is offline
Registered User
FRC #1622 (Spyder)
Team Role: Programmer
 
Join Date: Feb 2010
Rookie Year: 2009
Location: California
Posts: 5
Mr. Stone is an unknown quantity at this point
Re: Spike Relay works only in Reverse

I fixed it, the problem was that we were plugging the cable into the sidecar backwards. It figures that it was something stupid like that, and thanks for all the help.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
spike relay problem? Maxpower57 Electrical 15 09-04-2012 19:18
Relay bug, doesn't work in Forward or Reverse only modes Joe Ross NI LabVIEW 0 16-02-2010 23:33
Relay (Spike) elbuo Electrical 2 09-02-2009 20:36
Making a forward only speed control reverse sanddrag Electrical 7 12-12-2003 07:19
Spike Relay Input nwagers Electrical 3 16-07-2002 22:23


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

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