Go to Post A mentor, by definition, provides a nuturing environment and, over time, makes themselves progressively unnecessary. - Rich Kressly [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 10-02-2011, 18:52
Sotha Sotha is offline
Registered User
FRC #2501
 
Join Date: Feb 2011
Location: Minnesota
Posts: 3
Sotha is an unknown quantity at this point
First Year with Java, Help Requested

This is our first year using Java, our team does not have any programming mentors so I have pretty much been hung out to dry. I've been banging my head against the wall because I can not get this code to work.

Here is our code: (Some things are commented out due to me trying to debug.

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.Compressor;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Watchdog;



/**
 * 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 Team2501Robot extends SimpleRobot {
   RobotDrive drive = new RobotDrive(1, 2, 3, 4);

  /* Jaguar frontLeft = new Jaguar(1);    // Front Left Motor
    Jaguar frontRight = new Jaguar(2);   // Front Right Motor
   Jaguar backLeft = new Jaguar(3);     // Back Left Mottr
   Jaguar backRight = new Jaguar(4);    // Back Right Motor
   Jaguar armLower = new Jaguar(5);     // Motor for Arm
   Jaguar armUpper = new Jaguar(6);     // Upper Motor for Arm
   Compressor c = new Compressor(6,7);
*/


   Joystick leftStick = new Joystick(1);                    // Drive Stick
   Joystick rightStick = new Joystick(2);                   // Arm stick
   double magnitude = leftStick.getMagnitude();             // Magnitude
   double direction = leftStick.getDirectionDegrees();      // Direction
   double rotation = leftStick.getX();                      // Rotation
   double rmagnitude = rightStick.getY();


    public void autonomous() {
        for (int i = 0; i < 14; i++){        // Autonomius Mode
  //          c.start();
            drive.drive(0.5, 0.0);          // Drive forward at half speed
            Timer.delay(2.0);               // Wait two seconds

            
        }
        drive.drive(0.0, 0.0);              // Stop
    }

    public void operatorControl() {
        getWatchdog().setEnabled(true);
        while (isOperatorControl() && isEnabled()){         //loop during telop
    //        c.start();
            drive.mecanumDrive_Polar(leftStick.getDirectionDegrees(),leftStick.getMagnitude(), rightStick.getY());
           if(rmagnitude > 0.0)
            {
                /*armLower.set(rmagnitude);
                armUpper.set(-rmagnitude);*/
            }
            else if (rmagnitude < 0.0)
            {
                /*armLower.set(-rmagnitude);
                armUpper.set(rmagnitude);*/

            }
            
            else if(leftStick.getRawButton(4)){     // For Strafe Left
                    /*frontLeft.set(0.5);
                    backRight.set(0.5);
                    frontRight.set(-0.5);
                    backLeft.set(-0.5); */
                }
            
            else if(leftStick.getRawButton(5)){     // For Strafe Right
      /*              frontLeft.set(-0.5);
                    backRight.set(-0.5);
                    frontRight.set(0.5);
                    backLeft.set(0.5); */
                }
            
           }
            Timer.delay(0.005);
            // c.stop();
        
    }
}
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 09:27.

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