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)

Team 4939 12-06-2014 23:57

Pneumatics system code
 
From all of us here at Team 4939, hopefully everybody had a good time. As a rookie team I know we did.

During the off-season we decided to incorporate a very basic pneumatics system into our robot, so that we would be more experienced for next. We were able to figure out where to connect everything (or so we think) according to the instructions, but when it comes to the code, we are just feeling very lost.

As a rookie team most of out programmers including myself, have no clue where to go from here. We found a couple resources online, but are just feeling very confused. We believe we have all the parts we just have to get them to work. The system works manually, but when doing it automatically with the joystick we have no clue where to go. Here is our current 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;
 
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);

   
    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;
            double rot;
            speed = mainStick.getY();
            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);
            }
    }
    }
   
    public void test() {
     
    }
}

All help is greatly appreciated since it is the end of the FRC season.

I will try and upload a picture of how we have the system set up tomorrow.

Thanks in Advance

Domenic Rodriguez 13-06-2014 00:29

Re: Pneumatics system code
 
The compressor is controlled automatically through the Compressor class. Simply pass the Pressure Switch and Relay channels to the constructor and call Compressor#start() in robotInit() and you should be good to go. If desired, it can be disabled with Compressor#stop().

Solenoids come in two varieties: Solenoids and DoubleSolenoids. Single solenoids can be set true or false, while double solenoids are typically set to DoubleSolenoid.Value.kForward, DoubleSolenoid.Value.kReverse, or DoubleSolenoid.Value.kOff.

A simple example incorporating your 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;
 
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);

    // Pneumatics
    Compressor compressor = new Compressor(1, 1);
    Solenoid solenoid = new Solenoid(1);
    DoubleSolenoid doubleSolenoid = new DoubleSolenoid(2, 3);
   
    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;
            double rot;
            speed = mainStick.getY();
            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
            solenoid.set(mainStick.getRawButton(1);
            if (mainStick.getRawButton(2))
                doubleSolenoid.set(DoubleSolnoid.Value.kForward);
            else
                doubleSolenoid.set(DoubleSolenoid.Value.kOff);
        }
    }
   
    public void test() {
     
    }
}


Also, you might want to check out these articles from the WPILib docs at ScreenSteps Live:
http://wpilib.screenstepslive.com/s/...for-pneumatics
http://wpilib.screenstepslive.com/s/...ders-solenoids

SoftwareBug2.0 13-06-2014 00:32

Re: Pneumatics system code
 
I would start by making a list of what all the connected pneumatic components are and what joystick inputs they're supposed to be controlled by. This will make it easier to help you.

By the way, the following two code snipets are identical:
Code:

int x;
x=4;

Code:

int x=4;

mmaunu 13-06-2014 20:44

Re: Pneumatics system code
 
Since you are just starting out, I want to point out a tiny error in Domenic Rodriguez ' s code. He named a variable "double" since it represents a double solenoid. However, you can't name a variable "double" in Java as it is a reserved word. Change the name to doubleSol or something else and you will be fine. Be sure to only change the name of the variable and not other occurrences of "double".

Sorry...on mobile or I would repost the code with the fixes in place.

Domenic Rodriguez 13-06-2014 21:40

Re: Pneumatics system code
 
Quote:

Originally Posted by mmaunu (Post 1389793)
Since you are just starting out, I want to point out a tiny error in Domenic Rodriguez ' s code. He named a variable "double" since it represents a double solenoid. However, you can't name a variable "double" in Java as it is a reserved word. Change the name to doubleSol or something else and you will be fine. Be sure to only change the name of the variable and not other occurrences of "double".

Sorry...on mobile or I would repost the code with the fixes in place.

Fixed, my bad. Now I feel silly; I guess that's what I get for writing code at 12:30 AM :rolleyes:

Team 4939 16-06-2014 17:32

Re: Pneumatics system code
 
Sorry for not replying earlier, but I just haven't been able to test the code that you all helped out with yet, due to exams and such. I should be able to test the system out tomorrow and I will post a reply letting you know how it worked out. I was able to get a picture: http://postimg.org/image/wvu8lykol/ . If that makes a difference to the code.

