Go to Post "Greatness isn't achieved by doing the uncommon things but instead by doing the common things uncommonly well." - Wayne C. [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 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
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 00:45.

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