Go to Post Sometimes, it takes years to gain respect and to learn to understand the opportunities that avail themselves to those who pay attention, are willing to learn from the best, and dig deeper into understanding what it means to be a competitive FRC team. - JaneYoung [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 02-10-2012, 01:29 PM
dex dex is offline
Registered User
FRC #4145
 
Join Date: Jan 2012
Location: Ohio
Posts: 1
dex is an unknown quantity at this point
"cannot be resolved as a type" Error

We are working on making our switch to turn on and off our shooter system, a toggle and are getting an error.

Code:
package us.oh.k12.wkw.robot.command;

public class ToggleMotorStateCmd extends CommandBase {
    public ToggleMotorStateCmd(){
        super("ShooterTurnMotorOffCmd");
        this.requires(this.getShooterSystem());
    }

    protected void execute() {
         if (!this.getShooterSystem().isShootMotorOn()) {
             // motor is off, turn it on
             this.getShooterSystem().turnOnShootMotor();
         } else{
             //motor is on, turn it off
             this.getShooterSystem().turnOffShootMotor();
         }
     }
}
In a lot of our other commands we extend CommandBase just fine, but this one is saying "CommandBase cannot be resolved as a type." Let me know if you need more information. Below is the method header of a time when we extend command base and it works.
Code:
package us.oh.k12.wkw.robot.command;
public class GathererTurnOnCmd extends CommandBase{
   //code
}
Reply With Quote
  #2   Spotlight this post!  
Unread 02-10-2012, 03:29 PM
Patrick Chiang Patrick Chiang is offline
Programming
FRC #3070 (Team Pronto)
Team Role: Mentor
 
Join Date: Feb 2009
Rookie Year: 2009
Location: Seattle
Posts: 162
Patrick Chiang is a name known to allPatrick Chiang is a name known to allPatrick Chiang is a name known to allPatrick Chiang is a name known to allPatrick Chiang is a name known to allPatrick Chiang is a name known to all
Re: "cannot be resolved as a type" Error

"X cannot be resolved as a type" errors are commonly caused by two reasons:
1. Missing import statement, wrong package.
2. Referring to a type that doesn't exist.

If you are using an IDE, there should be a way to automatically remedy this.

Also, doesn't Java make your implement all the methods of the abstract class?
Code:
    protected void execute() {
    }

    protected boolean isFinished() {
    }

    protected void end() {
    }

    protected void interrupted() {
    }
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 08:56 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