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
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.
Thank you that was what i was missing any help with the pneumatic compressor.
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
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.
i reccomend you make a setupRobot method for stuff like that.
insert the following inbetween the autonomous and teleop code
void setUpRobot() {
Siberian.start();
Fernir.feed();
}
then just add setUpRobot(); to your teleop and autonomous code.
That should fix it
anon44095623:
i reccomend you make a setupRobot method for stuff like that.
insert the following inbetween the autonomous and teleop 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.
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.
anon44095623:
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/Community/FRC /Game_and_Season__Info/2010_Assets/2010%20Pneumatics%20Manual%20Rev%20-.pdf )
says that there is no default program in the cRIO to control
the compressor power.