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
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
Check out the powerpoint our team gave at the MN Splash event a few weeks ago: http://www.therobettes.com/sites/default/files/MNSplash_2013_Java_CommandBase.pptx
If you have any questions, I’m sure our programmers would be willing to help! Just drop us an e-mail at [email protected]
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/3120/m/7885/l/79405-installing-the-java-development-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!
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:
/*----------------------------------------------------------------------------*/
/* 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 (:
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?
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/showthread.php?t=112024, but I have not tried any of them.