Go to Post ...your stress reliever is a ziptie with the end cut off so you can pull it straight through. It really works! - Storcky [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 04-02-2013, 18:41
ronitt ronitt is offline
Registered User
FRC #4627
 
Join Date: Jan 2013
Location: Canada
Posts: 3
ronitt is an unknown quantity at this point
Programming the Air Compressor and Pressure Switch

I am from a rookie team in Canada, and we are having trouble programming the air compressor and the pressure switch. I have a background in programming, and I am fairly fluent with Java and have been using the FRC WPI library Documentation. Here is part of my code:

import edu.wpi.first.wpilibj.Compressor;

Compressor compress = new Compressor(1, 1);

public void robotInit(){
compress.start();
}

It might also be something to do with the wiring. Here is the thread about the wiring in the Electrical Section:
http://www.chiefdelphi.com/forums/sh...d.php?t=112746
Reply With Quote
  #2   Spotlight this post!  
Unread 04-02-2013, 19:59
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,817
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Programming the Air Compressor and Pressure Switch

Look at the status lights on the Digital Sidecar for the Relay.
The lights are in the trough in front of the Relay pins.
You should see a green LED if the software is trying to start the compressor.

Is the robot enabled from the Driver Station?
Is the Spike status light glowing orange?

There is a test program you can use to make sure it's not a code issue.
From the Getting Started window -> Support -> Find FRC examples...
Look under the pneumatics folder and pick an example with a compressor.
Change the example's cRIO IP to match your cRIO, i.e., right-click on cRIO Target and choose Properties to change the IP.

Just use the Run button to test it on your cRIO.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Reply With Quote
  #3   Spotlight this post!  
Unread 05-02-2013, 18:16
ronitt ronitt is offline
Registered User
FRC #4627
 
Join Date: Jan 2013
Location: Canada
Posts: 3
ronitt is an unknown quantity at this point
Re: Programming the Air Compressor and Pressure Switch

Yes, the Robot was enabled from the Driver Station, and the light on the spike relay was orange the whole time. From what I know about the robotMain funcion is that it calls the robotInit function once and so according to my code it should be running. I will check out the examples. Thank you for your help.
Reply With Quote
  #4   Spotlight this post!  
Unread 05-02-2013, 18:30
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,817
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Programming the Air Compressor and Pressure Switch

The Spikes orange status light only tells us that the Spike is receiving 12v power.
The Spike status light isn't like the motor controller statuses where they indicate a loss of communication by blinking.

The Relay status on the Digital Sidecar will tell you if the code is ordering the compressor on or not.
The robot does have to be Enabled by the Driver Station for the compressor to be allowed to start.

Sorry, the examples I pointed you to were for LabVIEW.
There aren't any pre-made out-of-the-box Java test programs.
(We should write and publish some of those for the more basic function tests.)
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 05-02-2013 at 18:33.
Reply With Quote
  #5   Spotlight this post!  
Unread 05-02-2013, 21:14
Kusha's Avatar
Kusha Kusha is offline
Crimpin' ain't easy
AKA: Kusha Gharahi
no team (Looking for a team)
Team Role: College Student
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Dallas, Texas
Posts: 207
Kusha is a jewel in the roughKusha is a jewel in the roughKusha is a jewel in the roughKusha is a jewel in the rough
Re: Programming the Air Compressor and Pressure Switch

How we did it was we made a compressor object.

Compressor myCompressor = new Compressor(1,1); //the first number being the digitalIO port for the compressor, and the second being the relay port the spike is plugged into

And then in operatorControl() and where ever else before you start looping do myCompressor.start();

If that doesn't make sense please tell me and I'll clarify.

Also we had a problem where our code was correct but the ribbon cable from the c-rio to the sidecar was not working, and when we replaced that it worked.

EDIT: example
Code:
package edu.wpi.first.wpilibj.templates;


import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.Relay;
import edu.wpi.first.wpilibj.SimpleRobot;

public class RobotTemplate extends SimpleRobot 
{

    private int spikePort = 1;
    private int compressorPort = 1;

    private Compressor airCompressor;

    public void robotInit()
    {
        airCompressor = new Compressor(compressorPort, spikePort);
    }
    
    public void autonomous() 
    {
        System.err.println("Entering autonomous:");
        airCompressor.start();
        while(isEnabled()) 
        {
           
        }
    }
    
    public void operatorControl() 
    {
        System.err.println("Entering teleop:");
        airCompressor.start();
        while(isEnabled())
        {
          
        }
        
    }
   
   public void test()
   {
       System.err.println("Entering Test:");
   }
}
__________________
https://kusha.me

Last edited by Kusha : 05-02-2013 at 21:26.
Reply With Quote
  #6   Spotlight this post!  
Unread 30-01-2014, 12:29
puneeth.meruva puneeth.meruva is offline
MIT Class of 2019
AKA: Puneeth Meruva
FRC #1501 (Team T.H.R.U.S.T)
Team Role: Alumni
 
Join Date: Oct 2013
Rookie Year: 2012
Location: Fort Wayne, Indiana
Posts: 36
puneeth.meruva will become famous soon enoughpuneeth.meruva will become famous soon enough
Re: Programming the Air Compressor and Pressure Switch

We are using the same code as that which was given on the WPI tutorials. However, when we enable the robot, the compressor does not turn on and the LED's beside the relay ports on the sidecar do not turn on either. However, I am sure that there isn't any errors with the code since it is identical to the tutorials. Does anyone know what could be happening? Could the spike relay or the sidecar be faulty?
Reply With Quote
  #7   Spotlight this post!  
Unread 30-01-2014, 13:37
otherguy's Avatar
otherguy otherguy is offline
sparkE
AKA: James
FRC #2168 (The Aluminum Falcons)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: CT
Posts: 431
otherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to behold
Re: Programming the Air Compressor and Pressure Switch

Quote:
Originally Posted by puneeth.meruva View Post
We are using the same code as that which was given on the WPI tutorials. However, when we enable the robot, the compressor does not turn on and the LED's beside the relay ports on the sidecar do not turn on either. However, I am sure that there isn't any errors with the code since it is identical to the tutorials. Does anyone know what could be happening? Could the spike relay or the sidecar be faulty?
If there is no light on the DSC relay channel the spike isn't malfunctioning (not yet at least).

How is your pressure switch wired?

You should have a signal wire and ground wire going to the switch. This cable should plug into a digital I/O port on the DSC.
See the wires on the pressure switch in this figure
__________________
http://team2168.org
Reply With Quote
  #8   Spotlight this post!  
Unread 09-02-2014, 10:00
fovea1959's Avatar
fovea1959 fovea1959 is offline
Herder of programmers
AKA: Doug Wegscheid
FRC #3620 (The Average Joes)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2011
Location: St Joseph
Posts: 332
fovea1959 will become famous soon enough
Re: Programming the Air Compressor and Pressure Switch

  1. put together a test project in RobotBuilder that has one subsystem, one relay output (where the compressor is) and one digital input (where the switch is).
  2. Load the project into the robot.
  3. Put the robot into test mode
  4. Go into the livewindow and manually try to turn the compressor on.
  5. If the compressor doesn't fire up, you've got data flow or power problem; if the compressor fires up, you know your wiring is good.
.
Reply With Quote
Reply


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


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

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