|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
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 |
|
#2
|
|||
|
|||
|
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. |
|
#3
|
||||
|
||||
|
Re: Programming the teleop
Thank you that was what i was missing any help with the pneumatic compressor.
|
|
#4
|
||||
|
||||
|
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 |
|
#5
|
||||
|
||||
|
Re: Programming the teleop
add a Siberian.start() to the outside of your while loop
|
|
#6
|
||||
|
||||
|
Re: Programming the teleop
which wiled loop auto or tele op
OH and can everyone help with sensing pressure and every thing first time using java. |
|
#7
|
||||
|
||||
|
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();
}
That should fix it ![]() |
|
#8
|
||||
|
||||
|
Re: Programming the teleop
Quote:
do you know how to sense pressure value and auto shut off Thanks in advance and sorry for so-many questions. |
|
#9
|
||||
|
||||
|
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. ![]() |
|
#10
|
||||
|
||||
|
Re: Programming the teleop
Quote:
says that there is no default program in the cRIO to control the compressor power. |
|
#11
|
||||
|
||||
|
Re: Programming the teleop
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |