Go to Post Remember, WWGD? (What would Grandma Do?) - Vikesrock [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 13-02-2010, 08:41
bhasinl bhasinl is offline
Registered User
FRC #1884 (Griffins)
Team Role: Programmer
 
Join Date: Feb 2010
Rookie Year: 2008
Location: London
Posts: 6
bhasinl is an unknown quantity at this point
Parallax Java Implementation?

Hi everyone. Our team (Team 1884) has been trying to use ultrasonics for this year's game. We've been successful in using an analog sensor but are facing trouble in reading from the Parallax digital ultrasonic sensors. Since the Ultrasonic Java class should work with our Parallax model (according to the documentation), we decided to use it.

Below is our code (parallax is an Ultrasonic object that has been properly constructed, enabled, and initialized in the code):


Code:
public double parallaxValue()
{
        parallax.ping();
        Timer.delay(0.05);
        double parallaxReading = parallax.getRangeInches();

        System.out.println("Parallax: " + parallaxReading + " inches");

        return parallaxReading;
}

Unfortunately, this is always returning 0.04068 inches, regardless of which way the sensor points. We tried the getRangeMM() method but that just returned a constant of 1.033272 mm, which is just 25.4 mm/in * 0.04068 inches. We also tried changing the Timer delay, but to no avail.

We don't see why this is happening since the ultrasonic just takes the amount of time it takes for a pulse to return, multiplies it by the speed of sound (in inches/sec), and divides that distance by two.

We'd really appreciate some input on why we always get this value. Has anyone else also tried the Parallax ultrasonic and gotten it to work?

Thank you,
Team 1884
Reply With Quote
  #2   Spotlight this post!  
Unread 15-02-2010, 04:42
bhasinl bhasinl is offline
Registered User
FRC #1884 (Griffins)
Team Role: Programmer
 
Join Date: Feb 2010
Rookie Year: 2008
Location: London
Posts: 6
bhasinl is an unknown quantity at this point
Re: Parallax Java Implementation?

Sorry to double post, but has any team successfully used a Parallax sensor before? If so, how do they work (and would they work with the code I posted above)?

We'd really appreciate some help with this!

Thanks,
bhasinl
Team 1884
Reply With Quote
  #3   Spotlight this post!  
Unread 16-02-2010, 16:19
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 588
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: Parallax Java Implementation?

Are you talking about the Parallax "Ping" sensor? I believe that it only has a single I/O line and is not supported. The maxbotics sensors that return analog values work very well, also the Vex/Davantech sensors work. The Vex and Daventech SRF04 sensors have have two lines, one to do the ping and another to read the return timing.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
New Seeding Algorithm Implementation DanDon Rules/Strategy 9 12-01-2010 00:07
**FIRST EMAIL**/Java and Orbit Balls *****JAVA DISCUSSION*** Pjohn1959 Programming 37 31-08-2009 15:55
limit switch implementation Integral NI LabVIEW 0 10-02-2009 19:21
Implementation of Traction Control keehun Programming 5 10-02-2009 10:02
Gyro Implementation Guarana Programming 12 07-02-2008 17:07


All times are GMT -5. The time now is 09:10.

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