Go to Post Haters gonna hate; kill 'em with kindness. - Taylor [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 Rating: Thread Rating: 2 votes, 3.00 average. Display Modes
  #1   Spotlight this post!  
Unread 03-09-2013, 13:50
TenaciousDrones's Avatar
TenaciousDrones TenaciousDrones is offline
FRC Team 4780
FRC #4780 (The Tenacious Drones)
 
Join Date: Sep 2013
Rookie Year: 2012
Location: Parma, Ohio
Posts: 57
TenaciousDrones is an unknown quantity at this point
Java Autonomous Help

I'm David and I am part of Team 4780 and we are a second year team that is switching from LabVIEW to Java. I'm currently having a problem programming autonomous. I have no idea how turn the robot. I know you can turn it by changing the curve value, but can I turn it stationary (pivot). Or even the ratios for different turns at 1/2 speed for whatever amount of time.
Reply With Quote
  #2   Spotlight this post!  
Unread 03-09-2013, 18:31
ekapalka's Avatar
ekapalka ekapalka is offline
Registered User
FRC #3216
 
Join Date: Dec 2012
Location: Bermuda
Posts: 277
ekapalka has a spectacular aura aboutekapalka has a spectacular aura about
Re: Java Autonomous Help

Is your robot using differential steering? If so, to turn in place you would simply set one side of your drivetrain to a particular speed and the other to the opposite of that. What is your chassis like (and what is this curve value)?
Reply With Quote
  #3   Spotlight this post!  
Unread 03-09-2013, 18:35
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,572
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: Java Autonomous Help

The drive (ie ratio curve) method in wpilib will do a turn in place if you set curve to 1 or -1. The outputMagnitude will determine how fast it will turn in place.

I've always found it simpler to use arcadeDrive or tankDrive in autonomous, and haven't really used the ratio curve method. I recommend using whichever one you used in LabVIEW.
Reply With Quote
  #4   Spotlight this post!  
Unread 04-09-2013, 09:04
TenaciousDrones's Avatar
TenaciousDrones TenaciousDrones is offline
FRC Team 4780
FRC #4780 (The Tenacious Drones)
 
Join Date: Sep 2013
Rookie Year: 2012
Location: Parma, Ohio
Posts: 57
TenaciousDrones is an unknown quantity at this point
Re: Java Autonomous Help

I'm a little lost because this is my first year programming. I'm starting from scratch because our old programmer forgot the password and I had to reimage the our computer so I don't have any of our previous data.

By differential steering, do you mean chassis.drive(ROBOT_TASK_PRIORITY, ROBOT_TASK_PRIORITY);?

So if I were to use the curve, it only works at 1.0 or -1.0.

Also I can just use arcade/tank drive to turn? Can you possibly explain how?

Thank you for the help guys.

Also, I have our robot set for arcade drive in teleop and fowards and backwards are fine but the left and right are flipped. Basically up is foward, back is backwards, left is right, and right is left. I can't remember if our robot was like that last year. Is there any way to fix that.

Last edited by TenaciousDrones : 04-09-2013 at 09:17. Reason: Another question.
Reply With Quote
  #5   Spotlight this post!  
Unread 04-09-2013, 17:51
Pault's Avatar
Pault Pault is offline
Registered User
FRC #0246 (Overclocked)
Team Role: College Student
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Boston
Posts: 618
Pault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond repute
Re: Java Autonomous Help

Quote:
Originally Posted by TenaciousDrones View Post
I'm a little lost because this is my first year programming. I'm starting from scratch because our old programmer forgot the password and I had to reimage the our computer so I don't have any of our previous data.

By differential steering, do you mean chassis.drive(ROBOT_TASK_PRIORITY, ROBOT_TASK_PRIORITY);?

So if I were to use the curve, it only works at 1.0 or -1.0.

Also I can just use arcade/tank drive to turn? Can you possibly explain how?

Thank you for the help guys.

Also, I have our robot set for arcade drive in teleop and fowards and backwards are fine but the left and right are flipped. Basically up is foward, back is backwards, left is right, and right is left. I can't remember if our robot was like that last year. Is there any way to fix that.
Basically, to use arcade drive during autonomous, create a method in your chassis subsystem that takes in 2 parameters: double speed, double turnRate. The method only needs to contain 1 line: chassis.arcadeDrive(speed, turnRate); From there, just put it into a command like normal, feeding it the speed and turnRate values. To turn in place, just feed it (0, 1) or (0, -1). A similar process applies to tankDrive, only now your parameters are double leftSpeed, double rightSpeed, your line of code is chassis.tankDrive(leftSpeed, rightSpeed); and to turn in place you feed it (1, -1) or (-1, 1).

