Go to Post They improvised. They overcame. They persevered. And they succeeded. ... I cannot remember being more proud of a group of students with which I have been associated. - dlavery [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 09-02-2012, 16:26
l0stboy l0stboy is offline
Registered User
FRC #4064 (InZombiacs)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2012
Location: United States
Posts: 22
l0stboy is an unknown quantity at this point
Camera code says "output not being updated enough"

We're attempting to get the image at this phase, and we just stuck the code in the DriveTrain subsystem for the time being. This is through the Command-Base style. Anyone know what's giving the update error? We think that it has something with the timer, but we're not really sure since we're a brand new team of programmers. This is why there is a timer. Again, we are totally clueless on what is causing the error.



/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package edu.wpi.first.wpilibj.templates.subsystems;

import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Servo;
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.command.Subsystem;
import edu.wpi.first.wpilibj.image.ColorImage;
import edu.wpi.first.wpilibj.image.NIVisionException;
import edu.wpi.first.wpilibj.templates.RobotMap;
import edu.wpi.first.wpilibj.templates.commands.DriveWith Joysticks;

/**
*
* @author John
*/
public class DriveTrain extends Subsystem //no PID...
{
RobotDrive drive;
Servo vexMotor;
Victor motor;
AxisCamera camera;

public DriveTrain() {
super("drivetrain");


drive = new RobotDrive(RobotMap.leftBackMotor, RobotMap.leftFrontMotor, RobotMap.rightBackMotor, RobotMap.rightFrontMotor);
//vexMotor = new Servo(RobotMap.vexMotor);
//motor = new Victor(RobotMap.rightFrontMotor);
//throw new RuntimeException("lolol");
}
public ColorImage obtainImage() throws AxisCameraException, NIVisionException
{
camera = AxisCamera.getInstance("10.40.64.11");
camera.writeResolution(AxisCamera.ResolutionT.k640 x480);
camera.writeBrightness(0);

// Timer timer1 = new Timer();
//
// timer1.start();
// while(timer1.get() < .005)
// {
// System.out.println(timer1.get());
// drive.tankDrive(.3, .3);
// }
System.out.println("hi");
//Timer.delay(1);
//camera.writeMaxFPS(10);
ColorImage image;
System.out.println("brightness: "+ camera.getBrightness() + "\n camera rotation" +camera.getRotation());

//getWatchdog().kill();
// while(!camera.freshImage())
// {
// System.out.println("help im stuck in a loop making factory");
//
// image = camera.getImage();
// image.free();
// Timer.delay(.005);
// }
image = camera.getImage();
return image;
}
protected void initDefaultCommand() {
setDefaultCommand(new DriveWithJoysticks());
}
public void tankDrive(double left, double right) {
drive.tankDrive(left, right);
}
public void tankDrive(double time)
{
Timer timer1 = new Timer();

timer1.start();
while(timer1.get() < time)
{
System.out.println(timer1.get());
drive.tankDrive(.5, .5);
}

}

public void testDrive()
{
drive.setExpiration(1);
drive.tankDrive(0.01, 0);
Timer.delay(4);
drive.tankDrive(0,.1);
Timer.delay(4);
drive.tankDrive(0,0);

}

public void servo(double left) //testing servo
{
vexMotor.set(left);
}
public void victorTest(double number)
{
motor.set(number);
}






}
__________________

Pedro
Ocala InZombiacs
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 11:31.

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