Also I was wondering something about where to plug the spike in, I pluged one end to the solenoid, and the other end into port 5 on my Digital side car.

I noticed in the code that Domenic Rodriguez posted :

Code:

// Pneumatics
    Compressor compressor = new Compressor(1, 1);
    Solenoid solenoid = new Solenoid(1);
    DoubleSolenoid doubleSolenoid = new DoubleSolenoid(2, 3);


Ports 1, 2, and 3 are labeled.

Where should I plug my Spike into?

Thank You to all that helped me get this far, just a little more help is needed.

Domenic Rodriguez 16-06-2014 18:35

Re: Pneumatics system code
 
Quote:

Originally Posted by Team 4939 (Post 1390101)
Sorry for not replying earlier, but I just haven't been able to test the code that you all helped out with yet, due to exams and such. I should be able to test the system out tomorrow and I will post a reply letting you know how it worked out. I was able to get a picture: http://postimg.org/image/wvu8lykol/ . If that makes a difference to the code.

Also I was wondering something about where to plug the spike in, I pluged one end to the solenoid, and the other end into port 5 on my Digital side car.

I noticed in the code that Domenic Rodriguez posted :

Code:

// Pneumatics
    Compressor compressor = new Compressor(1, 1);
    Solenoid solenoid = new Solenoid(1);
    DoubleSolenoid doubleSolenoid = new DoubleSolenoid(2, 3);


Ports 1, 2, and 3 are labeled.

Where should I plug my Spike into?

Thank You to all that helped me get this far, just a little more help is needed.

To clarify, are you planning on controlling your solenoid with a Spike Relay, or with the solenoid module on the cRIO?

The Solenoid and DoubleSolenoid classes only work for controlling solenoids through the solenoid module. If you are controlling your solenoid through a relay, you will need to use the Relay class instead.

Judging by your picture, it looks like you are using a double solenoid. I've never controlled a solenoid through Spikes before, but I believe you will need two Spikes, one for each side. Edit: Nope, see Mark McLeod's post below.

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

    // Pneumatics
    Compressor compressor = new Compressor(1, 1);
    Relay spike = new Relay(2);
   
    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(1))
                spike.set(Relay.Value.kForward);
            else if (mainStick.getRawButton(2))
                spike.set(Relay.Value.kReverse);
        }
    }
}


Mark McLeod 16-06-2014 19:23

Re: Pneumatics system code
 
Quote:

Originally Posted by Domenic Rodriguez (Post 1390105)
Judging by your picture, it looks like you are using a double solenoid. I've never controlled a solenoid through Spikes before, but I believe you will need two Spikes, one for each side.

Only one spike per double solenoid.
The code for a double would use kForward for one direction and kReverse for the other direction. Don't use kOff for this purpose.
Wiring a spike to control a 12v-only solenoid via a Relay output on the Digital Sidecar looks like this:


24v solenoids are usable only through the cRIO Solenoid Module/Breakout, not a 12v Spike relay.

Team 4939 16-06-2014 19:42

Re: Pneumatics system code
 
Quote:

Originally Posted by Mark McLeod (Post 1390110)
Only one spike per double solenoid.
The code for a double would use kForward for one direction and kReverse for the other direction. Don't use kOff for this purpose.
Wiring a spike to control a 12v-only solenoid via a Relay output on the Digital Sidecar looks like this:


24v solenoids are usable only through the cRIO Solenoid Module/Breakout, not a 12v Spike relay.

By the picture that I posted earlier this evening could you tell me if it is a 24v solenoid or a 12v solenoid. If not I will just ask my electrical team members.

Mark McLeod 16-06-2014 19:57

Re: Pneumatics system code
 
I suspect from your photo that it is a 24v solenoid just because that's what has been offered in the KOP, but that style can be either voltage rating. The black end caps will have a voltage printed on them.

If it is a 24v solenoid, then it gets wired to two sets of pins on the Solenoid Breakout and the Solenoid Breakout must get 24v power from the empty connectors of the Power Distribution's special 24v output.

Team 4939 17-06-2014 14:06

Re: Pneumatics system code
 
Quote:

Originally Posted by Mark McLeod (Post 1390116)
I suspect from your photo that it is a 24v solenoid just because that's what has been offered in the KOP, but that style can be either voltage rating. The black end caps will have a voltage printed on them.

