Go to Post You won't find anything in school that says you have to share ideas or strategy with your football rivals. - Al Skierkiewicz [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 15-02-2016, 18:57
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: 25
Heber Hooper is an unknown quantity at this point
Exclamation Can anyone please tell me what is wrong with coding here

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);
Timer.delay(0.005) ; }
// wait for a motor update time}
because it is getting annoyed at the curly braces i bolded and i cannot run anything until it is fixed
Reply With Quote
  #2   Spotlight this post!  
Unread 15-02-2016, 19:00
thatprogrammer's Avatar
thatprogrammer thatprogrammer is offline
Registered User
AKA: Ahad Bawany
no team (None)
Team Role: Programmer
 
Join Date: Apr 2014
Rookie Year: 2014
Location: Florida
Posts: 609
thatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond repute
Re: Can anyone please tell me what is wrong with coding here

Can you post the error message you get?
Thanks.
Reply With Quote
  #3   Spotlight this post!  
Unread 15-02-2016, 19:12
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: 25
Heber Hooper is an unknown quantity at this point
Exclamation Re: Can anyone please tell me what is wrong with coding here

It is a syntax error with it saying that more { need to be entered to complete ClassBody

Last edited by Heber Hooper : 15-02-2016 at 19:15.
Reply With Quote
  #4   Spotlight this post!  
Unread 15-02-2016, 19:13
CyberTeam5713 CyberTeam5713 is offline
Registered User
FRC #5713
 
Join Date: Feb 2016
Location: Michigan
Posts: 25
CyberTeam5713 is an unknown quantity at this point
Re: Can anyone please tell me what is wrong with coding here

these {
Reply With Quote
  #5   Spotlight this post!  
Unread 15-02-2016, 21:27
euhlmann's Avatar
euhlmann euhlmann is offline
CTO, Programmer
AKA: Erik Uhlmann
FRC #2877 (LigerBots)
Team Role: Leadership
 
Join Date: Dec 2015
Rookie Year: 2015
Location: United States
Posts: 322
euhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud of
Re: Can anyone please tell me what is wrong with coding here

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.
Reply With Quote
  #6   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: 25
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 10:28.

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