![]() |
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 |
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. |
Re: Programming the teleop
Thank you that was what i was missing any help with the pneumatic compressor.
|
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 |
Re: Programming the teleop
add a Siberian.start() to the outside of your while loop
|
Re: Programming the teleop
Quote:
OH and can everyone help with sensing pressure and every thing first time using java. |
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() {That should fix it :D |
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. |
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 |
Re: Programming the teleop
Quote:
says that there is no default program in the cRIO to control the compressor power. |
Re: Programming the teleop
Quote:
|
| 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