| tutkows1 |
25-01-2010 23:23 |
Camera Lag
I'm having a hard time reducing the amount of lag i get from live camera feed. I have tried messing with compression and resolution but i still have like a 5 secound lag.
The following code, writen in Java, is the example dashboard code with camera feed added, i put my additions, camera feed code, in blue.
Quote:
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.AnalogModule;
import edu.wpi.first.wpilibj.Dashboard;
import edu.wpi.first.wpilibj.DigitalModule;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.DriverStationLCD;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.Solenoid;
import edu.wpi.first.wpilibj.Watchdog;
import edu.wpi.first.wpilibj.camera.AxisCamera;
/**
* 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.
*/
/*This Dashboard example has been modified to
* output camera feed on the driver station
* --Mark Tutkowski--
*/
public class DashBoardExample extends IterativeRobot {
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
AxisCamera.getInstance().writeResolution(AxisCamer a.ResolutionT.k160x120);
AxisCamera.getInstance().writeBrightness(0);
Watchdog.getInstance().setEnabled(false); }
/**
* This function is called periodically during autonomous
*/
public void autonomousPeriodic() {
//Update Camera Feed
DriverStationLCD.getInstance().updateLCD();
}
/**
* This function is called periodically during operator control
*/
public void teleopPeriodic() {
//Update Camera Feed
DriverStationLCD.getInstance().updateLCD();
updateDashboard();
}
|
Theres a little bit more code but the rest of it is not related to the camera.
Is there anyway to reduce the lag.
|