Go to Post If robotics is bad for you, well then I guess I'm gonna die. At least I'll die happy. - karinka13 [more]
Home
Go Back   Chief Delphi > Technical > Control System
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 18-02-2010, 16:43
batmankiller batmankiller is offline
Registered User
None #2601
 
Join Date: Jan 2010
Location: New York City
Posts: 15
batmankiller is an unknown quantity at this point
Status driver station issue

On the driver station when teleoperated mode is enabled.. the robot moves.. but in the status where you see "No robot communication... Teleporated mode enabled.. etc" the words Watchdog not fed and teleoperated enabled flash back and forth but the robot is still running so I'm confused....we used thread.yield a lot is this the issue or?
Reply With Quote
  #2   Spotlight this post!  
Unread 18-02-2010, 20:27
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Status driver station issue

If you are feeding the watchdog, but not feeding as often as you said you would, you'll get this behavior. I'd inspect the code to see how often and for how long your yields are delaying the code. Certain routines such as Teleop need to return quickly or they will cause you to miss joystick packets. If these are OK, look to either feed more often or adjust the period so that it doesn't expect to be fed any more often.

Remember. The user watchdog helps you know when your code isn't running as often as you thought it would, and gives it a way to fail safely when certain mistakes are made such as crashing or infinite loops.

Greg McKaskle
Reply With Quote
  #3   Spotlight this post!  
Unread 19-02-2010, 11:25
SteveD SteveD is offline
Registered User
FRC #0888
 
Join Date: Jan 2010
Location: Glenelg, MD
Posts: 21
SteveD is an unknown quantity at this point
Re: Status driver station issue

Isnt there a new update released that is suppose to help rid this watchdog error? http://digital.ni.com/public.nsf/web...D?OpenDocument
Reply With Quote
  #4   Spotlight this post!  
Unread 19-02-2010, 11:31
batmankiller batmankiller is offline
Registered User
None #2601
 
Join Date: Jan 2010
Location: New York City
Posts: 15
batmankiller is an unknown quantity at this point
Re: Status driver station issue

Quote:
Originally Posted by Greg McKaskle View Post
If you are feeding the watchdog, but not feeding as often as you said you would, you'll get this behavior. I'd inspect the code to see how often and for how long your yields are delaying the code. Certain routines such as Teleop need to return quickly or they will cause you to miss joystick packets. If these are OK, look to either feed more often or adjust the period so that it doesn't expect to be fed any more often.

Remember. The user watchdog helps you know when your code isn't running as often as you thought it would, and gives it a way to fail safely when certain mistakes are made such as crashing or infinite loops.

Greg McKaskle
We're using iterative robot template.. so do we put it in teleop periodic?

Here's our code... if anyone's intersted

Code:
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved.                             */
/* Open Source Software - may be modified and shared by FRC teams. The code   */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project.                                                               */
/*----------------------------------------------------------------------------*/

//Sky Hawk
package edu.wpi.first.wpilibj.templates;


import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.Gyro;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.PIDController;
import edu.wpi.first.wpilibj.PIDOutput;
//import edu.wpi.first.wpilibj.Relay;

import edu.wpi.first.wpilibj.Solenoid;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Victor;
import edu.wpi.first.wpilibj.camera.AxisCamera;
import edu.wpi.first.wpilibj.camera.AxisCameraException;
import edu.wpi.first.wpilibj.image.ColorImage;
import edu.wpi.first.wpilibj.image.NIVisionException;


/**
 * The VM is configured to automatically run this class, and to call the
 * functions corresponding to each mode, as described in the IterativeRobot
 * documentation. If you change the name of this class or the package after
 * creating this project, you must also update the manifest file in the resource
 * directory.
 */
public class SkyHawkVersion3 extends IterativeRobot {

    double kScoreThreshold = .01;
    AxisCamera cam;
    private DigitalInput i1 = new DigitalInput(2);
    private DigitalInput i2 = new DigitalInput(3);
    private Solenoid s1, s2, s4, s3;
    private Compressor airCompressor;
    Gyro gyro = new Gyro(1);
    private Victor roller = new Victor(6);
    private Victor flyWheel = new Victor(5);
    private Victor release = new Victor(8);
    private Victor arm = new Victor(7);
    //private Relay spike1 = new Relay(1);//Relfay 1
    private Joystick stickRight = new Joystick(1);//USB 1
    private Joystick stickLeft = new Joystick(2);//USB 2
    private Jaguar rightBackJaguar = new Jaguar(1);//PWM 1
    private Jaguar rightFrontJaguar = new Jaguar(2);//PWM 2
    private Jaguar leftBackJaguar = new Jaguar(3);//PWM 3
    private Jaguar leftFrontJaguar = new Jaguar(4);//PWM 4
    private double sensitivity1;//Right Joystick Sensitivity
    private double sensitivity2;//Winder sensitivity
    private double y2;//Left Joystick Y-axis
    private double x2;//Left Joystick X-axis
    private double y1;//Right Joystick Y-axis
    private double x1;//Right Joystick X-axis
    private double rightBackSpeed;
    private double rightFrontSpeed;
    private double leftBackSpeed;
    private double leftFrontSpeed;
    TrackerDashboard trackerDashboard = new TrackerDashboard();

     PIDController turnController = new PIDController(.08, 0.0, 0.5, gyro, new PIDOutput() {

        public void pidWrite(double output) {
           // drive.arcadeDrive(0, output);
        }
    }, .005);


