OCCRA
Go to Post Yes, a good driver can effectively be the element that closes the loop, but only when there is a driver at the controls. - Alan Anderson [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Events   CD-Media   CD-Spy   FRC-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 02-15-2012, 09:17 PM
guoruiwu1994 guoruiwu1994 is offline
Registered User
FRC #1815
 
Join Date: Feb 2010
Location: Toronto
Posts: 15
guoruiwu1994 is an unknown quantity at this point
Robot motors don't turn

Two weeks ago, everything in the robot was working, then one day we come in, and nothing works anymore; the motors don't turn.

After a while, we find out that the jaguars are all broken somehow, so we replaced them with Victors. However, the robot still won't work. We've reduced our code to the most basic so it is only controlling the motors. However, the motors still won't turn at all.

Is there something wrong with our code?


Code:
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved.                             */
/* Open Source Software - may be modified and shared by FRC teams. The code   */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project.                                                               */
/*----------------------------------------------------------------------------*/
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");

          }
      }
  }
Reply With Quote
  #2   Spotlight this post!  
Unread 02-15-2012, 09:21 PM
guoruiwu1994 guoruiwu1994 is offline
Registered User
FRC #1815
 
Join Date: Feb 2010
Location: Toronto
Posts: 15
guoruiwu1994 is an unknown quantity at this point
Re: Robot motors don't turn

OK, after a few weeks of going crazy, it turns out five jaguars broke was well as the sidecar.
Reply With Quote
  #3   Spotlight this post!  
Unread 02-16-2012, 05:42 AM
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
  #4   Spotlight this post!  
Unread 02-16-2012, 05:09 PM
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 537
BradAMiller has much to be proud ofBradAMiller has much to be proud ofBradAMiller has much to be proud ofBradAMiller has much to be proud ofBradAMiller has much to be proud ofBradAMiller has much to be proud ofBradAMiller has much to be proud ofBradAMiller has much to be proud ofBradAMiller has much to be proud of
Re: Robot motors don't turn

Quote:
Originally Posted by guoruiwu1994 View Post
OK, after a few weeks of going crazy, it turns out five jaguars broke was well as the sidecar.
So does that mean that you've replaced those components and it's working now? Are you all set?

Brad
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
Reply With Quote
  #5   Spotlight this post!  
Unread 02-17-2012, 03:27 PM
Patrick Chiang Patrick Chiang is offline
Programming
FRC #3070 (Team Pronto)
Team Role: Mentor
 
Join Date: Feb 2009
Rookie Year: 2009
Location: Seattle
Posts: 160
Patrick Chiang is a name known to allPatrick Chiang is a name known to allPatrick Chiang is a name known to allPatrick Chiang is a name known to allPatrick Chiang is a name known to allPatrick Chiang is a name known to all
Re: Robot motors don't turn

Your program is fine. Tell the electrical guys that something is wrong on their end.
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 01:32 PM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi