Shop OBEX P1 Docs P2 Docs Learn Events
PENGUIN ROBOT Ping UltraVision - the Code — Parallax Forums

PENGUIN ROBOT Ping UltraVision - the Code

HumanoidoHumanoido Posts: 5,770
edited 2008-02-11 11:50 in Robotics
Title: Penguin Ping Ultra Vision
Code Name: penguin_ping_ultravision.bpx
Purpose: PING))) Expansion Enables Ultra Vision


This program is amazing. Now Penguin can see from 1-inch
out to 9-feet! Just plug in the Parallax PING))) and run this
code.

Ultravision is a unique way of seeing things, even in total
darkness!

humanoido

' DIRECTORY
' ---------
' INTRO TO ULTRA EYE
' RANGEFINDER
' EXTRA EYE
' RANGE & ACCURACY
' VISION CLARITY
' TIMING CALIBRATION
' PROCEDURE
' RAW TIME
' FUN PROJECTS



' INTRO TO ULTRA EYE
' ------------------
' Penguin Ping))) Ultra Vision
' Plug in the Parallax Ping))) ultrasonic sensor and add
' an ultra eye to Penguin. Parallax Part number 28015.



' RANGEFINDER
' -----------
' Penguin becomes an ultrasonic rangefinder for finding distances
' to walls during construction projects.



' EXTRA EYE
' ---------
' Penguin now has an extra eye. This ultrasonic eye can be
' supplemented with readings of light intensity and infrared
' measurements using Penguin sensors.



' RANGE & ACCURACY
' ----------------
' This code adds ultrasonic vision. Range and accuracy will
' vary based on surrounding conditions and materials. Range is
' typically from 1-inch to 9-feet. Calibration *** is indicated in
' the comments.



' VISION CLARITY
' --------------
' Vision clarity is defined by the reflectivity of the object
' surface, inherent Ping))) resolution, and ambient noise.



' TIMING CALIBRATION
' ------------------
' The timing is calibrated as indicated in the comments.



' PROCEDURE
' ---------
' The Debug screen displays the startup splash screen, and is
' followed by:
'
'   Raw Time
'   Distance in Centimeters
'   Distance in Inches
'   Distance in Feet (remainder given below)
'   Remainder in Inches



' RAW TIME
' --------
' Raw time is the ping round trip time.


' FUN PROJECTS
' ------------
' Try looking at a variety of different objects from feathery
' and fluffy to smooth and hard. Measure and compare the reported
' Penguin distances with a mechanical tape measure. Determine
' which objects affect vision and in what manner.

' Some typical materials to try: window glass, mirror, wood, metal,
' walls, floors, cloth, screen, feathers, carpet, people.

' Try ranging on very small objects. What is the smallest object
' the eye can discern?

' Try ranging on two objects. At what close separation distance
' will both objects still resolve?

' How does the angle to various materials effect the results?

' Do the same optical properties exist with ultrasound vision
' as with light waves?

' Using two Penguins, can you detect the ping from the other
' Penguin? How can a useful application be developed from this
' approach?

' Establish a program to recognize specific objects by
' texture.

' Write a program for Penguin to find and touch two objects.

Comments

  • robots42robots42 Posts: 27
    edited 2008-02-07 00:31
    Hi
    When I tested the program the scale is wrong, the distances are too big, 62" reads 71".
    How did you arrive at the factor of
    time = time ** 2080/2

    Shouldn't it be
    **2257 (uS to cms) *0.8 (for Px counts to uS)
    ie **1806
    ie
    time = time ** 1806/2
    David
  • markwardmarkward Posts: 7
    edited 2008-02-07 02:13
    ...remember to factor in the speed of sound for local conditions; temperature and pressure.
  • robots42robots42 Posts: 27
    edited 2008-02-07 11:53
    Does he live a jet set life?
    Parallax and Wikipedia quote 344m/S for speed of sound.
    Wikipedia @21degC and presumably near sea level which is where most people live.
    Google just gives - speed of sound at sea level = 340.29 m / s
    Temperature seems to be the main factor.

    My readings were taken at 20degC and 350ft above sea level and normal weather
    62" reading as 71" would imply the program was for a speed of 344*62/71=300m/S
    http://www.fighter-planes.com/ has a table of SPEED OF SOUND AT DIFFERENT ALTITUDES
    300m/S equates to about 30,000 ft at -44degC.

    using a factor of 1806 gives 57" for 58" actual so it is about right
    1806 is the factor required for 0.8uS counts
    the factor for 1uS counts would be 1806/0.8 = 2257 (which is the factor quoted in the Ping documentation)
    2257/65536=0.0344
    1/0.0344 =29.04 uS/cm which implies 344m/S
    which is where we started.

    So unless the factor is for on the wing of a plane at 30,000ft where is it for?
    Alternatively what is wrong?

    David
  • HumanoidoHumanoido Posts: 5,770
    edited 2008-02-09 15:20
    For this program, empirical data was established and verified from the quoted min/max ranges. With this particular Penguin and Ping))), the results were repeatable and accurate, and verified with a tape measure and ruler. Results can significantly vary depending on the surface of the reflective object. There also appears to be some slight variances from one Ping))) to another, although this was not studied in detail. At the extreme edge of the spectrum, a feathery or very fluffy wave absorbing object may not show up at all or have diminished return. The study results for this program utilized a coated concrete wall which was highly reflective of ultrasonic waves. Conditions were highly humid (also a factor) and nearly at sea level. If results are consistently off with a particular Ping))) and BS2px combination, the program can be tuned for more accurate results.

    humanoido
  • robots42robots42 Posts: 27
    edited 2008-02-09 23:03
    All I am saying is at 20degC and 350ft above sea level and normal weather (75% humidity) and using using as a target a painted smooth plaster wall normal to the beam axis and using the Parallax conversion factors supplied in the Ping documentation with both of my Pings on a Penguin and with a BS2 on a TecFoot I get the correct distance reading to about 1%.

    I don't see how a damaged Ping could give bad results since both the ping flight time and the output pulse must governed by the Ping processor clock and so any errors would cancel out.

    David
  • HumanoidoHumanoido Posts: 5,770
    edited 2008-02-10 07:11
    Very good. You may want to make a universal version with the variables as input since your algorithm is working to 1% accuracy, and post your 2px program. I think the pings used for testing are not damaged, but to understand the slight differences in all three Pings would take further study and more time.

    humanoido
  • robots42robots42 Posts: 27
    edited 2008-02-11 11:50
    The algorithm has nothing to do with me, I just use it.
    The factors are in the universal version already written by Parallax in 2005.
    Ping_Demo.BS2
    in the folder
    28015-BScode-v1.4
    in the zip
    28015-BScode-v1.4.zip
    which can be downloaded from
    http://www.parallax.com/Store/Sensors/ObjectDetection/tabid/176/CategoryID/51/List/0/Level/a/ProductID/92/Default.aspx?SortField=ProductName,ProductName
    which is the Ping page in the Store.

    This has conditional compilation for various Stamps including the BS2px

    <snip>
    #SELECT $STAMP
    #CASE BS2, BS2E
    Trigger CON 5 ' trigger pulse = 10 uS
    Scale CON $200 ' raw x 2.00 = uS
    #CASE BS2SX, BS2P, BS2PX
    Trigger CON 13
    Scale CON $0CD ' raw x 0.80 = uS
    <snip>
    RawToIn CON 889 ' 1 / 73.746 (with **)
    RawToCm CON 2257 ' 1 / 29.034 (with **)
    <snip>

    David
Sign In or Register to comment.