Go to Post It is an honor and a privilege to be associated with such an outstanding group of people. And Arefin. - Gary Dillard [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 15-01-2012, 23:23
Stagger007 Stagger007 is offline
Registered User
FRC #4379
 
Join Date: Jan 2012
Location: Weston, FL
Posts: 10
Stagger007 is an unknown quantity at this point
Help With Programing

Hello my team is a rookie team and its the first time we do FRC and we finally got the java image on the cRIO now were running ode that is directly copied from the java guide and its not running. Our code is as follows:
package edu.wpi.first.wpilibj.templates;


import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Servo;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Joystick;

public class RobotTemplate extends SimpleRobot {
RobotDrive drive = new RobotDrive(1, 2);
Joystick leftStick = new Joystick(1);
Joystick rightStick = new Joystick(2);
/**
* This function is called once each time the robot enters autonomous mode.
*/
public void autonomous() {
for(int i =0; i < 4; i++){
drive.drive(0.5, 0.0);
Timer.delay(2.0);
drive.drive(0.0, 0.75);
Timer.delay(0.75);
}
drive.drive(0.0,0.0);
}

public void operatorControl() {
while (isOperatorControl() && isEnabled()){
drive.tankDrive(leftStick, rightStick);
Timer.delay(.005);

}

}
}
Reply With Quote
  #2   Spotlight this post!  
Unread 15-01-2012, 23:25
davidthefat davidthefat is offline
Alumni
AKA: David Yoon
FRC #0589 (Falkons)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2010
Location: California
Posts: 792
davidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud of
Re: Help With Programing

Is it not connecting to the computer or what?
BTW, I would not use the for loops. Remember the "action" is not done almost instantly, it takes time for a physical object to be actuated. I would also take out the delays.
__________________
Do not say what can or cannot be done, but, instead, say what must be done for the task at hand must be accomplished.
Reply With Quote
  #3   Spotlight this post!  
Unread 15-01-2012, 23:34
youxinche95 youxinche95 is offline
Registered User
AKA: Eugene Che
FRC #0649 (MSET)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Saratoga, CA
Posts: 18
youxinche95 is an unknown quantity at this point
Re: Help With Programing

It's great to see rookie teams dive into text based programming languages!

getWatchdog().feed()?

I think that's missing,

or did you not enable watchdog?

either way, the code looks fine other than that.
Reply With Quote
  #4   Spotlight this post!  
Unread 16-01-2012, 00:17
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: Help With Programing

Did you fix the db37 cable (the ribbon cable connecting the digital sidecar to the cRio) if not then the jaguars/victors will not work in ports 1 and 2. they will in ports 3 and 4 (we figured that out after a lot of testing)

here is the document on fixing the cable if it applies: http://www.usfirst.org/sites/default...structions.pdf
Reply With Quote
  #5   Spotlight this post!  
Unread 16-01-2012, 09:49
Stagger007 Stagger007 is offline
Registered User
FRC #4379
 
Join Date: Jan 2012
Location: Weston, FL
Posts: 10
Stagger007 is an unknown quantity at this point
Re: Help With Programing

i did not enable the watch do I'm not really sure what that does
Reply With Quote
  #6   Spotlight this post!  
Unread 16-01-2012, 10:48
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: Help With Programing

Basically the watchdog is a guardian. When enabled you need to "feed()" it and keep it happy. However if your code goes into an infinite loop or something the code will not be able to "feed()" the watchdog and it will die, and dis-activate the motors and other components with it, so that the robot doesn't go wild and break itself or something else.

However if you did not enable the watchdog, you should be fine not putting the code in for it.
Reply With Quote
  #7   Spotlight this post!  
Unread 16-01-2012, 11:33
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 590
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: Help With Programing

I just copied your program and pasted it into a new project and ran it. Other than the motor ports not matching mine, it seemed to run some motors, at least in autonomous. I didn't have joysticks on the test platform.

Were you seeing no movement at all? If so, I'd look for other problems, like (as has been said) the cable to the digital breakout board, or something else.

You should verify that the driver station software is set up properly and that you see green "Communications" and "Robot Code" indicators and that your team number is set correctly.

Let us know after trying those things.

Brad
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
Reply With Quote
  #8   Spotlight this post!  
Unread 16-01-2012, 11:59
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 590
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: Help With Programing

Quote:
Originally Posted by BradAMiller View Post
I just copied your program and pasted it into a new project and ran it. Other than the motor ports not matching mine, it seemed to run some motors, at least in autonomous. I didn't have joysticks on the test platform.
Brad
That was stupid... you know the test system had some servos that happened to be on those channels and naturally they moved before the motor safety stuff caught it. Change your autonomous code to look like this:
Code:
    public void autonomous() {
        drive.setSafetyEnabled(false);   // this turns off motor safety
        for (int i = 0; i < 4; i++) {
            drive.drive(0.5, 0.0);
            Timer.delay(2.0);
            drive.arcadeDrive(0.0, 0.75);  // this was a typo in the book
            Timer.delay(0.75);
        }
        drive.drive(0.0, 0.0);
    }
Brad
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
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:11.

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