Go to Post How do you earn yourself 500 PM's, 200 e-mails, 100 replies to a post, and an instant 5 to 6 bars in rep? If your name is Grant Imahara, make yourself known to the Chief Delphi community. - Andy Grady [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 27-09-2012, 19:20
Bennett Bennett is offline
Registered User
FRC #2977 (Sir Lancer Bots)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Minnesota
Posts: 26
Bennett is an unknown quantity at this point
Autonomous timeout

We are trying to program autonomous code for our robot and in our commands we have
Code:
    public turnLeft() {
        m_timeout = timeout;
        requires(chassis);
but the m_timeout = timeout; says that m_timeout has private access in edu.wpi.first.wpilibj.command.Command
cannot find symbol
symbol: variable timeout
location:class edu.wpi.first.wpilibj.templates.commands.turnLeft

any ideas as to why?
thanks.
Reply With Quote
  #2   Spotlight this post!  
Unread 27-09-2012, 22:22
F22Rapture's Avatar
F22Rapture F22Rapture is offline
College Student, Mentor
AKA: Daniel A
FRC #3737 (4H Rotoraptors)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Goldsboro, NC
Posts: 476
F22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant future
Re: Autonomous timeout

Our (error-free) code looks like this --

Code:
public class TurnLeft extends CommandBase {
    
    private double m_timeout;
    private double m_speed;
    
    public TurnLeft(double speed, double timeout) {
        m_timeout = timeout;
        m_speed = speed;
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
        requires(drivetrain);
    }
Do you have any other code? Because I'm assuming you want to do the same thing that our code does, that is, turn left for the period of time put inside the parentheses when you call the command. To do that you need to make "timeout" a parameter in the TurnLeft method by using putting "double timeout" inside the parentheses. You also want to make m_timeout a variable inside the class, so make sure to put "private double m_timeout;" somewhere.

If you want you can just copy/paste my code in (remove the "speed" stuff) and see if it works.
__________________
Research is what I’m doing when I don’t know what I’m doing.
- Wernher von Braun
Attending: Raleigh NC Regional

Last edited by F22Rapture : 27-09-2012 at 22:25.
Reply With Quote
  #3   Spotlight this post!  
Unread 30-09-2012, 23:16
Ginto8's Avatar
Ginto8 Ginto8 is offline
Programming Lead
AKA: Joe Doyle
FRC #2729 (Storm)
Team Role: Programmer
 
Join Date: Oct 2010
Rookie Year: 2010
Location: Marlton, NJ
Posts: 174
Ginto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of light
Re: Autonomous timeout

Quote:
Originally Posted by Bennett View Post
cannot find symbol
symbol: variable timeout
location:class edu.wpi.first.wpilibj.templates.commands.turnLeft
This error means that the compiler is looking for a variable named "timeout" and can't find it. I'm guessing you meant for timeout to be a parameter of the constructor, but forgot to actually put it in. The change is easy:

Code:
    public turnLeft(double timeout) {
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:48.

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