Go to Post CD threads are supposed to be about something? - Tim Baird [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-02-2010, 17:47
Twisted eric's Avatar
Twisted eric Twisted eric is offline
Registered User
FRC #0581
 
Join Date: Jan 2010
Location: San Jose
Posts: 54
Twisted eric is an unknown quantity at this point
Question Programming the teleop

My programming team are stuck

like the title says I'm tying to program I don't know what I'm missing


code

package edu.wpi.first.wpilibj.templates;

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.Watchdog;

public class Demonized extends SimpleRobot {

RobotDrive drive = new RobotDrive(1, 2);
Joystick leftStick = new Joystick(1);
Joystick rightStick = new Joystick(2);
Watchdog Fenrir = Watchdog.getInstance();

public void autonomous() {
while(true && isAutonomous() && isEnabled())
for (int i = 0; i < 4; i++) {
Fenrir.feed();
drive.drive(0.5, 0.0); // drive 50% fwd 0% turn
Fenrir.feed();
drive.drive(0.0, 0.5);
}
drive.drive(0.0, 0.0); // drive 0% fwd, 0% turn
}

public void operatorControl() {
while (true && isOperatorControl() && isEnabled()) // loop until change
{
drive.tankDrive(leftStick, rightStick);
Timer.delay(0.005);
Fenrir.feed();
}
}
}



help will be much appreciated

team 581

Last edited by Twisted eric : 16-02-2010 at 17:27. Reason: code update
Reply With Quote
  #2   Spotlight this post!  
Unread 16-02-2010, 16:04
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 592
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: Programming the teleop

You need to "feed" the watchdog timer in the operatorControl() method. I'm not sure if that's what you're seeing, but I would expect that you are getting a "Watchdog not fed" message on the driver station.

Insert a Fenrir.feed() in the loop with the drive.tankDrive() call.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
Reply With Quote
  #3   Spotlight this post!  
Unread 16-02-2010, 17:26
Twisted eric's Avatar
Twisted eric Twisted eric is offline
Registered User
FRC #0581
 
Join Date: Jan 2010
Location: San Jose
Posts: 54
Twisted eric is an unknown quantity at this point
Re: Programming the teleop

Thank you that was what i was missing any help with the pneumatic compressor.
Reply With Quote
  #4   Spotlight this post!  
Unread 16-02-2010, 18:18
Twisted eric's Avatar
Twisted eric Twisted eric is offline
Registered User
FRC #0581
 
Join Date: Jan 2010
Location: San Jose
Posts: 54
Twisted eric is an unknown quantity at this point
Re: Programming the teleop

code

package edu.wpi.first.wpilibj.templates;

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.Watchdog;
import edu.wpi.first.wpilibj.Compressor;


public class Demonized extends SimpleRobot {

RobotDrive drive = new RobotDrive(1, 2);
Joystick leftStick = new Joystick(1);
Joystick rightStick = new Joystick(2);
Watchdog Fenrir = Watchdog.getInstance();
Compressor Siberian = new Compressor(1,1);


public void autonomous() {
while(true && isAutonomous() && isEnabled())
for (int i = 0; i < 4; i++) {
Fenrir.feed();
drive.drive(0.5, 0.0); // drive 50% fwd 0% turn
Fenrir.feed();
drive.drive(0.0, 0.5);
}
drive.drive(0.0, 0.0); // drive 0% fwd, 0% turn
}

public void operatorControl() {
while (true && isOperatorControl() && isEnabled()) // loop until change
{
drive.tankDrive(leftStick, rightStick);
Timer.delay(0.005);
Fenrir.feed();
}
}
}




new code update
Reply With Quote
  #5   Spotlight this post!  
Unread 16-02-2010, 18:36
Robototes2412's Avatar
Robototes2412 Robototes2412 is offline
1 * 4 != 14
FRC #2412 (Robototes)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2007
Location: Bellevue
Posts: 312
Robototes2412 is on a distinguished road
Re: Programming the teleop

add a Siberian.start() to the outside of your while loop
Reply With Quote
  #6   Spotlight this post!  
Unread 16-02-2010, 18:53
Twisted eric's Avatar
Twisted eric Twisted eric is offline
Registered User
FRC #0581
 
Join Date: Jan 2010
Location: San Jose
Posts: 54
Twisted eric is an unknown quantity at this point
Re: Programming the teleop

Quote:
Originally Posted by Robototes2412 View Post
add a Siberian.start() to the outside of your while loop
which wiled loop auto or tele op

OH
and can everyone help with sensing pressure and every thing first time using java.
Reply With Quote
  #7   Spotlight this post!  
Unread 16-02-2010, 18:57
Robototes2412's Avatar
Robototes2412 Robototes2412 is offline
1 * 4 != 14
FRC #2412 (Robototes)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2007
Location: Bellevue
Posts: 312
Robototes2412 is on a distinguished road
Talking Re: Programming the teleop

i reccomend you make a setupRobot method for stuff like that.

insert the following inbetween the autonomous and teleop code

Code:
void setUpRobot() {
Siberian.start();
Fernir.feed();
}
then just add setUpRobot(); to your teleop and autonomous code.

That should fix it
Reply With Quote
  #8   Spotlight this post!  
Unread 16-02-2010, 19:10
Twisted eric's Avatar
Twisted eric Twisted eric is offline
Registered User
FRC #0581
 
Join Date: Jan 2010
Location: San Jose
Posts: 54
Twisted eric is an unknown quantity at this point
Re: Programming the teleop

Quote:
Originally Posted by Robototes2412 View Post
i reccomend you make a setupRobot method for stuff like that.

insert the following inbetween the autonomous and teleop code

Code:
void setUpRobot() {
Siberian.start();
Fernir.feed();
}
then just add setUpRobot(); to your teleop and autonomous code.

That should fix it
Thanks

do you know how to sense pressure value and auto shut off

Thanks in advance and sorry for so-many questions.
Reply With Quote
  #9   Spotlight this post!  
Unread 16-02-2010, 20:11
Robototes2412's Avatar
Robototes2412 Robototes2412 is offline
1 * 4 != 14
FRC #2412 (Robototes)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2007
Location: Bellevue
Posts: 312
Robototes2412 is on a distinguished road
Re: Programming the teleop

Dude, its ok, i had the same questions.

it will automatically shut off as long as the wiring is correct (check the diagrams), so programming can now rest easy.
Reply With Quote
  #10   Spotlight this post!  
Unread 16-02-2010, 20:48
Twisted eric's Avatar
Twisted eric Twisted eric is offline
Registered User
FRC #0581
 
Join Date: Jan 2010
Location: San Jose
Posts: 54
Twisted eric is an unknown quantity at this point
Re: Programming the teleop

Quote:
Originally Posted by Robototes2412 View Post
Dude, its ok, i had the same questions.

it will automatically shut off as long as the wiring is correct (check the diagrams), so programming can now rest easy.
in the pneumatics manual here (http://www.usfirst.org/uploadedFiles...%20Rev%20-.pdf)

says that there is no default program in the cRIO to control
the compressor power.
Reply With Quote
  #11   Spotlight this post!  
Unread 16-02-2010, 21:48
Robototes2412's Avatar
Robototes2412 Robototes2412 is offline
1 * 4 != 14
FRC #2412 (Robototes)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2007
Location: Bellevue
Posts: 312
Robototes2412 is on a distinguished road
Re: Programming the teleop

Quote:
Originally Posted by Twisted eric View Post
in the pneumatics manual here (http://www.usfirst.org/uploadedFiles...%20Rev%20-.pdf)

says that there is no default program in the cRIO to control
the compressor power.
its always worked for us
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Enable Teleop in Robot Main ThisAintJeff NI LabVIEW 4 04-02-2010 14:33
NXT Mindstorm Teleop EXamples johncap100 FIRST Tech Challenge 4 10-10-2009 09:48
problem with passing doubles back into the "TeleOp Execute" loop windell747 NI LabVIEW 1 21-03-2009 00:50
Teleop Lag Xavier Brandall Programming 14 17-03-2009 18:21
Detecting Start of TeleOp Mode Danny Diaz Programming 4 26-02-2008 01:37


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

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