View Single Post
  #5   Spotlight this post!  
Unread 16-02-2012, 05:42
NS_Radication's Avatar
NS_Radication NS_Radication is offline
Student
AKA: Marco Schoener
FRC #1369 (Minotaur)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2009
Location: Tampa
Posts: 88
NS_Radication is an unknown quantity at this point
Re: Robot motors don't turn

Quote:
Originally Posted by guoruiwu1994 View Post
package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.RobotDrive;


import edu.wpi.first.wpilibj.SimpleRobot;

/**
* The VM is configured to automatically run this class, and to call the
* functions corresponding to each mode, as described in the SimpleRobot
* documentation. If you change the name of this class or the package after
* creating this project, you must also update the manifest file in the resource
* directory.
*/
public class RobotTemplate1 extends SimpleRobot
{

/**
* This function is called once each time the robot enters autonomous mode.
*/
RobotDrive m_robotDrive; // robot w'ill use PWM 1-4 for drive motors
static final int UNINITIALIZED_DRIVE = 0;
static final int ARCADE_DRIVE = 1;
static final int TANK_DRIVE = 2;
int m_driveMode;

public void autonomous()
{
}

/**
* This function is called once each time the robot enters operator control.
*/
public void operatorControl()
{
m_robotDrive = new RobotDrive(1, 2, 3, 4);
while (isOperatorControl() && isEnabled())
{
m_robotDrive.setSafetyEnabled(false);
m_driveMode = ARCADE_DRIVE;
//m_robotDrive.arcadeDrive();
m_robotDrive.arcadeDrive(-0.5, 1);
System.out.println("hello");

}
}
}
I would start by saying that you should initialize your robotDrive variable in a constructor to reference from anywhere.

Ex:
Code:
Public RobotTemplate1()
{
    
    m_robotDrive.setSafetyEnabled(false);
    m_robotDrive = new RobotDrive(1, 2, 3, 4);
}
And now robotDrive is set up to reference everywhere within the program.

I see that this is a test program, so arcade drive would have joystick input, but his is for it to move. You should add this to teleopPeriodic

arcadeDrive()
Timer.delay()
__________________
Team 1369
Senior
Head Programmer (Java)
Head Electrician
Reply With Quote