If it is a 24v solenoid, then it gets wired to two sets of pins on the Solenoid Breakout and the Solenoid Breakout must get 24v power from the empty connectors of the Power Distribution's special 24v output.

Yes you were right it was a 24v solenoid, but I was able to find a different 12v double solenoid in a couple of spare parts sitting around, but unfortunately due to exams and such our team will not be able to switch the solenoids out until next week this time. So I would just like to thank you for all the help you have offered.

I should be able to use the code above posted by Domenic Rodriguez correct?

Mark McLeod 17-06-2014 14:59

Re: Pneumatics system code
 
Quote:

Originally Posted by Team 4939 (Post 1390219)
I should be able to use the code above posted by Domenic Rodriguez correct?

Correct, that code looks good.

Team 4939 24-06-2014 10:25

Re: Pneumatics system code
 
I tried out the code but it did not work out.

If I am right the spike has a light that is supposed to flash when I pressed the assigned button on my joystick. Also on my driver station when a activate any of the other functions such as (movement, or intake motors) the voltage spikes, is that not supposed to happen when a press the button assigned to the pneumatics spike.

None of the things is happening, so I don't know what to exactly do.

I am sitting here with my team so any immediate help would be greatly appreciated.

adciv 24-06-2014 10:33

Re: Pneumatics system code
 
Please provide a copy of your code for this.

Also, what is the LED on the spike doing? (Blink Status & Color)

Team 4939 24-06-2014 10:36

Re: Pneumatics system code
 
I am using the code that Domenic Rodriguez posted:

Quote:

Originally Posted by Domenic Rodriguez (Post 1390105)
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);

    // Pneumatics
    Compressor compressor = new Compressor(1, 1);
    Relay spike = new Relay(2);
   
    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(1))
                spike.set(Relay.Value.kForward);
            else if (mainStick.getRawButton(2))
                spike.set(Relay.Value.kReverse);
        }
    }
}


The light of the spike is red-ish/orange and it is steady.

Here are some pics of the wiring at the moment:

http://tinypic.com/view.php?pic=11qp...8#.U6m8OyWmfIU

http://i61.tinypic.com/2qkjmuh.jpg

Any solutions would be appreciated

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


Team 4939 24-06-2014 12:54

Re: Pneumatics system code
 
Nothing different happened even though I changed the code, also the lights on the solenoid turned off.

adciv 24-06-2014 13:01

Re: Pneumatics system code
 
Off? Ok, it sounds like you have a bad spike relay. Replace the spike with a different one and we'll see what happens. Also, what are teh LEDs on the digital side car above the relay section showing?

Anthony4939 24-06-2014 13:15

Re: Pneumatics system code
 
Changed spike, no change. No LEDs lit on sidecar.

Team 4939 24-06-2014 13:16

Re: Pneumatics system code
 
We changed the spike but nothing different happened.

Here is how our sidecar looks right now:

http://postimg.org/image/xbjxvkuln/

Domenic Rodriguez 24-06-2014 13:19

Re: Pneumatics system code
 
Out of curiosity, have you tried hooking up your compressor yet? If the relay for your compressor is also not working, you may have an issue with your Digital Sidecar.

adciv 24-06-2014 13:20

Re: Pneumatics system code
 
Is that side car picture with or without your code in Teleop?

Team 4939 24-06-2014 13:22

Re: Pneumatics system code
 
Quote:

Originally Posted by Domenic Rodriguez (Post 1390993)
Out of curiosity, have you tried hooking up your compressor yet? If the relay for your compressor is also not working, you may have an issue with your Digital Sidecar.

We don't have our compressor connected to a relay, we just manually turn it on and off. Also all our other motors and such work through the digital sidecar, so I assume the sidecar still works.

Team 4939 24-06-2014 13:24

Re: Pneumatics system code
 
Quote:

Originally Posted by adciv (Post 1390994)
Is that side car picture with or without your code in Teleop?


The picture is with the robot on and the code loaded, but not with teleop activated.

We could turn on teleop and take another picture if you would like.

Aren Siekmeier 24-06-2014 13:30

