Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Trouble using Spike Relay (http://www.chiefdelphi.com/forums/showthread.php?t=74155)

HarryScheiner 11-02-2009 12:02

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

Alan Anderson 11-02-2009 12:24

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?

HarryScheiner 11-02-2009 17:08

Re: Trouble using Spike Relay
 
Thanks! It works now! Not really sure why, though :confused:

Travis Hoffman 15-02-2009 22:55

Re: Trouble using Spike Relay
 
Quote:

Originally Posted by Alan Anderson (Post 818609)
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?

OK so answer me this - all sidecar LED's are green. Spike power is wired properly. Relay output light is turning on at the sidecar (using either the Compressor class or just a Relay class to turn the output on). Pump works fine when powered separately. RSL is solid orange when enabled. All this, but the pump doesn't enable. The Spike LED remains orange. I've swapped out the PWM cable, twice. No dice.

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? :rolleyes:

Alan Anderson 16-02-2009 00:15

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.

nathanww 16-02-2009 01:07

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.

Mike Betts 16-02-2009 01:15

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

Travis Hoffman 16-02-2009 01:44

Re: Trouble using Spike Relay
 
Quote:

Originally Posted by Alan Anderson (Post 821760)
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.

One of the teams swapped their Spike out - same result.

Maybe I should hook it up to an IFI controller - maybe it misses mommy.....:rolleyes:

X-Istence 17-02-2009 14:01

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);

Without the set direction, or even by giving it a value like Relay::kForward it would not move.

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?

Travis Hoffman 17-02-2009 14:08

Re: Trouble using Spike Relay
 
Quote:

Originally Posted by X-Istence (Post 823018)
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);

Without the set direction, or even by giving it a value like Relay::kForward it would not move.

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?

We determined the one failure WAS attributable to the Spike (never had that happen before!), but the problem on the robot where we swapped the Spike remains. I'll have the rookie team recheck their crimp connections and wiring....


All times are GMT -5. The time now is 02:42.

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