Go to Post For those of you that think the kit chassis is too weak... It is tough stuff. Those of you that say it is too weak, just do not know what you are talking about. - Paul Copioli [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 06-02-2012, 17:11
nuru nuru is offline
Registered User
FRC #4404
 
Join Date: Jan 2012
Location: missouri
Posts: 4
nuru is an unknown quantity at this point
help for code to run motor

We are a rookie team and we wrote the following code to operate the motor.
We are not sure if it will work. Please help.

public class ParkwayRobot extends SimpleRobot
{
private final int PORT_ONE = 1;
private final int PORT_TWO = 2;
private final int MY_SLOT = 1; // or 2, 3, 4
private final double DESIRED_SPEED = 0.7;

RobotDrive drive = new RobotDrive(1, 2); // motors in ports 1 and 2
Joystick leftJoy = new Joystick(PORT_ONE);
Joystick rightJoy = new Joystick(PORT_TWO);

public void autonomous()
{

Jaguar firstJaguar = new Jaguar(MY_SLOT, PORT_ONE);
firstJaguar.set(DESIRED_SPEED); // between -1.0 and 1.0
}

public void operatorControl()
{

while (isOperatorControl() && isEnabled())
{
Drive.tankDrive(leftJoy, rightJoy);
Timer.delay(0.005);
}
}

}

We are not sure how to compile and run this code using Netbeans. Please help.

Thanks a lot!
Reply With Quote
  #2   Spotlight this post!  
Unread 06-02-2012, 22:02
severhale severhale is offline
Registered User
FRC #4097
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Northampton, MA
Posts: 10
severhale is an unknown quantity at this point
Re: help for code to run motor

Well to start, you may want to be more specific with your names. Saying LEFTJOYSTICKPORT instead of PORT_1 is much more helpful because you won't be accidentally mixing them up.

For running it, you have to go to setting, miscellaneous and put in your team number in the box where it says "team number." Then you can build it and if you're connected to the robot and on its subnet it will automatically upload it to the cRIO.
Reply With Quote
  #3   Spotlight this post!  
Unread 06-02-2012, 22:10
msulaimain's Avatar
msulaimain msulaimain is offline
Registered User
AKA: Muhammad Sulaiman
FRC #3346 ([{Kamikaze Komets}])
Team Role: Programmer
 
Join Date: Mar 2010
Rookie Year: 2009
Location: USA
Posts: 36
msulaimain can only hope to improve
Send a message via AIM to msulaimain Send a message via Yahoo to msulaimain
Re: help for code to run motor

Any of the platforms that US FIRST provides teams with have examples that one can refer to and which can help you really understand the basic structure of programming in that language. I program in C++ and I know that they definitely have a SimpleRobot example. Maybe your platform has example programs as well.
__________________
int main()
{
::::::::: include=>commitment;
::::::::: int=>school name=>Asheboro::High
::::::::: int=>team name=>Kamikaze::Komets;
::::::::: Priority_Queue=>FRC Championship::2012;
::::::::: Max_Element=>Teamwork;
}
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 12:46.

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