Go to Post I don't think finding a way to defend the center goals is un-Gracious Professionalismistic (wow). - Sachiel7 [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 28-03-2014, 18:43
alexander.h's Avatar
alexander.h alexander.h is offline
Lead Programmer, Captain, Driver
FRC #3975 (The Dragons)
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2012
Location: Montreal, Quebec, Canada
Posts: 261
alexander.h has a spectacular aura aboutalexander.h has a spectacular aura aboutalexander.h has a spectacular aura about
Beginner Java Help - Question 1

Hello! I'm new to Java (we're planning to switch to it next year after passing the last three years using Labview) and I have one important question. In the "Getting Started with Java for FRC" pdf, it shows the following code for an autonomous that drives in a square pattern by driving half speed for 2 seconds, then turns 90 degrees. This is repeated 4 times :

Code:
public void autonomous() { 

     for (int i = 0; i < 4; i++) { 
          drive.drive(0.5, 0.0); // drive 50% fwd 0% turn 
          Timer.delay(2.0); // wait 2 seconds 
          drive.drive(0.0, 0.75); // drive 0% fwd, 75% turn 
       } 

     drive.drive(0.0, 0.0); // drive 0% forward, 0% turn 
}
What I don't understand is why it's a 75% turn for a 90 deg turn? Is there some way this was calculated?

Thanks!

P.S. I called this "Question 1" because I know that I will have other questions about Java in the future!
__________________



2012 - Rebound Rumble - Montreal Robotics Festival - Qualified 15th - Semifinalists thanks to 3379 and 3710 (Record : 8-8-1)
2013 - Ultimate Ascent - Montreal Robotics Festival - Qualified 33rd - Dean's List Finalist : Yazid Djenadi (Record : 4-8-0)
2014 - Aerial Assist - Montreal Robotics Festival - Qualified 9th (Record : 6-4-1)
2015 - Recycle Rush *** I predicted the game ***

Reply With Quote
  #2   Spotlight this post!  
Unread 28-03-2014, 18:55
NotInControl NotInControl is offline
Controls Engineer
AKA: Kevin
FRC #2168 (Aluminum Falcons)
Team Role: Engineer
 
Join Date: Oct 2011
Rookie Year: 2004
Location: Groton, CT
Posts: 261
NotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond repute
Re: Beginner Java Help - Question 1

I doubt it was calculated. It is just a code example so try not to read too much into it.

It was probably reduced to control speed of the turn. But paramters on your test chasis will be different.

The take away from the example is to show how to set individual motor speeds, and performing time based waits.

Hope this helps,
Kevin
__________________
Controls Engineer, Team 2168 - The Aluminum Falcons
[2016 Season] - World Championship Controls Award, District Controls Award, 3rd BlueBanner
-World Championship- #45 seed in Quals, World Championship Innovation in Controls Award - Curie
-NE Championship- #26 seed in Quals, winner(195,125,2168)
[2015 Season] - NE Championship Controls Award, 2nd Blue Banner
-NE Championship- #26 seed in Quals, NE Championship Innovation in Controls Award
-MA District Event- #17 seed in Quals, Winner(2168,3718,3146)
[2014 Season] - NE Championship Controls Award & Semi-finalists, District Controls Award, Creativity Award, & Finalists
-NE Championship- #36 seed in Quals, SemiFinalist(228,2168,3525), NE Championship Innovation in Controls Award
-RI District Event- #7 seed in Quals, Finalist(1519,2168,5163), Innovation in Controls Award
-Groton District Event- #9 seed in Quals, QuarterFinalist(2168, 125, 5112), Creativity Award
[2013 Season] - WPI Regional Winner - 1st Blue Banner
Reply With Quote
  #3   Spotlight this post!  
Unread 28-03-2014, 18:56
alexander.h's Avatar
alexander.h alexander.h is offline
Lead Programmer, Captain, Driver
FRC #3975 (The Dragons)
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2012
Location: Montreal, Quebec, Canada
Posts: 261
alexander.h has a spectacular aura aboutalexander.h has a spectacular aura aboutalexander.h has a spectacular aura about
Re: Beginner Java Help - Question 1

Quote:
Originally Posted by NotInControl View Post
I doubt it was calculated. It is just a code example so try not to read too much into it.

It was probably reduced to control speed of the turn. But paramters on your test chasis will be different.

The take away from the example is to show how to set individual motor speeds, and performing time based waits.

Hope this helps,
Kevin
So, for one robot, it could be o.6, but for another, it could be 0.8?
__________________



2012 - Rebound Rumble - Montreal Robotics Festival - Qualified 15th - Semifinalists thanks to 3379 and 3710 (Record : 8-8-1)
2013 - Ultimate Ascent - Montreal Robotics Festival - Qualified 33rd - Dean's List Finalist : Yazid Djenadi (Record : 4-8-0)
2014 - Aerial Assist - Montreal Robotics Festival - Qualified 9th (Record : 6-4-1)
2015 - Recycle Rush *** I predicted the game ***

