Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Jaguar problem? (http://www.chiefdelphi.com/forums/showthread.php?t=100508)

shuhao 17-01-2012 19:50

Jaguar problem?
 
We just have the jaguars hooked up to the cRIO board and we're having some trouble with the Jaguar. We hooked the Jaguar's output to a multimeter to test our circuits.

For some reason the code is not working.

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 frc.t4069.robots;

import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.command.Command;
import edu.wpi.first.wpilibj.command.Scheduler;
import frc.t4069.utils.GameController;
import frc.t4069.utils.math.Point;

/**
 * The VM is configured to automatically run this class, and to call the
 * functions corresponding to each mode, as described in the IterativeRobot
 * 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 The2012Robot extends IterativeRobot {

        Command autonomousCommand;
        GameController gc = new GameController(new Joystick(1));
        Jaguar j;

        /**
        * This function is run when the robot is first started up and should be
        * used for any initialization code.
        */

        public void robotInit() {
                // instantiate the command used for the autonomous period
                // autonomousCommand = new ExampleCommand();

                // Initialize all subsystems
                // CommandBase.init();
                j = new Jaguar(2, 1);
        }

        public void autonomousInit() {
                // schedule the autonomous command (example)
                // autonomousCommand.start();
        }

        /**
        * This function is called periodically during autonomous
        */

        public void autonomousPeriodic() {
                Scheduler.getInstance().run();
        }

        public void teleopInit() {
                // This makes sure that the autonomous stops running when
                // teleop starts running. If you want the autonomous to
                // continue until interrupted by another command, remove
                // this line or comment it out.
                // autonomousCommand.cancel();
        }

        /**
        * This function is called periodically during operator control
        */
        public void teleopPeriodic() {
                Scheduler.getInstance().run();
                Point rightStick = gc.getRightStick();
                System.out.println(rightStick.y);
                j.set(rightStick.y);
        }
}

The GameController code is verified to be working, and rightStick.y is a value between -1 and 1

and our Jaguar is connected to PWM1

Robby Unruh 17-01-2012 21:54

Re: Jaguar problem?
 
Try removing the slot from your Jaguar object.

Code:

Jaguar j = new Jaguar(1);
Wouldn't hurt to try. We had a similar problem getting our drive train to work, and this seemed to fix it. I'm still not sure how the new cRIO slots work yet... so I guess I'll have to get back to you on that.

cgmv123 17-01-2012 22:37

Re: Jaguar problem?
 
Quote:

Originally Posted by Robby Unruh (Post 1108056)
I'm still not sure how the new cRIO slots work yet... so I guess I'll have to get back to you on that.

If you have the old cRIO, any module in slots 4-3 is module 1, regardless of the slot and and module in slots 5-7 is module 2 regardless of the slot. Any module in slots 1-3 of the new cRIO is module 1 and the module in slot 4 is module 2 even though it's in slot 4. The code defaults to module 1 (slot 1, 2 or 3) unless you say otherwise. Thus, getting rid of the slot number in the code should work. It's confused a fair number of people here from what I can tell.

shuhao 17-01-2012 23:06

Re: Jaguar problem?
 
Quote:

Originally Posted by Robby Unruh (Post 1108056)
Try removing the slot from your Jaguar object.

Code:

Jaguar j = new Jaguar(1);
Wouldn't hurt to try. We had a similar problem getting our drive train to work, and this seemed to fix it. I'm still not sure how the new cRIO slots work yet... so I guess I'll have to get back to you on that.


No effect..

and I'm also on the new cRIO

Also prehaps I should clarify that the multimeter doesn't show anything other than 0.

mkoval 18-01-2012 22:30

Re: Jaguar problem?
 
We're having the same problem. There is already some discussion about the same issue in this thread.


All times are GMT -5. The time now is 22:22.

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