Go to Post None. Ours is anorexic at the moment. Lets see if the building people can come up with a simple tetra-knockdown mechanism. - Fixen [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 Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 13-01-2012, 16:23
sebflippers sebflippers is offline
Registered User
FRC #2914
 
Join Date: Jan 2012
Location: dc
Posts: 56
sebflippers will become famous soon enoughsebflippers will become famous soon enough
not able to get any programs to work

Hi all,
I have absolutely no idea what is causing this problem, so I just decided to post in this section of the forum. Before the season started, I started doing simple things like getting led's to blink (this is our first year using java). I used image 28 and whatever netbeans plugin version at that time. I got plenty of things working (putting it all in the robotinit() section in the iterative template). Anyway, I have been trying to get some relays and solenoids to work, but nothing worked, so I threw away all of those programs. Just now it occurred to me that nothing has been working since I updated the cRio and Netbeans plugins. The programs still get uploaded. Netbeans says so. But nothing works. Some other things I have noticed: All Digital outputs are at 5v (even though they were not referenced in the code). Also, they solenoids go 1v-0v-1v-0v at 1 second intervals.

Don't worry, I understand the new way of referencing slots, and have updated my code accordingly. Here is an example:

package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.*;
public class RobotTemplate extends IterativeRobot {
Relay twoWay = new Relay(1,1)
public void robotInit() {
twoWay.set(Relay.Value.kForward);
}}

with the digital module in slot 2. Also, when I reimaged the cRio, I had to format it with labview and the new image, and then go back and change it to java.

any Ideas?
Reply With Quote
  #2   Spotlight this post!  
Unread 13-01-2012, 17:35
ProgrammerMatt ProgrammerMatt is offline
Programmer-Electrical-Mechanical
FRC #0228 (Gus)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Southington
Posts: 138
ProgrammerMatt is just really niceProgrammerMatt is just really niceProgrammerMatt is just really niceProgrammerMatt is just really nice
Re: not able to get any programs to work

Try these

Before class:
Code:
import edu.wpi.first.wpilibj.Relay;
import edu.wpi.first.wpilibj.Solenoid;

Use this:
In main class:

Code:
Relay r1;
Solenoid s1;
In robotInit:
Code:
r1 = new Relay(#); // What ever port its in replace #
s1 = new solenoid(#); // What ever port its in replace #
in operator control:
Code:
r1.set(Relay.Value.kOn); // kOff for off
s1.set(true);  //false for off

Last edited by ProgrammerMatt : 13-01-2012 at 17:40.
Reply With Quote
  #3   Spotlight this post!  
Unread 13-01-2012, 17:44
RufflesRidge RufflesRidge is offline
Registered User
no team
 
Join Date: Jan 2012
Location: USA
Posts: 990
RufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant future
Re: not able to get any programs to work

Putting "everything" in robotInit is a bit strange and probably not what you want to do. The robot outputs (PWM and relays) will not be enabled unless the robot is enabled. Which means that your code to set those outputs should probably be in one of the teleop or autonomous methods.
Reply With Quote
  #4   Spotlight this post!  
Unread 13-01-2012, 17:44
sebflippers sebflippers is offline
Registered User
FRC #2914
 
Join Date: Jan 2012
Location: dc
Posts: 56
sebflippers will become famous soon enoughsebflippers will become famous soon enough
Re: not able to get any programs to work

interesting...I'll try it.
Reply With Quote
  #5   Spotlight this post!  
Unread 13-01-2012, 17:45
sebflippers sebflippers is offline
Registered User
FRC #2914
 
Join Date: Jan 2012
Location: dc
Posts: 56
sebflippers will become famous soon enoughsebflippers will become famous soon enough
Re: not able to get any programs to work

Quote:
Originally Posted by RufflesRidge View Post
Putting "everything" in robotInit is a bit strange and probably not what you want to do. The robot outputs (PWM and relays) will not be enabled unless the robot is enabled. Which means that your code to set those outputs should probably be in one of the teleop or autonomous methods.
It worked really well before the update. How can I enable it (preferably without having to plug a laptop in to it whenever I need it)?
Reply With Quote
  #6   Spotlight this post!  
Unread 13-01-2012, 17:59
RufflesRidge RufflesRidge is offline
Registered User
no team
 
Join Date: Jan 2012
Location: USA
Posts: 990
RufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant future
Re: not able to get any programs to work

Quote:
Originally Posted by sebflippers View Post
It worked really well before the update. How can I enable it (preferably without having to plug a laptop in to it whenever I need it)?
The robot is enabled using the Driver's Station software either running on the same computer as you are using to code, or a separate computer.
Reply With Quote
  #7   Spotlight this post!  
Unread 13-01-2012, 18:33
sebflippers sebflippers is offline
Registered User
FRC #2914
 
Join Date: Jan 2012
Location: dc
Posts: 56
sebflippers will become famous soon enoughsebflippers will become famous soon enough
Re: not able to get any programs to work

Just realized something that might be relevant. The last lines I have in the output section in netbeans are:

[cRIO] Default IterativeRobot.disabledInit() method... Overload me!
[cRIO] Default IterativeRobot.disabledContinuous() method... Overload me!

If i'm not mistaken these are the methods that are currently running, and if (yet again) i'm not mistaken one of those used to be IterativeRobot.robotInit().
When I get back to the lab I'll upload the same code but in the disabledInit() instead of robotInit().
Reply With Quote
  #8   Spotlight this post!  
Unread 13-01-2012, 18:36
RufflesRidge RufflesRidge is offline
Registered User
no team
 
Join Date: Jan 2012
Location: USA
Posts: 990
RufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant future
Re: not able to get any programs to work

Quote:
Originally Posted by sebflippers View Post
Just realized something that might be relevant. The last lines I have in the output section in netbeans are:

[cRIO] Default IterativeRobot.disabledInit() method... Overload me!
[cRIO] Default IterativeRobot.disabledContinuous() method... Overload me!

If i'm not mistaken these are the methods that are currently running, and if (yet again) i'm not mistaken one of those used to be IterativeRobot.robotInit().
When I get back to the lab I'll upload the same code but in the disabledInit() instead of robotInit().
robotInit should always be called first (right after your constructor). Those messages indicate that those methods are running (they should be) and that you haven't put anything in them. If you override those methods with your own code they will go away.

You need to enable your robot using the Driver's Station software.
Reply With Quote
  #9   Spotlight this post!  
Unread 13-01-2012, 19:08
gixxy's Avatar
gixxy gixxy is offline
Programming and Arduino Mentor
AKA: Gustave Michel III
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Nov 2011
Rookie Year: 2012
Location: Ruston, LA
Posts: 207
gixxy is on a distinguished road
Re: not able to get any programs to work

1. if it plugged into the digital sidecar, check the ribbon cable is made properly. (if this was the problem with our sidecar (we havn't retested it yet) then if the solenoid is supposed to be in PWM slot 1, put it in slot 3 and try, at the least this was a problem we seemed to have....

PDF on fixing the DB37 cable:
http://www.usfirst.org/sites/default...structions.pdf
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 18:01.

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