    public void Airsystem() //turns on the enitre air system
    {

          airCompressor = new Compressor(1,2);  //Digtial I/O,Relay
          airCompressor.start();               // Start the air compressor
          s1 = new Solenoid(1);               // Solenoid port
          s2 = new Solenoid(2);
          s3 = new Solenoid(3);
          s4 = new Solenoid(4);
          s1.set(true);
          s2.set(false);
          s3.set(false);
          s4.set(false);
     }



    public void kickFlyWheel()//DOES EVERYTHING THAT INCLUDES KICKING
    {
        roller.set(.5);
        flyWheel.set(-1*sensitivity2);
        if(((stickLeft.getRawButton(1))))
        {
            roller.set(0);
            Timer.delay(.5);
              s2.set(false);
              s1.set(true);
            Timer.delay(.75);
            s1.set(false);
            s2.set(true);
        }
         roller.set(.5);
    }



    public void robotInit() //Initializes functions prior to start of the match
    {
        getWatchdog().setExpiration(0.2);
        Timer.delay(10.0);
        cam = AxisCamera.getInstance();
        cam.writeResolution(AxisCamera.ResolutionT.k320x240);
        cam.writeBrightness(0);
        gyro.setSensitivity(.007);
        turnController.setInputRange(-360.0, 360.0);
        turnController.setTolerance(1 / 90. * 100);
        turnController.disable();
       Airsystem();
    }

//Strafing
    public void mecanumDrive()
    {
        y1= -1* stickRight.getY();
        x1=  -1*stickRight.getX();
        y2= stickLeft.getY();
        x2= stickLeft.getX();
        sensitivity1= -1*((((stickRight.getRawAxis(3))+1)/2)+.01);//Throttle is now
                                                             //from 1% to 100%
        sensitivity2= -1*((((stickLeft.getRawAxis(3))+1)/2)+.01);//Throttle is now
                                                             //from 1% to 100%
        rightBackSpeed = sensitivity1*(y1-x1);
        rightFrontSpeed = sensitivity1*(y1+x1);
        leftBackSpeed = sensitivity1*(y2+x2);
        leftFrontSpeed = sensitivity1*(y2-x2);
        rightBackJaguar.set(rightBackSpeed);
        rightFrontJaguar.set(rightFrontSpeed);
        leftFrontJaguar.set(leftFrontSpeed);
        leftBackJaguar.set(leftBackSpeed);
    }

    public void autonomousPeriodic() {
        try {
            //Camera crapthingy
                if (cam.freshImage()) {// && turnController.onTarget()) {
                    double gyroAngle = gyro.pidGet();
                    ColorImage image = cam.getImage();
                    Thread.yield();
                    Target[] targets = Target.findCircularTargets(image);
                    Thread.yield();
                    image.free();

                }
                    } catch (NIVisionException ex) {
                        ex.printStackTrace();
                    } catch (AxisCameraException ex) {
                        ex.printStackTrace();
                    }
        //End camera crapthingit

        if ((i1.get())&&!(i2.get()))
        {
           // Front position Autonomous code
        }

        if (!(i1.get())&&!(i2.get()))
        {
           // Middle position Autonomous code
        }

        if (!(i1.get())&&(i2.get()))
        {
           // Far position Autonomous code
        }
    }

    /**
     * This function is called while the robot is disabled.
     */
    public void disabledPeriodic()
    {
   // airCompressor.setRelayValue(edu.wpi.first.wpilibj. Relay.Value.kOff);
    }

    /**
     * This function is called at the beginning of teleop
     */

    public void autonomousInit()
    {



    }

   public void compressorCheck() //turns on/off compressor based on full
   {
       if (airCompressor.getPressureSwitchValue()) {
            airCompressor.setRelayValue(edu.wpi.first.wpilibj. Relay.Value.kOff);
            } else {
            airCompressor.setRelayValue(edu.wpi.first.wpilibj. Relay.Value.kOn);
            }
   }
    public void teleopInit() {
    }
    boolean lastTrigger = false;

    /**
     * This function is called periodically during operator control
     */
    public void teleopPeriodic() {
        getWatchdog().feed();
        long startTime = Timer.getUsClock();
       
        //Canera

            try {
                if (cam.freshImage()) {// && turnController.onTarget()) {
                    double gyroAngle = gyro.pidGet();
                    ColorImage image = cam.getImage();
                    Thread.yield();
                    Target[] targets = Target.findCircularTargets(image);
                    Thread.yield();
                    image.free();

                    

                }
            } catch (NIVisionException ex) {
                ex.printStackTrace();
            } catch (AxisCameraException ex) {
                ex.printStackTrace();
            }
            Thread.yield();
            mecanumDrive();
            Thread.yield();
            kickFlyWheel();
            Thread.yield();
            //pneumaticsKicker();
            compressorCheck();
            Thread.yield();


           // System.out.println("Time : " + (Timer.getUsClock() - startTime) / 1000000.0);
            //System.out.println("Gyro Angle: " + gyro.getAngle());


                }
    }

Last edited by batmankiller : 19-02-2010 at 11:40.
Reply With Quote
Reply


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
A Captian and Driver Issue R.C. General Forum 26 27-10-2010 00:41
Driver Station Missing 'nicyapi.dll' Issue. Twisted eric Programming 4 14-02-2010 21:14
2009 Driver Station Issue EricWilliams Control System 5 22-01-2010 14:59
2010 Driver Station Netbook Driver Account and Java joshholat FRC Control System 2 10-01-2010 15:04
Driver Station Watch Dog / Motor Won't Spin Issue RMiller FRC Control System 5 20-01-2009 09:58


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

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