Go to Post Wishes and dreams can hold a robot together just as well as nuts and bolts. - Kyle [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 22-01-2012, 13:07
JohnFogarty's Avatar
JohnFogarty JohnFogarty is offline
FTC, I have returned.
AKA: @doctorfogarty
FTC #11444 (Garnet Squadron) & FRC#1102 (M'Aiken Magic)
Team Role: Mentor
 
Join Date: Aug 2009
Rookie Year: 2006
Location: SC
Posts: 1,564
JohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond repute
Dist/Speed Function Question.

For this year's competition we are going to have a shooter that has a sensor that reads how far it is from the goal and then by means of a predetermined array select the appropriate speed setting.
The only problem is the set speed method requires a double and I'm not sure how to make an array of doubles.
it doesn't seem to be simply,

double SPEED = new double[];

I was wondering if I was going to have to use an ArrayList to achieve my goal.
__________________
John Fogarty
2010 FTC World Championship Winner & 2013-2014 FRC Orlando Regional Winner
Mentor FRC Team 1102 M'Aiken Magic
"Head Bot Coach" FTC Team 11444 Garnet Squadron
Former Student & Mentor FLL 1102, FTC 1102 & FTC 3864, FRC 1772, FRC 5632
2013 FTC World Championship Guest Speaker
Reply With Quote
  #2   Spotlight this post!  
Unread 22-01-2012, 16:28
Spex_guy's Avatar
Spex_guy Spex_guy is offline
Java Master
AKA: Martin Wickham
FRC #2220
Team Role: Programmer
 
Join Date: Dec 2011
Rookie Year: 2008
Location: Minnesota
Posts: 4
Spex_guy is an unknown quantity at this point
Re: Dist/Speed Function Question.

There are two ways of doing this. If you can determine a mathematical function, use that. Otherwise, try this:
Code:
final double[] SPEED = {double1, double2, double3...};
The reason your compiler didn't like the line you posted is because of syntax. It should have looked like this:
Code:
double[] SPEED = new double[SIZE];
I don't recommend using an ArrayList as they use a lot more memory than you need and they require objects, not primitives.
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 09:53.

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