Go to Post I don't care what Dean, Dave, Woodie, or whoever says at kickoff--if it isn't in the rules, it isn't in the rules. - EricH [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 11-02-2009, 12:02
HarryScheiner HarryScheiner is offline
Mentor for Team 1358
FRC #1358 (MacArthur Generals)
Team Role: Programmer
 
Join Date: Feb 2009
Rookie Year: 2007
Location: New York
Posts: 18
HarryScheiner is an unknown quantity at this point
Trouble using Spike Relay

Our spike is not giving power to our motor. This is my code:

Code:
#include "WPILib.h"

/**
 * This is a demo program showing the use of the RobotBase class.
 * The SimpleRobot class is the base of a robot application that will automatically call your
 * Autonomous and OperatorControl methods at the right time as controlled by the switches on
 * the driver station or the field controls.
 */ 
class RobotDemo : public SimpleRobot
{
	RobotDrive myRobot; // robot drive system
	Joystick stickL; // LEFT joystick
	Joystick stickR; // RIGHT joystick
	Jaguar ballSucker; // Central ball aquiring mechanism
	Relay door; // Ball release mechanism

public:
	RobotDemo(void):
		myRobot(2, 1),	// these must be initialized in the same order
		stickL(1),		// as they are declared above.
		stickR(2),
		ballSucker(3),
		door(4)
	{
		GetWatchdog().SetExpiration(0.1);
	}

	/**
	 * Drive left & right motors for 2 seconds then stop
	 */
	void Autonomous(void)
	{
		GetWatchdog().SetEnabled(false);
		myRobot.Drive(0.5, 0.0); 	// drive forwards half speed
		Wait(2.0); 				//    for 2 seconds
		myRobot.Drive(0.0, 0.0); 	// stop robot
	}

	/**
	 * Runs the motors with arcade steering. 
	 */
	void OperatorControl(void)
	{
		GetWatchdog().SetEnabled(true);
		while (IsOperatorControl())
		{
			GetWatchdog().Feed();
			myRobot.TankDrive(stickR, stickL); // drive with tank style
			
			if (stickL.GetTrigger())	// If Left Joystick Trigger is HELD
				ballSucker.Set(-1.0);	
			else						// If Left Joystick Trigger is RELEASED
				ballSucker.Set(0.0);				

			if (stickR.GetTrigger())	// If Right Joystick Trigger is HELD
				door.Set(Relay::kForward);	
			else						// If Right Joystick Trigger is RELEASED
				door.Set(Relay::kOff);				
			
			Wait(0.005);				// wait for a motor update time
		}
	}
};

START_ROBOT_CLASS(RobotDemo);

The Jaguar for 'ballSucker' works fine, I changed it from the left trigger to the right trigger to make sure both triggers were working properly. Are we setting up the Relay wrong?

It might be a wiring problem, also. We were not sure where to plug in the spike's PWM cable on the digital sidecar. Right now it is plugged in to Relay port 4, but we have also tried the side for the Jaguars and it did not work. We tried turning the cables around, too.

Thanks,
-Team 1358
Reply With Quote
 


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
Relay (Spike) elbuo Electrical 2 09-02-2009 20:36
Spike relay question Zack Briggs Electrical 17 19-02-2008 14:48
using SPIKE relay module with Fisher Price motors 1574aviad Motors 4 27-01-2005 01:49
Spike Relay Input nwagers Electrical 3 16-07-2002 22:23


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

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