Go to Post It's really quite amazing what people will find time to talk about in the month before kickoff. - Ekcrbe [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
  #11   Spotlight this post!  
Unread 11-07-2012, 05:23 PM
y-aji y-aji is offline
Registered User
FRC #3734
 
Join Date: Dec 2011
Location: Lake Forest
Posts: 38
y-aji is an unknown quantity at this point
Re: Lost our last programmer

That did it. The jaguars were blinking as if they were receiving no signal. I started nosing around at the wiring and found that the signal cables were reversed. Thanks guys. The final problems found were as follows:

24v was being handed out to the ni9201 instead of 12v.
the command cables from the sidecar were plugged in backwards.
The getX(),getY() needed to be added.

After all that, it's driving and receiving commands. Thank you guys for helping me tackle getting this thing up and running. For reference, the final successful code for our tank drive template is as follows:

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.                                                               */
/*----------------------------------------------------------------------------*/

/* 
 * Ground Zero Template
 * This Template is to be utilized to troubleshoot the robot. Please make no
 * changes to this code. It's to be copied and branched off of for new projects
 * and is for reference only.
*/

package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Relay;
import edu.wpi.first.wpilibj.Relay.Value;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Timer;

/**
 * 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 GroundZeroTemplate extends SimpleRobot {
    
    RobotDrive drive = new RobotDrive(1,2);
    Joystick leftStick = new Joystick(1);
    Joystick rightStick = new Joystick(2);
    
    Relay firingMechanism;
    
    public void robotInit() {
        firingMechanism = new Relay(1);
    }
    
    /**
     * This function is called once each time the robot enters autonomous mode.
     */
    public void autonomous() {
        /*getWatchdog().setEnabled(true);
        getWatchdog().setExpiration(0.5);
        drive.drive(1,0);
        Timer.delay(2);
        drive.drive(0,0);*/
        for (int i = 0; i < 4; i++) {
            drive.drive(0.5, 0.0); // drive 50% fwd 0% turn
            Timer.delay(2.0); // wait 2 seconds
            drive.drive(0.0, 0.75); // drive 0% fwd 0% turn
        }
    }

    /**
     * This function is called once each time the robot enters operator control.
     */
    public void operatorControl() {
        while (true && isOperatorControl() && isEnabled()) // loop until change
        {
            drive.tankDrive(leftStick.getY(), rightStick.getX()); // drive w/ joysticks
            Timer.delay(0.005);
            System.out.println("Left: "+leftStick.getX()+", "+leftStick.getY());
            System.out.println("Right: "+rightStick.getX()+"' "+rightStick.getY());
            
            if(rightStick.getTrigger()){
                firingMechanism.set(Value.kReverse);
            }
            if(leftStick.getTrigger()){
                firingMechanism.set(Value.kForward);
            }
        }
    }
}
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 07:44 AM.

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