|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Output not updated enough
Quote:
here's the code: 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. */
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.templates;
import com.sun.squawk.Driver;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Timer;
/**
* The VM is configured to automatically run this class, and to call the
* functions corresponding to each mode, as described in the SimpleRobot
* 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 RobotTemplate extends SimpleRobot {
RobotDrive Drive = new RobotDrive(1, 2);
Joystick stick = new Joystick(1);
/**robot work
* This function is called once each time the robot enters autonomous mode.
*/
public void autonomous() {
}
/**
* This function is called once each time the robot enters operator control.
*/
public void operatorControl() {
while(isEnabled() && isAutonomous()){
Drive.setSafetyEnabled(true);
Drive.arcadeDrive(stick);
Timer.delay(0.0004);
}
}
}
|
|
#2
|
||||||
|
||||||
|
Re: Output not updated enough
Quote:
Your delay is also very short, only 400 microseconds. The motors will only be updated at 5 ms, so use a delay of at least 0.005. You only get new joystick data every 20ms, so if you're only doing operator control, you can have a delay of 0.02 |
|
#3
|
||||
|
||||
|
Re: Output not updated enough
It works, I forgot about that. I used auto complete and did not check what was put there, Thank you!
|
|
#4
|
||||
|
||||
|
Re: Output not updated enough
how would I figure out how long I get back data from a HID or sensor?, is there a way to find out?
I added something else to the code now, and I am still getting the same error, I tried increasing and decreasing the delay and the same error still, I even enabled the Safety and disabled. 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. */
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.*;
/**
* The VM is configured to automatically run this class, and to call the
* functions corresponding to each mode, as described in the SimpleRobot
* 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 RobotTemplate extends SimpleRobot {
RobotDrive Drive = new RobotDrive(1, 2);
Joystick stick = new Joystick(1);
Victor m_shooter1 = new Victor(3);
Victor m_shooter2 = new Victor(3);
/**
* This function is called once each time the robot enters autonomous mode.
*/
public void autonomous() {
}
/**
* This function is called once each time the robot enters operator control.
*/
public void operatorControl() {
while(isOperatorControl()){
Drive.arcadeDrive(stick);
Timer.delay(0.001);
m_shooter1.set((stick.getThrottle()/2)-0.5);
m_shooter1.set(((stick.getThrottle()/2)-0.5)*-1);
}
}
}
Last edited by krudeboy51 : 15-01-2012 at 12:49. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|