Go to Post “Hey, why are those numbers showing, it must be a game hint!” Listen, please – it’s not a game hint. Our game hints typically start with something like “This is a game hint!” - Frank - pwnageNick [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Spotlight this post!  
Unread 02-23-2016, 04:50 AM
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
 


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:28 PM.

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