Go to Post So if you were a rookie team in this division what would you do? Watch.Experience.Learn. - dodar [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
  #16   Spotlight this post!  
Unread 08-12-2009, 22:51
Trevor_Decker's Avatar
Trevor_Decker Trevor_Decker is offline
Registered User
AKA: Trevor Decker
FRC #3504 (Girls of Steel)
Team Role: Mentor
 
Join Date: Apr 2009
Rookie Year: 2009
Location: Pittsburgh
Posts: 42
Trevor_Decker is an unknown quantity at this point
Re: Problem Loading Java Code

Quote:
Originally Posted by aaeamdar2 View Post
New update:

Of note: though I disabled WatchDog in the code, it still says

"System: Watchdog"

below the team number.

I'm starting to get pretty stumped.

EDIT: It also tells me when I'm loading code:


[cRIO] Information: No user-supplied RobotMain()

Is this possibly a problem?

OK so, now I have a slightly different problem:

I fixed the aforementioned issue (thanks to all who confirmed that that's what it was) and have (as far as I know) successfully loaded code onto the robot. However, there's a minor issue: nothing happens.

I'm still working on troubleshooting this issue, and I'm not by any means tapped out, but if anyone has any suggestions, I would very much appreciate them. A few facts:

1. I have communication established between robot and DS.
2. The code is supposed to be tank-drive - I essentially copied the code in the doc.
3. Nothing happens when I activate the joysticks.

EDIT: One problem was that I had two projects running. One was blank and selected as the main project; the other had the code in it and was NOT selected as the main project. However fixing this did NOT solve the problem (frowny face).


Here's my 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.*;
import edu.wpi.first.wpilibj.DriverStation.*;
import edu.wpi.first.wpilibj.camera.*;


/**
 * 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 RobotTemplate extends SimpleRobot
{
    //This is all SANDBOX code.
    public static final boolean PRESSED = true;
    public static final boolean UNPRESSED = false;

    Joystick j1;
    Joystick j2;
    RobotDrive drivetrain;
    Compressor comp;
    DriverStation ds;

    Accelerometer a;
    DigitalInput bump;
    AxisCamera cam;
    Timer t;
    Gyro robotHeadingGyro;



    public RobotTemplate()
    {
        comp = new Compressor(1, 1);
        j1 = new Joystick (1);
        j2 = new Joystick (2);
        drivetrain = new RobotDrive (1, 2);
        this.getWatchdog().setEnabled(false);
        
        ds = DriverStation.getInstance();
        /*
        robotHeadingGyro = new Gyro (1);
        a = new Accelerometer(2);
        bump = new DigitalInput(1);

        if (bump.get())
        {
            System.out.println("oh no cap'n we've been bumped");
        }
         */
    }


    
    /**
     * This function is called once each time the robot enters autonomous mode.
     */
    public void autonomous()
    {
        Alliance a = ds.getAlliance();
        if (a.equals(Alliance.kBlue))
        {
            System.out.println("we're blue");

        }
        else
        {
            System.out.println("we're red");
        }

        while (this.isAutonomous() && this.isEnabled())
        {
            double voltage = ds.getBatteryVoltage();
            System.out.println(voltage);
            if (voltage < 10.0)
            {
                break;
            }
        }
    }

    /**
     * This function is called once each time the robot enters operator control.
     */
    public void operatorControl() 
    {
        while (this.isEnabled() && this.isOperatorControl())
        {
            drivetrain.tankDrive(j1, j2);
            Timer.delay(0.005);
        }
    }

    private void driveStraight(double speed, Gyro g)
    {
        double d = g.getAngle();
        d = d / 360.0;
        if (d > 1.0)
        {
            d = 1.0;
        }
        if (d < -1.0)
        {
            d = -1.0;
        }
        drivetrain.drive (speed, d);
    }
From your post I believe it is that your tela operated function is not being called/running correctly, so why don't you try a line of code that does not require feedback, to see if that is the problem, you could just have the robot drive strait for a few seconds to test the function

for instance you could try
Code:
 
 public void operatorControl() 
    {
        
            drivetrain.Drive(1, 0);
            Timer.delay(0.005);
 
    }
__________________
- Trevor

Team 3504 - The Girls of Steel 2011 - Present
2012 Pittsburgh Regional Engineering Inspiration, and website awards
Team 1743 - The Short Circuits 2009 - 2011
2009 Pittsburgh Regional Champions (thanks to 222 and 1218)
2010 Won Autodesk Animation Competition
2010,2011 Pittsburgh Team spirit award
Reply With Quote
  #17   Spotlight this post!  
Unread 08-12-2009, 22:59
Trevor_Decker's Avatar
Trevor_Decker Trevor_Decker is offline
Registered User
AKA: Trevor Decker
FRC #3504 (Girls of Steel)
Team Role: Mentor
 
Join Date: Apr 2009
Rookie Year: 2009
Location: Pittsburgh
Posts: 42
Trevor_Decker is an unknown quantity at this point
Re: Problem Loading Java Code

I know that we declare what port to use for the power distribution block thru out our code for example
Code:
 drivetrain = new RobotDrive(1, 2);
But where do we declare what port to use for the Crio, is their a way to use a different port? In case something where to happen to the normal port.
__________________
- Trevor

Team 3504 - The Girls of Steel 2011 - Present
2012 Pittsburgh Regional Engineering Inspiration, and website awards
Team 1743 - The Short Circuits 2009 - 2011
2009 Pittsburgh Regional Champions (thanks to 222 and 1218)
2010 Won Autodesk Animation Competition
2010,2011 Pittsburgh Team spirit award
Reply With Quote
  #18   Spotlight this post!  
Unread 08-12-2009, 23:19
EHaskins EHaskins is offline
Needs to change his user title.
AKA: Eric Haskins
no team (CARD #6 (SCOE))
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Elkhorn, WI USA
Posts: 998
EHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond repute
Send a message via MSN to EHaskins
Re: Problem Loading Java Code

Quote:
Originally Posted by Trevor_Decker View Post
I know that we declare what port to use for the power distribution block thru out our code for example
Code:
 drivetrain = new RobotDrive(1, 2);
But where do we declare what port to use for the Crio, is their a way to use a different port? In case something where to happen to the normal port.
Nowhere in code do you specify the power source for the motors. You specify the PWM outputs (from the digital sidecar) which the motor controllers are connected to.

The code you posted is creating a RobotDrive using Jaguar controllers on PWMs 1 and 2 on the default digital sidecar (CRIO slot 4).

If you want to use different PWM outputs you could modify it like so:

Code:
drivetrain = new RobotDrive(3, 4); //Uses PWM outputs 3 and 4.
drivetrain = new RobotDrive(1, 2, 3, 4); //Used PWMs 1 and 2 for the left drives, and 3 and 4 for the right drives.
__________________
Eric Haskins KC9JVH
Reply With Quote
  #19   Spotlight this post!  
Unread 09-12-2009, 02:00
aaeamdar2 aaeamdar2 is offline
Registered User
FRC #1893
 
Join Date: Nov 2009
Location: Baltimore
Posts: 9
aaeamdar2 is an unknown quantity at this point
Re: Problem Loading Java Code

Trevor,

Your solution trouble-shoots the joystick/jaguar issue, not whether operatorControl() is being called. I might give that a try, but I'm reasonably certain I don't have 2 joysticks failing spontaneously, or 2 jaguars etc.

Ehaskins,

Got a reply on official FIRST forums (this does not mean it's correct of course) that the RobotMain() function is not the problem (and boy do I hate the casing of that method name - why did they make it look like a constructor?)

At the moment I'm most interested in examining the WatchDog angle - does anyone fully understand this and could explain to the unenlightened?
Reply With Quote
  #20   Spotlight this post!  
Unread 09-12-2009, 09:14
derekwhite's Avatar
derekwhite derekwhite is offline
Java Virtual Machine Hacker
no team (FIRST@Oracle)
Team Role: Programmer
 
Join Date: May 2009
Rookie Year: 2009
Location: Burlington, MA
Posts: 127
derekwhite is on a distinguished road
Re: Problem Loading Java Code

Are you getting any text output at all to indicate that the autonomous() or operatorControl() methods are being called? Some more print statements can help here...
Reply With Quote
  #21   Spotlight this post!  
Unread 28-12-2009, 12:03
flyvin flyvin is offline
Registered User
FRC #0095
 
Join Date: Dec 2009
Location: Lebanon NH
Posts: 8
flyvin is an unknown quantity at this point
Re: Problem Loading Java Code

I am having the exact same problem with our robot. I download the code to the robot, but when I try to run it it just says watchdog where it usually says enabled. I put a print statement in the autonomous() and operatorControl() methods and it printed to the screen, so it's to that part. Then I made it print something if the trigger was pressed on the joystick and that worked too. Please help.
Reply With Quote
  #22   Spotlight this post!  
Unread 28-12-2009, 12:39
flyvin flyvin is offline
Registered User
FRC #0095
 
Join Date: Dec 2009
Location: Lebanon NH
Posts: 8
flyvin is an unknown quantity at this point
Re: Problem Loading Java Code

I figured out the problem, I disabled the watchdog in the wrong part of the code. In the getting started PDF file, it said to put it in the constructor, but that doesn't work, you have to put it in the operator control method. Hope this helps anyone else who might have this problem.
Reply With Quote
  #23   Spotlight this post!  
Unread 23-01-2010, 17:04
1195mentor 1195mentor is offline
Registered User
FRC #1195
 
Join Date: Jan 2010
Location: Bowie, MD
Posts: 4
1195mentor is an unknown quantity at this point
Re: Problem Loading Java Code

What is the fix for the "[cRIO] Information: No user-supplied RobotMain()" problem? We are still stuck with that...
Thank you,
Chris
Reply With Quote
  #24   Spotlight this post!  
Unread 23-01-2010, 20:35
flyvin flyvin is offline
Registered User
FRC #0095
 
Join Date: Dec 2009
Location: Lebanon NH
Posts: 8
flyvin is an unknown quantity at this point
Re: Problem Loading Java Code

The "[cRIO] Information: No user-supplied RobotMain()" is not an issue. If you look at the simple robot class (the superclass), there is a method called RobtMain() with a print statment that says "Information: No user-supplied RobotMain()". If you don't override it, it will print that on the screen. The comment above the method says you only need to oeverride it if you don't want to use the operatorControl() and autonomous() methods, and just want to program them in manually.
Reply With Quote
  #25   Spotlight this post!  
Unread 26-01-2010, 23:01
charrisTTI charrisTTI is offline
Ramblin' Wreck
AKA: Charles Harris
FRC #0623
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Vienna, VA
Posts: 106
charrisTTI has a spectacular aura aboutcharrisTTI has a spectacular aura about
Send a message via AIM to charrisTTI
Re: Problem Loading Java Code

Java example code is wrong. Disable the watch dog at the top of autonomous and/or operatorControl. The disable of the watchdog in the constructor is cancelled out by code in the startApp method of RobotBase which is called after the instance is created but before autonomous or driverControl is called.
__________________
FRC 623 2003,2004,2005,2006,2007,2008, 2009, 2010, 2011
FRC 1900 2007
FVC 60 and 193 2006
FVC 3271 2007
FTC 226 and 369 2008, 2009, 2010, 2011
FTC 3806 2010
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
problems loading code with Easy C Clayton Programming 1 31-01-2008 15:15
Loading Code Onto 2005 RC chris31 Programming 13 08-11-2006 07:45
Ways to speed up code loading process? Makubesu Programming 10 21-01-2006 17:23
Java headache problem MisterX Programming 8 30-03-2005 11:09
problem loading code with ifi loader psych0gambit Programming 7 25-02-2005 20:43


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

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