|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||||
|
|||||
|
Re: Trouble using Spike Relay
The relay outputs are correct for connecting to Spike relays.
There are LEDs adjacent to the relay pins on the Digital Sidecar. When you tell the door relay (#4) to turn on forward, its associated green LED should light. Does it? Are the Digital Sidecar's 12v and 5v power LEDs lit? Is the RSL on steady? |
|
#3
|
|||
|
|||
|
Re: Trouble using Spike Relay
Thanks! It works now! Not really sure why, though
![]() |
|
#4
|
||||||
|
||||||
|
Re: Trouble using Spike Relay
Quote:
All bots are programmed in Wind River. The firmware matches the software installation. This has happened today, twice, on two different robots (neither of which are mine). I'm not quite sure what to try next. Hopefully there is a "duh" I'm missing and someone can help me correct the problem. Should I bust out the "Persuader" and take the sidecar out behind the woodshed? ![]() |
|
#5
|
|||||
|
|||||
|
Re: Trouble using Spike Relay
If the Digital Sidecar's Relay LED is working, but the Spike wired to the Relay pins associated with that LED is not, with two different sets of wires having been tried, I would tend to suspect the Spike as the source of the fault.
|
|
#6
|
|||
|
|||
|
Re: Trouble using Spike Relay
Seconding the above--we had a Spike fail as well. It's a bit of a pain to troubleshoot(since the spike has no error codes like a speed controller), but your symptoms match ours exactly.
|
|
#7
|
||||
|
||||
|
Re: Trouble using Spike Relay
Harry,
You did not mention what type of motor you are trying to drive with the Spike. Have you checked the 20A fuse on the spike? Mike |
|
#8
|
||||||
|
||||||
|
Re: Trouble using Spike Relay
Quote:
Maybe I should hook it up to an IFI controller - maybe it misses mommy..... ![]() |
|
#9
|
|||
|
|||
|
Re: Trouble using Spike Relay
What I found is that I had to use the following:
Code:
Relay * motorRelay; motorRelay = new Relay(...) motorRelay->SetDirection(Relay::kForwardOnly); motorRelay->Set(Relay::kOn); After this everything worked just fine, not sure why. However if you are saying your digital sidecar is showing the correct value, and yet the spike is not re-acting, I would not know, have you tried a different relay output? |
|
#10
|
||||||
|
||||||
|
Re: Trouble using Spike Relay
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |