Go to Post The term defensive robot and mechanum wheels do not belong in the same sentence together. - Koko Ed [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

 
 
 
Thread Tools Rating: Thread Rating: 3 votes, 3.67 average. Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 15-12-2010, 16:11
kinganu123 kinganu123 is offline
Registered User
FRC #1747
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Piscataway, NJ
Posts: 243
kinganu123 is on a distinguished road
Watchdog Not Fed

Ok, so we're basically recoding our bot from last year
For some reason, our watchdog is not being fed
Here is the java code:
Code:
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Solenoid;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Watchdog;
import edu.wpi.first.wpilibj.camera.*;
import edu.wpi.first.wpilibj.Relay;
import edu.wpi.first.wpilibj.PWM;
public class robot10 extends IterativeRobot {
    Joystick joystick=new Joystick(1);
    DriverStation driverstation=DriverStation.getInstance();
    AxisCamera camera;
    RobotDrive mecanumWheels= new RobotDrive(1,2,3,4);
    Solenoid extend1=new Solenoid(1);
    Solenoid retract1=new Solenoid(2);
    Solenoid extend2=new Solenoid(3);
    Solenoid retract2=new Solenoid(4);
    int b=0;
    Relay compressor=new Relay(4,1);
    PWM vacuum=new PWM(5);
    PWM camServo=new PWM(6);
    Watchdog watchdog=Watchdog.getInstance();

    public void robotInit() {
        compressor.set(Relay.Value.kOn);
        camera=AxisCamera.getInstance();
        watchdog.setEnabled(true);
        watchdog.feed();
    }

    public void autonomousPeriodic() {
        watchdog.setEnabled(true);
        if(b==0){
            watchdog.setEnabled(false);
            watchdog.kill();
            autoBot();
            b++;
        }
        watchdog.feed();
    }

    public void teleopPeriodic() {
        mecanumWheels.holonomicDrive(joystick.getMagnitude(), joystick.getDirectionDegrees(), joystick.getTwist());
        if(joystick.getRawButton(1))
        {
            retract1.set(false);
            retract2.set(false);
            extend1.set(true);
            extend2.set(true);
        }else{
            extend1.set(false);
            extend2.set(false);
            retract1.set(true);
            retract2.set(true);
        }
        camServo.setPosition(joystick.getThrottle());
        if(joystick.getRawButton(2))
            vacuum.setRaw(255);
        else
            vacuum.setRaw(0);
        watchdog.feed();
    }

    public void autoBot(){
        Timer.delay(5);
        mecanumWheels.arcadeDrive(255, 0);
        Timer.delay(2);
        extend1.set(true);
        extend2.set(true);
        Timer.delay(1);
        extend1.set(false);
        extend2.set(false);
        retract1.set(true);
        retract2.set(true);
        Timer.delay(2);
        retract1.set(false);
        retract2.set(false);
        extend1.set(true);
        extend2.set(true);
        Timer.delay(1);
        extend1.set(false);
        extend2.set(false);
        retract1.set(true);
        retract2.set(true);
        Timer.delay(2);
        retract1.set(false);
        retract2.set(false);
        extend1.set(true);
        extend2.set(true);
        Timer.delay(1);
        extend1.set(false);
        extend2.set(false);
        retract1.set(true);
        retract2.set(true);
        Timer.delay(1);
        retract1.set(false);
        retract2.set(false);
        watchdog.feed();
    }

    public void disabledInt(){
        compressor.set(Relay.Value.kOff);
    }

    public void disabledPeriodic(){
        watchdog.feed();
    }
}
Our labview code (which works fine) is in the attachment
Attached Files
File Type: zip Team 224 Code 0.zip (1.99 MB, 65 views)
__________________
Reply With Quote
 


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
Watchdog not fed brianelite C/C++ 12 14-03-2010 14:43
Watchdog Not Fed! masoug C/C++ 5 24-02-2010 19:59
Autonomous Independent Code Issue Watchdog not fed pilum40 FRC Control System 0 11-02-2010 12:00
Watchdog Not Fed but, All Systems Are Go. DHSrobotics Java 4 24-01-2010 22:01
Watchdog not fed ahudson Programming 1 22-01-2010 11:26


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

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