Re: Pneumatics system code
 
Quote:

Originally Posted by Team 4939 (Post 1390996)
The picture is with the robot on and the code loaded, but not with teleop activated.

We could turn on teleop and take another picture if you would like.

Yes, we would.

All relay outputs (and all other outputs, for that matter) are disabled when the robot is not enabled from the driver station. All of these tests of whether the spike and solenoids are receiving a non-neutral signal won't do any good unless the driver station has enabled Teleop mode.

Team 4939 24-06-2014 13:36

Re: Pneumatics system code
 
Quote:

Originally Posted by compwiztobe (Post 1390997)
Yes, we would.

All relay outputs (and all other outputs, for that matter) are disabled when the robot is not enabled from the driver station. All of these tests of whether the spike is receiving a non-neutral signal won't do any good unless the driver station has enabled Teleop mode.

Here is a picture with the teleop mode activated:

http://postimg.org/image/nltuevm3n/

adciv 24-06-2014 13:46

Re: Pneumatics system code
 
The image isn't loading for me. Can you confirm the link is working for you?

Team 4939 24-06-2014 13:49

Re: Pneumatics system code
 
Quote:

Originally Posted by adciv (Post 1391001)
The image isn't loading for me. Can you confirm the link is working for you?


It was working for me, but I tried using a different website. Here is the new link:

http://s13.postimg.org/xvw9e4bzb/photo2.jpg

Aren Siekmeier 24-06-2014 14:02

Re: Pneumatics system code
 
I'll run down the whole chain here to try to locate the issue. If any these fails, don't go any further, you'll need to fix that problem before moving on.

1. Are other outputs working? For example, can you drive with Teleop enabled. If so, keep the robot in this mode (Teleop Enabled) for all other tests. In any disabled mode, all outputs are disabled. Additionally, your code only runs in Teleop Enabled.

2. What is the latest code you have compiled and deployed? This code should be declaring a Relay object on port 7, and then in OperatorControl() it should set the value to something other than kOff (kReverse or kForward).

3. If the above is true, do the LEDs on the Relay bumper show anything, while in Teleop Enabled? According to the link given previously, a relay output's LEDs will be red for reverse, green for forward, off for off.

4. Now with the relay output working properly, make sure the Spike is wired correctly to the relay output and to the PD board. Does the Spike's LED match the Digital Sidecar's relay LED (again, in Teleop Enabled)?

5. Are the solenoid wires connected appropriately to the Spike? If so, does one of the solenoids light up (again, in Teleop Enabled)?

6. ... there will be more but let's get through those first

Team 4939 24-06-2014 14:08

Re: Pneumatics system code
 
Quote:

Originally Posted by compwiztobe (Post 1391003)
I'll run down the whole chain here to try to locate the issue. If any these fails, don't go any further, you'll need to fix that problem before moving on.

1. Are other outputs working? For example, can you drive with Teleop enabled. If so, keep the robot in this mode (Teleop Enabled) for all other tests. In any disabled mode, all outputs are disabled. Additionally, your code only runs in Teleop Enabled.

2. What is the latest code you have compiled and deployed? This code should be declaring a Relay object on port 7, and then in OperatorControl() it should set the value to something other than kOff (kReverse or kForward).

3. If the above is true, do the LEDs on the Relay bumper show anything, while in Teleop Enabled? According to the link given previously, a relay output's LEDs will be red for reverse, green for forward, off for off.

4. Now with the relay output working properly, make sure the Spike is wired correctly to the relay output and to the PD board. Does the Spike's LED match the Digital Sidecar's relay LED (again, in Teleop Enabled)?

5. Are the solenoid wires connected appropriately to the Spike? If so, does one of the solenoids light up (again, in Teleop Enabled)?

6. ... there will be more but let's get through those first

The lights on the sidecar bumper are off but, the light on the spike is orange. My peers say they have never seen these lights go on before. The steps before step 3 are true.

Aren Siekmeier 24-06-2014 14:15

Re: Pneumatics system code
 
Quote:

Originally Posted by Team 4939 (Post 1391004)
The lights on the sidecar bumper are off but, the light on the spike is orange. My peers say they have never seen these lights go on before. The steps before step 3 are true.

