Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Pneumatics (http://www.chiefdelphi.com/forums/forumdisplay.php?f=54)
-   -   Pneumatics system code (http://www.chiefdelphi.com/forums/showthread.php?t=129776)

adciv 24-06-2014 10:59

Re: Pneumatics system code
 
Ok, to do some quick troubleshooting:

First, for my sanity, please add brackets
Code:

// Solenoid
if (mainStick.getRawButton(1))
{
  spike.set(Relay.Value.kForward);
}
else {
  if (mainStick.getRawButton(2))
 {
  spike.set(Relay.Value.kReverse);
 }
}

If problem persists, comment out the code and use only
Code:

spike.set(Relay.Value.kForward);
If the spike LED is not solid Green, you have a wiring issue. Either your wire is bad or the spike is on the wrong port. If that does work, it becomes a code issue.

Team 4939 24-06-2014 11:19

Re: Pneumatics system code
 
"If the spike LED is not solid Green, you have a wiring issue. Either your wire is bad or the spike is on the wrong port. If that does work, it becomes a code issue."

We tried switching all the wires, but not change in the light.

Here is the updated code:

Code:

package edu.wpi.first.wpilibj.templates;
 
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.Relay;
 
public class RobotTemplate extends SimpleRobot {
   
    RobotDrive chassis = new RobotDrive(1,2);
    Joystick mainStick = new Joystick(1);
    Jaguar jaguar = new Jaguar(3);
    Jaguar jag = new Jaguar(4);
    Compressor compressor = new Compressor(1, 1);
    Relay spike = new Relay(4);
   
    public void robotInit() {
        compressor.start();
    }

    public void autonomous(){
        chassis.setSafetyEnabled(false);
        chassis.drive (-0.5, 0.08);
        Timer.delay(2.0);
        chassis.drive (0, 0.0);
    }
   
    public void operatorControl() {
        chassis.setSafetyEnabled(true);
        while (isOperatorControl() && isEnabled()) {
            double speed = mainStick.getY();
            double rot = -mainStick.getX();
            chassis.arcadeDrive (speed, rot);
            if (mainStick.getRawButton(3)){
                jag.set(1);
                jaguar.set(-1);
            }
            else if (mainStick.getRawButton(4)){
                jaguar.set(-1);
                jag.set(1);
            }
            else{
                jaguar.set(0);
                jag.set(0);
            }

            // Solenoid
            {if (mainStick.getRawButton(7))
                spike.set(Relay.Value.kForward);}
        }
    }
}


adciv 24-06-2014 11:27

Re: Pneumatics system code
 
Did you try it without any case statements around the relay set? I'm trying to remove the controller from this as well.

Code:

package edu.wpi.first.wpilibj.templates;
 
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.Relay;
 
public class RobotTemplate extends SimpleRobot {
   
    RobotDrive chassis = new RobotDrive(1,2);
    Joystick mainStick = new Joystick(1);
    Jaguar jaguar = new Jaguar(3);
    Jaguar jag = new Jaguar(4);
    Compressor compressor = new Compressor(1, 1);
    Relay spike = new Relay(4);
   
    public void robotInit() {
        compressor.start();
    }

    public void autonomous(){
        chassis.setSafetyEnabled(false);
        chassis.drive (-0.5, 0.08);
        Timer.delay(2.0);
        chassis.drive (0, 0.0);
    }
   
    public void operatorControl() {
        chassis.setSafetyEnabled(true);
        while (isOperatorControl() && isEnabled()) {
            double speed = mainStick.getY();
            double rot = -mainStick.getX();
            chassis.arcadeDrive (speed, rot);

            // Solenoid
                spike.set(Relay.Value.kForward);
        }
    }
}


Team 4939 24-06-2014 11:36

Re: Pneumatics system code
 
I tried it with the new code that you posted but that did not work out either. No change in light on the spike or change in the system

Aren Siekmeier 24-06-2014 11:38

Re: Pneumatics system code
 
In this pic it looks an awful lot like the PWM cable into the Spike is backwards. Make sure the black wire is near the "B" on the casing. Also check the Digital Sidecar end of this wire, to make sure Black lines up with (-) (Red with + and White with SIG).

Edit: According to your code, it should be in Relay output 4. Also note: the socket in Spikes and Victors can be a little funny - make sure the connector is properly and snuggly seated all the way down into the socket.

The solid orange light on the spike means it's being commanded to do nothing, which is certainly the case if there is no proper signal coming in.

adciv 24-06-2014 11:41

Re: Pneumatics system code
 
No I'm becoming puzzled. Can you check your digital Side Car to ensure all lights are operating correctly
http://wpilib.screenstepslive.com/s/...tem-components

Are you able to control the drive motors?

Aren Siekmeier 24-06-2014 11:57

Re: Pneumatics system code
 
Quote:

Originally Posted by compwiztobe (Post 1390962)
In this pic it looks an awful lot like the PWM cable into the Spike is backwards. Make sure the black wire is near the "B" on the casing. Also check the Digital Sidecar end of this wire, to make sure Black lines up with (-) (Red with + and White with SIG).

Edit: According to your code, it should be in Relay output 4. Also note: the socket in Spikes and Victors can be a little funny - make sure the connector is properly and snuggly seated all the way down into the socket.

The solid orange light on the spike means it's being commanded to do nothing, which is certainly the case if there is no proper signal coming in.

I looked again at that picture. Definitely a wiring issue.

1. Your double solenoid valve is wired incorrectly. Each end of the valve is one solenoid, each of which has a red wire (+, positive) and a black wire (-, negative). Make sure these wires are connected to the spike exactly as shown in this diagram. Right now you are doing something totally different with those wires, which wouldn't work even if the Spike were working properly (it's not, due to 2 below). You should have a red wire on each of the M+ and M- terminals on the spike, and then both black wires should connect to the GND terminal on the Spike.

2. As I posted above, ensure all PWM cables (for lack of a better name - the grouped black, red, and white wires) are inserted in the right direction. In general: B means black; (-) means GND which is always black (or maybe brown or blue ... ) + means hot which is always red, and SIG is signal which is usually white.

Team 4939 24-06-2014 11:58

Re: Pneumatics system code
 
Ya all the motors are working.

Here is a pic of the sidecar at the moment:

http://i58.tinypic.com/ohrara.jpg

The relay lights don't seem to be steady or blinking, but everything else seems to be fine.

I also changed the port to 7 for the spike on request of my team.

Code:

package edu.wpi.first.wpilibj.templates;
 
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.Relay;
 
public class RobotTemplate extends SimpleRobot {
   
    RobotDrive chassis = new RobotDrive(1,2);
    Joystick mainStick = new Joystick(1);
    Jaguar jaguar = new Jaguar(3);
    Jaguar jag = new Jaguar(4);
    Compressor compressor = new Compressor(1, 1);
    Relay spike = new Relay(7);
   
    public void robotInit() {
        compressor.start();
    }

    public void autonomous(){
        chassis.setSafetyEnabled(false);
        chassis.drive (-0.5, 0.08);
        Timer.delay(2.0);
        chassis.drive (0, 0.0);
    }
   
    public void operatorControl() {
        chassis.setSafetyEnabled(true);
        while (isOperatorControl() && isEnabled()) {
            double speed = mainStick.getY();
            double rot = -mainStick.getX();
            chassis.arcadeDrive (speed, rot);

            // Solenoid
                spike.set(Relay.Value.kForward);
        }
    }
}


adciv 24-06-2014 12:15

Re: Pneumatics system code
 
If I'm seeing that right, I think I found the issue. The Spike must be plugged into the Relay Ports on the Side Car. You have it plugged into the PWM ports.

Team 4939 24-06-2014 12:21

Re: Pneumatics system code
 
I rewired the solenoid and spike to the way that was suggested, and we checked the PWM cables and still no fix, the light is still red.

Could it maybe be the code? Can someone check that and reply back.

adciv 24-06-2014 12:24

Re: Pneumatics system code
 
Red or Orange? If Red, that means it's working (and the colors in the guide I consulted were backwards).

Team 4939 24-06-2014 12:26

Re: Pneumatics system code
 
We plugged the spike into the Relay ports. But the light is still orange in the spike. Any suggestions

Team 4939 24-06-2014 12:30

Re: Pneumatics system code
 
When we connect the spike to the Digital I/O the solenoid lights up, but the spike's lights turn off.

Team 4939 24-06-2014 12:46

Re: Pneumatics system code
 
When we put it into the Digital I/O and we move the wire around the light on the spike changes from green, to orange, to red for 2 seconds, and when we push the wire in all the way the spike has no color. And all this is without me turning on the driver station. The spike does not work when we plug in to the PWM section, or the relay section of the sidecar. We don't know where to go from here. Any help would be appreciated.

adciv 24-06-2014 12:49

Re: Pneumatics system code
 
It needs to be plugged into the Rleay section. Lets go from there. By plugging it into the DIO, you're setting it to reverse, as the reverse pin in the Spike is getting the 5V from the DIO. Lets try setting it to reverse in code while it's on the relay panel.

Code:

    public void operatorControl() {
        chassis.setSafetyEnabled(true);
        while (isOperatorControl() && isEnabled()) {
            double speed = mainStick.getY();
            double rot = -mainStick.getX();
            chassis.arcadeDrive (speed, rot);

            // Solenoid
                spike.set(Relay.Value.kReverse);
        }
    }



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

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