Go to Post A robot that does 60% of the tasks 100% of the time is better than a robot that does 100% of the tasks 60% of the time. - artdutra04 [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 01-31-2010, 09:09 PM
team1512's Avatar
team1512 team1512 is offline
Registered User
FRC #1512
 
Join Date: Jan 2008
Location: Concord
Posts: 10
team1512 is an unknown quantity at this point
Robot Dropping the Code

Hello all, I am part of team 1512 and our robot is running using 2010 v19 imaging and a net beans java code. We have have had quite a bit of major success loading the code from a seperate PC and using the supplied classmate for the driver station. Usually the robot communicates well and then can be operated through teleoperated and autonomous, however our most recent code has seen that the robot communicates and stays in sync but somehow suddenly drops the code going from "teleoperated enabled" to "no robot code" even if the lights on the speed controllers still register a code. Both the disable and emergency stop buttons still work but the classmate won't even say "emergency stopped" if the button is pressed like it normally does. I reverted back again to our default code and that works so it is not the wiring something in the program is causing the robot to drop the code but there are no errors in the text as far as we can see. Please help... Thanks

Here is the 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.SensorBase;

//import edu.wpi.first.wpilibj.Encoder;

import edu.wpi.first.wpilibj.SimpleRobot;

import edu.wpi.first.wpilibj.RobotDrive;

import edu.wpi.first.wpilibj.Timer;

import edu.wpi.first.wpilibj.Joystick;

import edu.wpi.first.wpilibj.Servo;

import edu.wpi.first.wpilibj.camera.AxisCamera;

import edu.wpi.first.wpilibj.camera.AxisCameraException;

//import edu.wpi.first.wpilibj.image.HSLImage;

import edu.wpi.first.wpilibj.DigitalInput;

import edu.wpi.first.wpilibj.image.ColorImage;

import edu.wpi.first.wpilibj.image.NIVisionException;

//import edu.wpi.first.wpilibj.CounterBase;







/**

* 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 {





//HSLImage image;// = new HSLImage ();

RobotDrive drive = new RobotDrive(1, 2);

Joystick leftStick = new Joystick(1);

Joystick rightStick = new Joystick(2);

AxisCamera camera = AxisCamera.getInstance();

ColorImage image;// = camera.getImage();

Servo servo5 = new Servo(5);

DigitalInput button1 = new DigitalInput(1);

/**

* This function is called once each time the robot enters autonomous mode.

*/

public void autonomous()

{

for (int i = 0; i < 4; i++)

{

drive.drive(-0.5, 0.0); //drive 50% fwd 0% turn

Timer.delay(2.0); // wait 2 seconds

drive.drive (0.0, 0.75); // drive 0% 75% turn



}

drive.drive(0.0, 0.0); //stops all drive/turn

}



/**

* This function is called once each time the robot enters operator control.

*/

public void operatorControl() {



getWatchdog().setEnabled(false);

float f=0;

float increment = (float) 0.5;

int direction=0;



while (true && isOperatorControl() && isEnabled()) // loop until change

{

try {

image = camera.getImage();

}

catch (AxisCameraException ex) {

ex.printStackTrace();

}

catch (NIVisionException ex) {

ex.printStackTrace();

}



drive.tankDrive(leftStick, rightStick); // drive with joysticks

camera.writeResolution(AxisCamera.ResolutionT.k320 x240);

camera.writeBrightness(0);

//Timer.delay(3.0);

// servo5.setAngle(rightStick.getX()*100.0);

servo5.setAngle(f);

if (direction==0) f=f+increment; else f=f-increment;

if (f>255.0) direction=1;

if (f<0.0) direction=0;



System.out.println("leftstickx="+leftStick.getX()+ "leftSticky="+leftStick.getY());

System.out.println(" rightstickx="+rightStick.getX()+"rightSticky="+rig htStick.getY());

System.out.println(" servo angle="+servo5.getRaw() + " f=" + f);

System.out.println(" Button1="+button1.get());

Timer.delay(0.005);



}

}

}
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
[FTC]: FMS Dropping only the joystick possibly? ttldomination FIRST Tech Challenge 8 02-24-2009 06:13 PM
Adjustable Way of Dropping the Center Wheel R.C. Technical Discussion 15 08-06-2008 06:37 PM
Hex code loader for the robot! paulcd2000 Programming 4 10-22-2006 01:58 AM
default code and the actual robot tml240 Programming 15 01-24-2004 11:31 AM


All times are GMT -5. The time now is 07:23 AM.

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