Chief Delphi

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

yBother 06-02-2012 17:34

Jaguar Programming with NetBeans
 
Greetings! We're trying to program our Jaguar, but it does not respond to the commands that we copied from the official PDF. Can someone please take a look:

Here's our codes regarding the Jaguar:

private testJaguar;
testJaguar = new Jaguar(1);

testJaguar.setSafetyEnabled(true);
testJaguar.set(testJoystick.getY());

No error message appeared on the NetBeans, but we can't get control over the Jaguar.

THANKS SO MUCH!

neal 06-02-2012 17:39

Re: Jaguar Programming with NetBeans
 
Have you declared testJoystick?

Are you sure the Jaguar is connected on the port 1 of the Digital Sidecar that is connected to module 1 on the cRIO?

Is the Jaguar light changing to red/green or is it always at yellow?

severhale 06-02-2012 22:06

Re: Jaguar Programming with NetBeans
 
The fact that you're not getting any errors means that testJoystick is declared, but does it have a value? Are you saying
testJoystick = new Joystick(portNumber);
If you're not, you'd be getting a null pointer exception in the console.

yBother 07-02-2012 17:13

Re: Jaguar Programming with NetBeans
 
Quote:

Originally Posted by neal (Post 1121163)
Have you declared testJoystick?

Are you sure the Jaguar is connected on the port 1 of the Digital Sidecar that is connected to module 1 on the cRIO?

Is the Jaguar light changing to red/green or is it always at yellow?

The joystick is declared in the beginning.

The Jaguar is for sure connected to module 1.

And the light on the Jaguar is always blinking at yellow.

yBother 07-02-2012 17:14

Re: Jaguar Programming with NetBeans
 
Quote:

Originally Posted by severhale (Post 1121369)
The fact that you're not getting any errors means that testJoystick is declared, but does it have a value? Are you saying
testJoystick = new Joystick(portNumber);
If you're not, you'd be getting a null pointer exception in the console.

It is declared as testJoystick = new Joystick (1);

Is there anything else we need to do?

neal 07-02-2012 18:04

Re: Jaguar Programming with NetBeans
 
Quote:

Originally Posted by yBother (Post 1121839)
It is declared as testJoystick = new Joystick (1);

Is there anything else we need to do?

In the Setup tab in Driver Station, do you see your joystick in port 1?

BradAMiller 08-02-2012 16:23

Re: Jaguar Programming with NetBeans
 
Quote:

Originally Posted by yBother (Post 1121160)
Greetings! We're trying to program our Jaguar, but it does not respond to the commands that we copied from the official PDF. Can someone please take a look:

Here's our codes regarding the Jaguar:

private testJaguar;
testJaguar = new Jaguar(1);

testJaguar.setSafetyEnabled(true);
testJaguar.set(testJoystick.getY());

No error message appeared on the NetBeans, but we can't get control over the Jaguar.

THANKS SO MUCH!

Is your code in a loop in the OperatorControl part of the program? If not, it will execute once and exit.

Brad

Patrick Chiang 09-02-2012 03:15

Re: Jaguar Programming with NetBeans
 
Try putting:
Code:

System.out.println(testJoystick.getY());
somewhere in your code.

This will print out the values of your joystick so you can see if the problem is with the jaguars or with the joystick.

Also, as people have mentioned, you need to put the code in a loop.

These are the possible loops for an IterativeRobot implementation:
Code:

RobotInit
DisabledInit
DisabledPeriodic/DisabledContinuous
AutonomousInit
AutonomousPeriodic/AutonomousContinuous
TeleopInit
TeleopPeriodic/TeleopContinuous

Now, you probably want to put it in TeleopPeriodic(). If you put it in any ----Init() method, it will run it only once. Periodic methods run at a rate that's clocked to the FPGA, and continuous methods run as fast as possible. You want to put most of your code in periodic.

eddie12390 09-02-2012 11:30

Re: Jaguar Programming with NetBeans
 
Can you post the entirety of your code? It would make diagnosing problems much easier.

Daniel 09-02-2012 16:19

Re: Jaguar Programming with NetBeans
 
Do not put your code in AutonomousContinuous or AutonomousPeriodic... These routines never get updates from the operator interface. You should use TeleopPeriodic this gets called only when there is a new message from the operator interface. (Been there, done that.)

Herbblood 14-02-2012 20:26

Re: Jaguar Programming with NetBeans
 
You said the light was blinking on the jaguar, that means it is not getting the code, find electrical to check wires and make sure you have the right ports!

NotInControl 15-02-2012 04:02

Re: Jaguar Programming with NetBeans
 
as mentioned before... if you enable the robot and the light on the jags are still blinking then that means the jag is not properly receiving communication from the digital side car... it should go solid even if your joystick didn't work or if you had no joystick at all.

A blinking light indicated bad comms. This is true for jags and victors.

I would start by making sure your cables work and plugged in correctly. Make sure you are plugged into the PWM slot and not the DIO slot for example.

Then I would look so see where you are instantiating the new jag... you should be instantiating the new jag in RobotInit, AutoInit, or Teleop Init...

Once you have a solid light when the robot is enabled then I would make sure to call the set() method in a loop like teleop period, and you might want to use joystick.getrawaxis( # ) instead of gety() if you still cant command the jags.


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

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