They likely haven't seen them go on because you have never commanded a relay output before. The Relay output lights indicate the current output value.

Another thing to check: Are there any errors appearing on the diagnostics tab of the driver station? You can click Clear Errors to see if any new ones are being reported at the moment. Do this in Teleop Enabled as well. It might be that one of your safety loops is timing out, locking up your outputs. However, you report the other outputs working, so I'm not sure how this could be...

Do you have a multimeter on hand? It might also be worthwhile to unplug the cable from the spike and probe its ends, to see if the digital sidecar is sending an output despite its LED state.

Team 4939 24-06-2014 14:24

Re: Pneumatics system code
 
Quote:

Originally Posted by compwiztobe (Post 1391006)
They likely haven't seen them go on because you have never commanded a relay output before. The Relay output lights indicate the current output value.

Another thing to check: Are there any errors appearing on the diagnostics tab of the driver station? You can click Clear Errors to see if any new ones are being reported at the moment. Do this in Teleop Enabled as well. It might be that one of your safety loops is timing out, locking up your outputs. However, you report the other outputs working, so I'm not sure how this could be...

Do you have a multimeter on hand? It might also be worthwhile to unplug the cable from the spike and probe its ends, to see if the digital sidecar is sending an output despite its LED state.


These are the errors that show up on driver station after I click clear :

Code:

WARNING <Code> 44008 occurred at FRC_NetworkCommunications <radioLostEvents>  3178.632 <radioSeenEvents>
FRC:  Robot radio detection times.
Warning <Code> 44002 occurred at Ping Results:  link-GOOD,  DS radio(.4)-bad,  robot radio(.1)-bad,  cRIO(.2)-GOOD,  FMS-bad Driver Station
<time>6/24/2014 2:19:05 PM<unique#>118
FRC:  Driver Station ping status has changed.

I am not sure what these errors mean exactly.

We are getting 3 V on PWM section, 0 V on the relay section, and 0 V on DIO.

Correction:

We are getting 4 V on DIO

Team 4939 24-06-2014 21:30

Re: Pneumatics system code
 
Any help with this issue would be greatly appreciated.

Also my team is pressuring me to re-check the code, because they think that is the case.

Here is the current code that I am running:

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.kReverse);
        }
    }

If somebody could please check over this code?

Domenic Rodriguez 24-06-2014 22:48

Re: Pneumatics system code
 
This line...
Code:

compressor.start();  // Relay port 1
...and this line...
Code:

spike.set(Relay.Value.kReverse);  // Relay port 7
...should be activating the green LED for Relay 1 and the red LED for Relay 7 on the Digital Sidecar when the robot is enabled in teleop mode. They should turn on regardless of whether Spikes are connected or not. If the LEDs are not activating and you are not measuring any voltage off of these ports, then my conclusion is that there is an issue with either your digital sidecar or the cable connecting it to your cRIO. The code looks fine to me, and it compiles without error in NetBeans.

Aren Siekmeier 25-06-2014 04:45

Re: Pneumatics system code
 
Quote:

Originally Posted by Team 4939 (Post 1391009)
These are the errors that show up on driver station after I click clear :

Code:

WARNING <Code> 44008 occurred at FRC_NetworkCommunications <radioLostEvents>  3178.632 <radioSeenEvents>
FRC:  Robot radio detection times.
Warning <Code> 44002 occurred at Ping Results:  link-GOOD,  DS radio(.4)-bad,  robot radio(.1)-bad,  cRIO(.2)-GOOD,  FMS-bad Driver Station
<time>6/24/2014 2:19:05 PM<unique#>118
FRC:  Driver Station ping status has changed.

I am not sure what these errors mean exactly.

The warning you're seeing is something that usually pops up, simply indicating current status (because, like it says, the ping status has changed and it wants to let you know). So I don't think that's part of it.

Quote:

Originally Posted by Team 4939 (Post 1391009)
We are getting 3 V on PWM section, 0 V on the relay section, and 0 V on DIO.

Correction:

We are getting 4 V on DIO

PWM and DIO both look pretty much fine (assuming you're measuring the voltage I think you're measuring). But let's focus on the relay outputs.

