View Single Post
  #2   Spotlight this post!  
Unread 23-02-2016, 04:50
pblankenbaker pblankenbaker is offline
Registered User
FRC #0868
 
Join Date: Feb 2012
Location: Carmel, IN, USA
Posts: 102
pblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of light
Re: Will this code successfully run my robot as a tank drive also a single forward ca

There is a problem in your robotInit where you allocate PWM channels 0-3 when constructing your RobotDrive object and then allowcate PWM channels 1-4 when creating your talons, try changing it to:

Code:
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
  setLeftstick(new Joystick(0));
  setRightstick(new Joystick(1));

  frontright = new Talon(1);
  frontleft = new Talon(2);
  rearright = new Talon(3);
  rearleft = new Talon(4);

  myRobot = new RobotDrive(frontLeft, rearLeft, frontRight, rearRight);

  // I would comment out the vision stuff for now, until you are driving

  //frame = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_ RGB, 0);

  //sessionfront = NIVision.IMAQdxOpenCamera("cam1",   NIVision.IMAQdxCameraControlMode.CameraControlMode Controller);

  //currSession = sessionfront;

  //NIVision.IMAQdxConfigureGrab(currSession);
}
Your autonomous code looks like it should work, however, I think you need to make some adjustments to your teleop code:

Code:
/**
* This function is called periodically during operator control
*/
public void teleopPeriodic() { 
  myRobot.tankDrive(leftStick, rightStick);
    
  // Instead of System.out.prinlnt(), you might want to try:  
  // SmartDashboard.putNumber("Left Stick Y", leftStick.getY()); 
  System.out.println(leftStick.getY());
  System.out.println(rightStick.getY());

  // Did you want to do something with the value returned?
  // leftStick.getRawAxis(0);

  // This only reads the angle of POV 0 from the right joystick,
  // you will need to add code if you want to do something with
  // the value returned
  int intakeMode = rightStick.getPOV(Intake);
}
Hope that helps.
Reply With Quote