Go to Post A good driver will always win over a good robot. - Mike Norton [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
  #1   Spotlight this post!  
Unread 20-12-2013, 08:53
BlackUnicorns BlackUnicorns is offline
Registered User
FRC #5135
 
Join Date: Dec 2013
Location: Israel
Posts: 3
BlackUnicorns is an unknown quantity at this point
Just began using Java

hey guys, we are team 5135 from israel, and we just started programming with java.

so we were wondering if you can help us get started (:

Thx!,
Frc 5135 - Black Unicorns
Reply With Quote
  #2   Spotlight this post!  
Unread 20-12-2013, 09:14
Jon Stratis's Avatar
Jon Stratis Jon Stratis is offline
Electrical/Programming Mentor
FRC #2177 (The Robettes)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Minnesota
Posts: 3,738
Jon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond repute
Re: Just began using Java

Check out the powerpoint our team gave at the MN Splash event a few weeks ago: http://www.therobettes.com/sites/def...mmandBase.pptx

If you have any questions, I'm sure our programmers would be willing to help! Just drop us an e-mail at 2177@therobettes.com
__________________
2007 - Present: Mentor, 2177 The Robettes
LRI: North Star 2012-2016; Lake Superior 2013-2014; MN State Tournament 2013-2014, 2016; Galileo 2016; Iowa 2017
2015: North Star Regional Volunteer of the Year
2016: Lake Superior WFFA
Reply With Quote
  #3   Spotlight this post!  
Unread 20-12-2013, 09:14
nickmcski nickmcski is offline
Registered User
AKA: Nicholas McCurry
FRC #1482 (Grandin Ghosts)
Team Role: Alumni
 
Join Date: Nov 2012
Rookie Year: 2012
Location: Canada
Posts: 107
nickmcski has a spectacular aura aboutnickmcski has a spectacular aura aboutnickmcski has a spectacular aura about
Smile Re: Just began using Java

I would recommend going to this website, its the website for the API that you will be using to program. It goes through all the steps to setup your development environment. http://wpilib.screenstepslive.com/s/...elopment-tools

I hope that will be enough to get started, if you have any more questions or encounter any problems I would be delighted to help you!
Reply With Quote
  #4   Spotlight this post!  
Unread 20-12-2013, 12:49
BlackUnicorns BlackUnicorns is offline
Registered User
FRC #5135
 
Join Date: Dec 2013
Location: Israel
Posts: 3
BlackUnicorns is an unknown quantity at this point
Re: Just began using Java

Thank you!
We tried to make an arcade drive program (before, we used LabView to drive our robot), and we have a little problem.. this is our 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.Jaguar;
import edu.wpi.first.wpilibj.Joystick;
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 RobotTemplate extends SimpleRobot {
    /**
     * This function is called once each time the robot enters autonomous mode.
     */
    Joystick driveStick = new Joystick(1);
    RobotDrive  myDrive = new RobotDrive(1, 2);
    public void autonomous() {
        
    }

    /**
     * This function is called once each time the robot enters operator control.
     */
    public void operatorControl() {
        while (isOperatorControl() && isEnabled()){
            myDrive.arcadeDrive(driveStick);
            Timer.delay(0.01);
        }
    }
}
Forword and backwords works fine, but the problem was with left and right..
when you turn right it turns left, and left turns right..
Can you tell us what we did wrong?

We really appreciate your help, thank you very much (:
Reply With Quote
  #5   Spotlight this post!  
Unread 20-12-2013, 12:58
Jon Stratis's Avatar
Jon Stratis Jon Stratis is offline
Electrical/Programming Mentor
FRC #2177 (The Robettes)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Minnesota
Posts: 3,738
Jon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond repute
Re: Just began using Java

Change this line:

RobotDrive myDrive = new RobotDrive(1, 2);

to:

RobotDrive myDrive = new RobotDrive(2, 1);


Think about what's happening. When you push forwards on the joystick, the RobotDrive tells both motors (1 and 2) to drive forward, which works fine. Likewise, pulling the joystick backwards makes both motors go backwards.

But if you want to turn left (spin in place) then one motor has to go forwards and one has to go backwards. In this case, it picked the wrong ones, and as a result spins in the wrong direction. By switching the order you pass in the motors, you'll switch it's choice and it'll turn in the right direction.
__________________
2007 - Present: Mentor, 2177 The Robettes
LRI: North Star 2012-2016; Lake Superior 2013-2014; MN State Tournament 2013-2014, 2016; Galileo 2016; Iowa 2017
2015: North Star Regional Volunteer of the Year
2016: Lake Superior WFFA
Reply With Quote
  #6   Spotlight this post!  
Unread 20-12-2013, 13:17
BlackUnicorns BlackUnicorns is offline
Registered User
FRC #5135
 
Join Date: Dec 2013
Location: Israel
Posts: 3
BlackUnicorns is an unknown quantity at this point
Re: Just began using Java

Quote:
Originally Posted by Jon Stratis View Post
Change this line:

RobotDrive myDrive = new RobotDrive(1, 2);

to:

RobotDrive myDrive = new RobotDrive(2, 1);


Think about what's happening. When you push forwards on the joystick, the RobotDrive tells both motors (1 and 2) to drive forward, which works fine. Likewise, pulling the joystick backwards makes both motors go backwards.

But if you want to turn left (spin in place) then one motor has to go forwards and one has to go backwards. In this case, it picked the wrong ones, and as a result spins in the wrong direction. By switching the order you pass in the motors, you'll switch it's choice and it'll turn in the right direction.
What you say makes a lot of sense, but i remember that we tried doing it today and it didnt work..
I dont have the robot now to try it but i will try it tomorrow and see if it works.

by the way, i remember when we used labview, it had a robot simulator, does java has something like that too?
Reply With Quote
  #7   Spotlight this post!  
Unread 20-12-2013, 13:43
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,561
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Just began using Java

Quote:
Originally Posted by BlackUnicorns View Post
by the way, i remember when we used labview, it had a robot simulator, does java has something like that too?
There isn't an official java simulator like there is for LabVIEW.

I've seen a few different attempts where people have tried to put one together, for example http://www.chiefdelphi.com/forums/sh...d.php?t=112024, but I have not tried any of them.
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


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

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