Reply With Quote
  #4   Spotlight this post!  
Unread 28-03-2014, 19:20
Arhowk's Avatar
Arhowk Arhowk is offline
FiM CSA
AKA: Jake Niman
FRC #1684 (The Chimeras) (5460 Mentor)
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Lapeer
Posts: 543
Arhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to behold
Re: Beginner Java Help - Question 1

Quote:
Originally Posted by alexander.h View Post
So, for one robot, it could be o.6, but for another, it could be 0.8?
It also depends how far you're driving. The smallest amount of rotate will cause the robot to go into a circle. If you want to truly move in a 90 degree line, you have to rotate 90 degrees than move forward.

E/ nvm misread it.

0.75 has nothing to do with the degree of the turn. When the move value is 0, the robot will stay in place.

However, a rotate will cause the motors to run in opposite of each other, essentially turning the robot. 0.75 for 0 seconds (thats what the code says... rotate for 0 seconds) might be + or - depending on the weight of the robot and the condition of the battery.
Reply With Quote
  #5   Spotlight this post!  
Unread 28-03-2014, 19:27
NotInControl NotInControl is offline
Controls Engineer
AKA: Kevin
FRC #2168 (Aluminum Falcons)
Team Role: Engineer
 
Join Date: Oct 2011
Rookie Year: 2004
Location: Groton, CT
Posts: 261
NotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond repute
Re: Beginner Java Help - Question 1

Quote:
Originally Posted by alexander.h View Post
So, for one robot, it could be o.6, but for another, it could be 0.8?
Yes that is correct, you will need to play with the paramerts to achieve the turn you want based on your particular robot. The % will be based on the weight or the robot, # of motors on each side of your drive train, type of motors, and a couple of other paramters which describe the dynamics of your particular bot.

The example is open-loop, which means it turns without sensors, once you get the example working, dont worry too much if it the turn is not accurate or repeatable.

The main thing here is to make sure you understand the logic of what the code is doing.

After which, try adding sensors to make the turn more repeatable like encoders on the drivetrain, or gryo or digial compass if you would like to stick with this example and enhance upon it.

Hope this helps,
Kevin
__________________
Controls Engineer, Team 2168 - The Aluminum Falcons
[2016 Season] - World Championship Controls Award, District Controls Award, 3rd BlueBanner
-World Championship- #45 seed in Quals, World Championship Innovation in Controls Award - Curie
-NE Championship- #26 seed in Quals, winner(195,125,2168)
[2015 Season] - NE Championship Controls Award, 2nd Blue Banner
-NE Championship- #26 seed in Quals, NE Championship Innovation in Controls Award
-MA District Event- #17 seed in Quals, Winner(2168,3718,3146)
[2014 Season] - NE Championship Controls Award & Semi-finalists, District Controls Award, Creativity Award, & Finalists
-NE Championship- #36 seed in Quals, SemiFinalist(228,2168,3525), NE Championship Innovation in Controls Award
-RI District Event- #7 seed in Quals, Finalist(1519,2168,5163), Innovation in Controls Award
-Groton District Event- #9 seed in Quals, QuarterFinalist(2168, 125, 5112), Creativity Award
[2013 Season] - WPI Regional Winner - 1st Blue Banner
Reply With Quote
  #6   Spotlight this post!  
Unread 28-03-2014, 19:35
alexander.h's Avatar
alexander.h alexander.h is offline
Lead Programmer, Captain, Driver
FRC #3975 (The Dragons)
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2012
Location: Montreal, Quebec, Canada
Posts: 261
alexander.h has a spectacular aura aboutalexander.h has a spectacular aura aboutalexander.h has a spectacular aura about
Re: Beginner Java Help - Question 1

Quote:
Originally Posted by NotInControl View Post
Yes that is correct, you will need to play with the paramerts to achieve the turn you want based on your particular robot. The % will be based on the weight or the robot, # of motors on each side of your drive train, type of motors, and a couple of other paramters which describe the dynamics of your particular bot.

The example is open-loop, which means it turns without sensors, once you get the example working, dont worry too much if it the turn is not accurate or repeatable.

The main thing here is to make sure you understand the logic of what the code is doing.

After which, try adding sensors to make the turn more repeatable like encoders on the drivetrain, or gryo or digial compass if you would like to stick with this example and enhance upon it.

Hope this helps,
Kevin
I get it know ... thanks!
__________________



2012 - Rebound Rumble - Montreal Robotics Festival - Qualified 15th - Semifinalists thanks to 3379 and 3710 (Record : 8-8-1)
2013 - Ultimate Ascent - Montreal Robotics Festival - Qualified 33rd - Dean's List Finalist : Yazid Djenadi (Record : 4-8-0)
2014 - Aerial Assist - Montreal Robotics Festival - Qualified 9th (Record : 6-4-1)
2015 - Recycle Rush *** I predicted the game ***

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 13:01.

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