Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Programming the teleop (http://www.chiefdelphi.com/forums/showthread.php?t=82749)

Twisted eric 15-02-2010 17:47

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

BradAMiller 16-02-2010 16:04

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.

Twisted eric 16-02-2010 17:26

Re: Programming the teleop
 
Thank you that was what i was missing any help with the pneumatic compressor.

Twisted eric 16-02-2010 18:18

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

Robototes2412 16-02-2010 18:36

Re: Programming the teleop
 
add a Siberian.start() to the outside of your while loop

Twisted eric 16-02-2010 18:53

Re: Programming the teleop
 
Quote:

Originally Posted by Robototes2412 (Post 921508)
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.

Robototes2412 16-02-2010 18:57

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 :D

Twisted eric 16-02-2010 19:10

Re: Programming the teleop
 
Quote:

Originally Posted by Robototes2412 (Post 921529)
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 :D

Thanks

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

Thanks in advance and sorry for so-many questions.

Robototes2412 16-02-2010 20:11

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. :D

Twisted eric 16-02-2010 20:48

Re: Programming the teleop
 
Quote:

Originally Posted by Robototes2412 (Post 921589)
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. :D

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.

Robototes2412 16-02-2010 21:48

Re: Programming the teleop
 
Quote:

Originally Posted by Twisted eric (Post 921606)
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


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

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi