Go to Post Yes, a good driver can effectively be the element that closes the loop, but only when there is a driver at the controls. - Alan Anderson [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

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 16-02-2016, 13:28
Heber Hooper's Avatar
Heber Hooper Heber Hooper is offline
Rocktaπ Inkling
AKA: Heber Hooper
FRC #6051 (Rocktaπ)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2016
Location: Converse
Posts: 22
Heber Hooper is an unknown quantity at this point
Smile Re: Can anyone please tell me what is wrong with coding here

Quote:
Originally Posted by euhlmann View Post
Code:
public class Robot {
    RobotDrive myRobot;  // class that handles basic drive operations
    Joystick leftStick;  // set to ID 1 in DriverStation
    Joystick rightStick; // set to ID 2 in DriverStation

    public Robot() {
        myRobot = new RobotDrive(0, 1);
        myRobot.setExpiration(0.1);
        leftStick = new Joystick(0);
        rightStick = new Joystick(1);
    }
    
    /**
     * Runs the motors with tank steering.
     */
    public void operatorControl() { 
        myRobot.setSafetyEnabled(true);
        while (isOperatorControl() && isEnabled()) {
            myRobot.tankDrive(leftStick, rightStick);
            System.out.println(leftStick.getY());
            System.out.println(rightStick.getY());
            leftStick.getRawAxis(0);
            // wait for a motor update time
            Timer.delay(0.005);
        }
    }
}
Formatted your code. Hope this helps.
Thanks man this helps a lot!
Reply With Quote
Reply


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:35.

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