About the teleop question: are you using 1 joystick, 2 joysticks, or 1 gamepad to drive (only to control the drivetrain, don't include what your operator uses). And could you post the line of code that controls the drivetrain (chassis.arcadeDrive(...);)
Reply With Quote
  #6   Spotlight this post!  
Unread 04-09-2013, 20:26
TenaciousDrones's Avatar
TenaciousDrones TenaciousDrones is offline
FRC Team 4780
FRC #4780 (The Tenacious Drones)
 
Join Date: Sep 2013
Rookie Year: 2012
Location: Parma, Ohio
Posts: 57
TenaciousDrones is an unknown quantity at this point
Re: Java Autonomous Help

I'm using one joystick. And the code line is

public void operatorControl() {
chassis.setSafetyEnabled(true);
while (isOperatorControl() && isEnabled())
chassis.arcadeDrive(rightStick);
Timer.delay(0.01);
}

Last edited by TenaciousDrones : 05-09-2013 at 08:48.
Reply With Quote
  #7   Spotlight this post!  
Unread 05-09-2013, 15:15
Pault's Avatar
Pault Pault is offline
Registered User
FRC #0246 (Overclocked)
Team Role: College Student
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Boston
Posts: 618
Pault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond repute
Re: Java Autonomous Help

Quote:
Originally Posted by TenaciousDrones View Post
I'm using one joystick. And the code line is

public void operatorControl() {
chassis.setSafetyEnabled(true);
while (isOperatorControl() && isEnabled())
chassis.arcadeDrive(rightStick);
Timer.delay(0.01);
}
Oh, you are using the simple robot template. I recommend that you look into the command based robot template. Unless your team has a REALLY simple robot, the simple robot template is going to get really crowded and hard to read really fast. (Hence the name simple robot template).

Anyways... the solution might be a bit more complicated than this; I will check when I get home. Replace chassis.arcadeDrive(rightStick); with chassis.arcadeDrive(rightStick.getY(), - rightStick.getX()); That should invert the turn values.

Last edited by Pault : 05-09-2013 at 21:27.
Reply With Quote
  #8   Spotlight this post!  
Unread 05-09-2013, 20:12
TenaciousDrones's Avatar
TenaciousDrones TenaciousDrones is offline
FRC Team 4780
FRC #4780 (The Tenacious Drones)
 
Join Date: Sep 2013
Rookie Year: 2012
Location: Parma, Ohio
Posts: 57
TenaciousDrones is an unknown quantity at this point
Re: Java Autonomous Help

Quote:
Originally Posted by Pault View Post
Oh, you are using the simple robot template. I recommend that you look into the command based robot template. Unless your team has a REALLY simple robot, the simple robot template is going to get really crowded and hard to read really fast. (Hence the name simple robot template).

Anyways... the solution might be a bit more complicated than this; I will check when I get home. Replace chassis.arcadeDrive(rightStick); with chassis.arcadeDrive(rightStick.getY(), - rightStick.getX); That should invert the turn values.
What do you mean by command based robot template? And I'll let you know if that fixed once I get to school tomorrow.
Reply With Quote
  #9   Spotlight this post!  
Unread 05-09-2013, 22:22
Pault's Avatar
Pault Pault is offline
Registered User
FRC #0246 (Overclocked)
Team Role: College Student
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Boston
Posts: 618
Pault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond repute
Re: Java Autonomous Help

Quote:
Originally Posted by TenaciousDrones View Post
What do you mean by command based robot template? And I'll let you know if that fixed once I get to school tomorrow.
I checked, this solution should work fine. Incase you didn't catch it, I made a small syntax error; the line of code should be chassis.arcadeDrive(rightStick.getY(), - rightStick.getX());

Basically, when you create a new project for a robot, you have 4 types of templates to choose from. The one that you are using (or at least I think you are using) is called SimpleRobotTemplate. In it, you are just given 1 page with places to put your code for autonomous, operatorControl, disabled, etc. It is very hard to properly organize large ammounts of code inside of this template. That is why the CommandBasedRobotTemplate exists to divide up your code into sections. It is based off of 3 main parts: subsystems, commands, and the OI. It is had to explain, but basically you create a subsystem in code for each subsystem on your robot. This subsystem contains information about that part of the robot. You then create commands for everything that you want your robot to be able to do. The commands use the subsystems to figure out how to do what they need to do. The OI (operator interface) simply figures out "if the driver does X, I should start running command Y".
Reply With Quote
  #10   Spotlight this post!  
Unread 05-09-2013, 22:35
TenaciousDrones's Avatar
TenaciousDrones TenaciousDrones is offline
FRC Team 4780
FRC #4780 (The Tenacious Drones)
 
Join Date: Sep 2013
Rookie Year: 2012
Location: Parma, Ohio
Posts: 57
TenaciousDrones is an unknown quantity at this point
Re: Java Autonomous Help

Ok I know what you're talking about now, that makes sense. Well I'll let you know how it works out.
Reply With Quote
  #11   Spotlight this post!  
Unread 06-09-2013, 09:29
TenaciousDrones's Avatar
TenaciousDrones TenaciousDrones is offline
FRC Team 4780
FRC #4780 (The Tenacious Drones)
 
Join Date: Sep 2013
Rookie Year: 2012
Location: Parma, Ohio
Posts: 57
TenaciousDrones is an unknown quantity at this point
Re: Java Autonomous Help

So I'm looking into the command based robot template along with the wpilib guide online and I'm a little bit lost. I get what it says I just don't know where to put everything. Would you or anyone else be able to send me a sample so I can better understand?
Reply With Quote
  #12   Spotlight this post!  
Unread 06-09-2013, 11:45
otherguy's Avatar
otherguy otherguy is offline
sparkE
AKA: James
FRC #2168 (The Aluminum Falcons)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: CT
Posts: 431
otherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to behold
Re: Java Autonomous Help

There's a pretty good set of tutorials/guides here.

Navigate through the links on the left hand side for different topics.

You could also use the robotbuilder tool to generate complete command based robot projects.
__________________
http://team2168.org
Reply With Quote
  #13   Spotlight this post!  
Unread 06-09-2013, 14:27
Pault's Avatar
Pault Pault is offline
Registered User
FRC #0246 (Overclocked)
Team Role: College Student
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Boston
Posts: 618
Pault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond repute
Re: Java Autonomous Help

Quote:
Originally Posted by TenaciousDrones View Post
So I'm looking into the command based robot template along with the wpilib guide online and I'm a little bit lost. I get what it says I just don't know where to put everything. Would you or anyone else be able to send me a sample so I can better understand?
You could probably get a good sample by clicking on new project in NetBeans and looking in the samples folder.

However, IMHO the best way to learn are the videos on this channel. I have referred people to this channel many times before, and I will keep doing it, because I think it is an amazing resource that we have. You will notice that there are 2 playlists, one that uses robotbuilder and one that doesn't. You can check out otherguy's link to see if it's something that you want to use. FWIW, I highly recommend robotbuilder.
Reply With Quote
  #14   Spotlight this post!  
Unread 06-09-2013, 15:05
TenaciousDrones's Avatar
TenaciousDrones TenaciousDrones is offline
FRC Team 4780
FRC #4780 (The Tenacious Drones)
 
Join Date: Sep 2013
Rookie Year: 2012
Location: Parma, Ohio
Posts: 57
TenaciousDrones is an unknown quantity at this point
Re: Java Autonomous Help

Ok thanks guys I'll try these out. I'll let you guys know if I have any more problems.
Reply With Quote
  #15   Spotlight this post!  
Unread 08-09-2013, 20:20
Ipiano's Avatar
Ipiano Ipiano is offline
Registered User
AKA: Andrew Stelter
FRC #3018 (Nordic Storm)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Mankato, Minnesota
Posts: 27
Ipiano is an unknown quantity at this point
Re: Java Autonomous Help

If you use the Command base and/or RobotBuilder, and you decide that you really like it and get the hang of it, you could take a look at my thread here(http://www.chiefdelphi.com/forums/sh...d.php?t=118745) about autonomous. I made a couple of classes you can extend to set up your autonomous so that it's really easy to change.
__________________
________
Genius is one percent inspiration and ninety-nine percent perspiration.
--Thomas A. Edison
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 11: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