Log in

View Full Version : Drive System--Variable to Speed Controller


stephmak
09-02-2013, 12:29
Hello everyone,

I am trying to take a value from a variable that I have transfered from the usual "Joystick.getY();" command and input it into the speed controllers but I am getting the following error: "cannot find symbol symbol: method leftSpeedController(double)" from this line in my code: "leftSpeedController(dJ1Y);".

Here is a bigger segment the bigger picture of what I am trying to do.


public class DriveSubsystem extends Subsystem {
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
SpeedController leftSpeedController = RobotMap.driveSubsystemLeftSpeedController;
SpeedController rightSpeedController = RobotMap.driveSubsystemRightSpeedController;
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS


// Put methods for controlling this subsystem
// here. Call these from Commands.

public void initDefaultCommand() {
double dJ1Y; //Variable that will house the y-axis number of
//driverJoystick1.
double dJ2Y; //Variable that will house the y-axis number of
//driverJoystick1
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DEFAULT_COMMAND
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DEFAULT_COMMAND

// Set the default command for a subsystem here.
//setDefaultCommand(new MySpecialCommand());
//leftSpeedController = Robot.oi.driverJoystick1.getY(); //gets the position of
//driverJoystick1 and puts it into the variable dJ1Y.
dJ1Y = (Robot.oi.driverJoystick1.getY());//gets the position of
//driverJoystick2 and puts it into the variable DJ2Y.

leftSpeedController(dJ1Y);
}
}


I know there has go to be some common sense answer to this problem that I am missing, but I can't figure it out. Any help would be greatly appreciated.

Thanks!!

Team3266Spencer
09-02-2013, 14:08
You can't put leftSpeedController(double) on that line near the end. You need to call a method from that object that sets its speed to the double. I havn't worked with robot builder or whatever you're using but NetBeans should give you a list of options if you type "leftSpeedController." I'm guessing it will be "leftSpeedController.set(double);" set(double speed) being the method you actually want. What you're telling it to do right now is to call the method leftSpeedController(double d) which is non-existent.