![]() |
Code and Deployment Help
Hello with the help of Youtube and CD I was finally able to make my first java program for the robot.
Here it is: The main class: Code:
// ***************** THIS CODE WAS WRITTEN BY BILAL MAJEED ***************** // Code:
package bilal.robotics.code;Thanks Also how would i deploy this code on to the robot. Thanks |
Re: Code and Deployment Help
I'm assuming that you are using netbeans, and that all your constants/fields are correct. I can't really diagnose problems from here without seeing your setup.
The only issue I see in your code is that your teleopPeriodic might never get called, because of your infinite loop in your teleopInit. I would suggest moving just your driving code (not the loop) to your teleopPeriodic. For future reference, avoid loops unless they are escapable. As for deploying, make sure your computer can communicate with your cRIO (ping it), and then push the "green arrow" or push "F6" or go to the "run" menu and select "run main project". Good Luck! |
Re: Code and Deployment Help
Thank you for the help, I made the adjustments to the code as you instructed and this is how it looks like:
Code:
package bilal.eci.code.robotics;ps. I deleted the use of the button and i also deleted the shooter class |
Re: Code and Deployment Help
There are a few things that I see in your code: empty statements (not a bad thing to have, but very superfluous) and an infinite loop (definitely a bad thing).
The code you posted looks like this; I added the comments. Quote:
You have an infinite loop in teleopInit(), so your program will never progress beyond that because it is always enabled and under operator control during teleop. If you're not going to do anything with a method, leave it out entirely - this goes for the robotInit(), autonomousPeriodic(), autonomousContinuous(), teleopInit(), and teleopContinuous() methods in the code you posted. Better code would look like this: Code:
package bilal.eci.code.robotics; |
Re: Code and Deployment Help
Quote:
ps. I pretty new to Java, ::rtm:: and i think "final" is like a variable type (string, integer), so could you please tell what is a final. :p Thanks |
Re: Code and Deployment Help
Quote:
For example: Code:
Jaguar jaguar = new Jaguar(1);Code:
final Jaguar jaguar = new Jaguar(1); |
Re: Code and Deployment Help
WOW...thank you very much
So i have made the adjustments you told me to, and here how it looks like: Code:
// This code was created on Friday June 15, 2012 by Bilal MajeedLet me know if i did anything wrong or differently, and also any tips or advice will be greatly appreciated, thank you :D |
Re: Code and Deployment Help
looks good. In the future, when you write your own classes where things might change, you will not need to use the "final" keyword. I usually only use it for variables where I am sure nothing will change.
|
| All times are GMT -5. The time now is 09:01 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi