Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   How do deploy code with Eclipse? (http://www.chiefdelphi.com/forums/showthread.php?t=132904)

Mr.Roboto3335 14-01-2015 21:10

How do deploy code with Eclipse?
 
I've been trying to deploy code to the roborio for a few days now. It's not connecting to the driver station either. It finds it in eclipse but it shows this
Code:

    [echo] [athena-deploy] Copying code over.
      [scp] Connecting to roboRIO-3335.local:22
      [scp] done.
      [scp] Connecting to roboRIO-3335.local:22
      [scp] done.
    [echo] [athena-deploy] Starting program.
  [sshexec] Connecting to roboRIO-3335.local:22
  [sshexec] cmd : . /etc/profile.d/natinst-path.sh; /usr/local/frc/bin/frcKillRobot.sh -t -r;
  [sshexec] start-stop-daemon: warning: killing process 3227: No such process
BUILD SUCCESSFUL
Total time: 8 seconds

and here's the code
Code:

package org.usfirst.frc.team3335.robot;

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

import edu.wpi.first.wpilibj.*;
import edu.wpi.first.wpilibj.vision.*;

public class Robot extends IterativeRobot {

    private Joystick controller;
    private RobotDrive drive;
    private SpeedController one, two, three, four, lift;
    private AxisCamera camera;
    private DigitalInput limit;

    public void robotInit() {
        joystickInit();
        sensorInit();
        robotDriveInit();
        speedControllerInit();
    }

    public void sensorInit() {
        limit = new DigitalInput(1);
    }

    public void joystickInit() {
        controller = new Joystick(1);
    }

    public void robotDriveInit() {
        drive = new RobotDrive(one, two, three, four);
    }

    public void speedControllerInit() {
        one = new Talon(1);
        two = new Talon(2);
        three = new Talon(3);
        four = new Talon(4);
        lift = new Talon(5);
    }

    public void autonomousPeriodic() {

    }

    public void teleopPeriodic() {
        double y = getDeadZone(controller.getY(), 0.1);
        double x = getDeadZone(controller.getThrottle(), 0.1);
        drive.arcadeDrive(y, x);
        if (controller.getAxis(Joystick.AxisType.kZ) > 0.8) {
                two.set(-1);
            } else if (controller.getAxis(Joystick.AxisType.kZ) < -0.8 && limit.get()) {
                two.set(1);
            } else {
                two.set(0);
            }
    }
    public void testPeriodic() {

    }

    public double getDeadZone(double axis, double zone) {

        return Math.abs(axis) > zone ? axis : 0;
    }
}

does this mean it was successful? I'm so confused. This is my first time using eclipse. And if anyone knows as to the roborio's:confused not wanting to show up on the driver station, it'd be a great help.

Team3266Spencer 14-01-2015 21:13

Re: How do deploy code with Eclipse?
 
Yes, that looks like a successful code deployment. If you're having issues though you should check for errors in the driver station log.

Mr.Roboto3335 14-01-2015 21:20

Re: How do deploy code with Eclipse?
 
What is Error 44009 on the driver station?

Mr.Roboto3335 14-01-2015 21:36

Re: How do deploy code with Eclipse?
 
Quote:

Originally Posted by Mr.Roboto3335 (Post 1428439)
What is Error 44009 on the driver station?

Never mind. I still don't understand why it won't connect. All the firmware has been uploaded and the image updated. The code has been deployed and yet nothing.

Team3266Spencer 14-01-2015 22:10

Re: How do deploy code with Eclipse?
 
Alright I'll ask the somewhat obvious questions lol.

Are you using the new driverstation, have you entered your team number into the driverstation, and how are you connecting to the rRIO?

Mr.Roboto3335 15-01-2015 11:08

Re: How do deploy code with Eclipse?
 
It is the new driverstation, I have entered the team number into the driverstation, and I'm connected via ethernet cable. I've also tried with the type a to type b usb cable.

Ozuru 15-01-2015 11:20

Re: How do deploy code with Eclipse?
 
Also, joysticks (and talons?) have a 0-index now. That code won't run unless your joystick is in slot 2.

Mr.Roboto3335 15-01-2015 20:11

Re: How do deploy code with Eclipse?
 
Are you saying I should put controller = new Joystick(2); ?

timytamy 15-01-2015 20:24

Re: How do deploy code with Eclipse?
 
Quote:

Originally Posted by Mr.Roboto3335 (Post 1428981)
Are you saying I should put controller = new Joystick(2); ?

What he's saying is that the roboRIO uses something called 0-indexed IO This means that the joystick (and all other IO identifiers) numbers go 0, 1, 2, 3. For the first, second, third and fourth ports respecivly

Your code:
Code:

controller = new Joystick(1);
sets up joystick in port 1, which is actually the SECOND port.

To solve this you can either
a) change the code to
Code:

controller = new Joystick(0);
b) change the driverstation so that the joystick goes into the SECOND port.

I recomend the first.

Onto your main problem.

When connected via ethernet, could you post the output of "ipconfig"
Are you getting No Robot Code, Comunications, or is it just not doing anything when you enable?

Mr.Roboto3335 15-01-2015 20:27

Re: How do deploy code with Eclipse?
 
Now I'm getting communications. It just says there's no robot code.
Code:

package org.usfirst.frc.team3335.robot;

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

import edu.wpi.first.wpilibj.*;
import edu.wpi.first.wpilibj.vision.*;

public class Robot extends IterativeRobot {

    private Joystick controller;
    private RobotDrive drive;
    private SpeedController one, two, three, four, lift;
    private AxisCamera camera;
    private DigitalInput limit;

    public void robotInit() {
        joystickInit();
        sensorInit();
        robotDriveInit();
        speedControllerInit();
    }

    public void sensorInit() {
        limit = new DigitalInput(0);
    }

    public void joystickInit() {
        controller = new Joystick(0);
    }

    public void robotDriveInit() {
        drive = new RobotDrive(one, two, three, four);
    }

    public void speedControllerInit() {
        one = new Victor(0);
        two = new Victor(1);
        three = new Victor(2);
        four = new Victor(3);
        lift = new Victor(4);
    }

    public void autonomousPeriodic() {

    }

    public void teleopPeriodic() {
        double y = getDeadZone(controller.getY(), 0.1);
        double x = getDeadZone(controller.getThrottle(), 0.1);
        drive.arcadeDrive(y,x);
        if (controller.getAxis(Joystick.AxisType.kZ) > 0.8) {
                two.set(-1);
            } else if (controller.getAxis(Joystick.AxisType.kZ) < -0.8 && limit.get()) {
                two.set(1);
            } else {
                two.set(0);
            }
    }
    public void testPeriodic() {

    }

    public double getDeadZone(double axis, double zone) {

        return Math.abs(axis) > zone ? axis : 0;
    }
}

This should work, right?

Mr.Roboto3335 15-01-2015 20:57

Re: How do deploy code with Eclipse?
 
Okay. There is a problem in the code. When I remove the RobotDrive, the robot code shows up on the driverstation. What's happening here?

Team3266Spencer 15-01-2015 21:26

Re: How do deploy code with Eclipse?
 
Your SpeedController objects should have a type of Victor, not SpeedController.

fsilberberg 16-01-2015 00:51

Re: How do deploy code with Eclipse?
 
Quote:

Originally Posted by Team3266Spencer (Post 1429008)
Your SpeedController objects should have a type of Victor, not SpeedController.

No, that's fine. What is likely happening is that you're initializing your speed controllers AFTER you initialize drive. They are null when passed to new RobotDrive(), which should throw a null pointer exception and crash. Try initializing the controllers before the drive.

Mr.Roboto3335 16-01-2015 13:34

Re: How do deploy code with Eclipse?
 
How silly of me x.x I forget that it matters which initialize first. Thank you for your help!

Mr.Roboto3335 16-01-2015 18:33

Re: How do deploy code with Eclipse?
 
Everything's working now. Thank you everybody!


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

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