Go to Post FIRST- its a pandemic in all our schools. - Akash Rastogi [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 Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 06-02-2012, 19:57
Jengles's Avatar
Jengles Jengles is offline
Registered User
FRC #4753 (Bexley Lions)
Team Role: Leadership
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Bexley, Ohio
Posts: 45
Jengles will become famous soon enough
"Output not updated often enough" Error

Code:
package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Relay;
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.Joystick.AxisType;
import edu.wpi.first.wpilibj.Watchdog;
import edu.wpi.first.wpilibj.Timer;
import java.lang.Math;

public class RobotTemplate extends IterativeRobot {

         RobotDrive drive;

         Joystick leftStick;
         Joystick rightStick;

         // Left and Right Drive Motors
         Jaguar leftMotor1;
	 Jaguar leftMotor2;
         Jaguar rightMotor1;
         Jaguar rightMotor2;
 
         // Channels for Left and Right mobility motors.
         static final int leftMotorChannel1 = 1;
         static final int leftMotorChannel2 = 2;
         static final int rightMotorChannel1 = 3;
         static final int rightMotorChannel2 = 4;

         // Deadzone Variables
         static final double deadzonePercent = .05;

    public void robotInit() {
        
         //Initialize Drive Motors
	 leftMotor1=new Jaguar(leftMotorChannel1);
	 leftMotor2=new Jaguar(leftMotorChannel2);
	 rightMotor1=new Jaguar(rightMotorChannel1);
	 rightMotor2=new Jaguar(rightMotorChannel2); 

         drive = new RobotDrive(leftMotor2,leftMotor1,rightMotor2,rightMotor1);
         leftStick = new Joystick(1);
         rightStick = new Joystick(2);
    }

    public void teleopPeriodic() {
        
   	Watchdog.getInstance().feed();
        drive.tankDrive(deadzone(leftStick.getY()),deadzone(rightStick.getY()));
    }

    public double deadzone(double joyVal) {
       if (joyVal < deadzonePercent && joyVal > -deadzonePercent)
           return 0;
       else if(joyVal > deadzonePercent)
           return (joyVal/(1-deadzonePercent) - (1/(1-deadzonePercent)*deadzonePercent));
       else
           return (joyVal/(1-deadzonePercent) + (1/(1-deadzonePercent)*deadzonePercent));
    }
}
We are experiencing this problem. Our motors are running fine, though we continue to get this error, we're wondering if it's because iterative robot is checking for output and we are not giving it Joystick output fast enough.

Is there a way we can modify the delay time it requires or is the only option to set setSafteyEnabled to false?
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


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

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