On the relay output, is this measured between one of the signal wires (A or B) and ground (-) while Teleop is enabled? Make sure to measure both A and B relative to ground since which one is active depends on whether you are commanding forward or reverse. If you are not enabled, both will of course be off.

Team 4939 25-06-2014 09:53

Re: Pneumatics system code
 
We tried switching the ribbon cable that connects to the CRIO, and still no reply. The voltage is still dead. We really doubt that the relay section of the sidecar is the only thing disabled, because everything else is working. We measured voltage with teleop enabled as well. We don't know where to go from here.

We don't have a spare sidecar, so any other solutions would be greatly appreciated.

Aren Siekmeier 25-06-2014 11:56

Re: Pneumatics system code
 
Quote:

Originally Posted by Team 4939 (Post 1391086)
We tried switching the ribbon cable that connects to the CRIO, and still no reply. The voltage is still dead. We really doubt that the relay section of the sidecar is the only thing disabled, because everything else is working. We measured voltage with teleop enabled as well. We don't know where to go from here.

We don't have a spare sidecar, so any other solutions would be greatly appreciated.

What voltages are you measuring? Between which pins?

Anthony4939 25-06-2014 17:32

Re: Pneumatics system code
 
A and neg, B and neg on relay and no voltage.

Red and black, white and black, red and white on wire coming from relay, zero voltage.

All other parts of the SC work perfectly.

No Color on LEDs for relay, never seen them on, but never used the relay either.

Aren Siekmeier 26-06-2014 01:33

Re: Pneumatics system code
 
Quote:

Originally Posted by Anthony4939 (Post 1391145)
A and neg, B and neg on relay and no voltage.

Red and black, white and black, red and white on wire coming from relay, zero voltage.

All other parts of the SC work perfectly.

No Color on LEDs for relay, never seen them on, but never used the relay either.

Have you tested all of the relay outputs this way? It sounds like somehow your relay outputs don't work, even though the rest of your sidecar is healthy (you are able to drive, right?). It would be real easy to swap in another to test this point in the system, if only you had another. I saw that you're quite close to several other teams in the Toronto area, perhaps you could contact one of them about borrowing one? And I'm sure someone in your area will be more than happy to spend some time helping with anything else.

Team 4939 27-06-2014 09:25

Re: Pneumatics system code
 
Yes we did test all of our outputs, and it is very odd indeed that only the relay section is not working on the sidecar. By the way we are able to drive the robot.

Unfortunately we are about done for the season, and won't be looking into replacing this sidecar, for the rest of the Summer. When we come back in September a new sidecar will be a priority, and hopefully that fixes the problem.

For now I would like to thank all the people who took out the time to help us try and solve this issue.

Before we end this thread I just wanted to ask, if a pneumatics module would be more reliable in this type of situation?

Thank you once again and have a great summer break everybody.

Aren Siekmeier 27-06-2014 15:59

Re: Pneumatics system code
 
Quote:

Originally Posted by Team 4939 (Post 1391333)
Yes we did test all of our outputs, and it is very odd indeed that only the relay section is not working on the sidecar. By the way we are able to drive the robot.

Unfortunately we are about done for the season, and won't be looking into replacing this sidecar, for the rest of the Summer. When we come back in September a new sidecar will be a priority, and hopefully that fixes the problem.

For now I would like to thank all the people who took out the time to help us try and solve this issue.

Before we end this thread I just wanted to ask, if a pneumatics module would be more reliable in this type of situation?

Thank you once again and have a great summer break everybody.

Perhaps with the new control system coming next year, it might not be worth buying a new sidecar, unless you need a working 2009-2014 system for demo bots. If you can borrow one for testing, that would be ideal. Again, there are several teams in your area and I'm sure a good chunk of them have an extra sidecar.

Both the solenoid breakout and the sidecar are honestly pretty reliable, but the solenoid breakout on the cRio will only power the solenoids. You still need a relay output and a spike to power any onboard compressor. If you're referring to the new PCM for next year, it's hard to say before we get our hands on the details, but I'm sure it will be more than capable as well.

Perhaps you could remove the casing and do some more inspection of the circuit board with your DMM, referencing the schematic. The behavior does seem a bit curious, and I feel like we're missing something...


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