Shop OBEX P1 Docs P2 Docs Learn Events
Turret RADAR using ))Ping — Parallax Forums

Turret RADAR using ))Ping

noobmunchernoobmuncher Posts: 124
edited 2008-11-24 06:18 in Robotics
I am trying to modify the Ping Dar progam, the one that just acts as a sort of radar.· Ultimatley what i am trying to do is make it so that the second scan is compared to·the the first scan to detect large amounts of motion.· I need to tie this in so i can point an array of sensors in the direction of the motion.· I had thought about having it detect it in sort of quadrants, but i am open to ideas, because I am really stuck.· Any suggestions are great!· Code is even better : )·

Link to original page and code
http://forums.parallax.com/showthread.php?p=590115

Comments

  • SRLMSRLM Posts: 5,045
    edited 2008-11-15 04:56
    The basic principles of making large programs is to break it down into chunks of managable size. Do this on paper, not in your mind or on the computer. Sit down where you'll be forced to think about this, then think through logically. Ask yourself the hard questions: "What is motion from the perspective of the BOE-BOT?", "How do I determine what motion is equated to what sensors?", "What are the realistic capabilities of my project?".
  • RoboticsProfessorRoboticsProfessor Posts: 54
    edited 2008-11-15 15:43
    One possibility...

    Suppose you divide the servo search area of 180 degrees into 10 degree segments. Search each area, storing the results in an array, like...

    array1 var byte(18)

    array2 var byte(18)

    for degrees = 0 to 180 step 18 ' First set of readings

    ...move servo to degrees

    ...store reading in array1(degrees / 18) ' degrees divided by 18 will give you the array elements 0 to 17

    next

    for degrees = 0 to 180 step 18 ' Second set of readings

    ...move servo to degrees

    ...store reading in array2(degrees / 18) ' degrees divided by 18 will give you the array elements 0 to 17

    next

    'Now subtract array1 from array2

    ·for i = 0 to 17

    ...array1(i) = array1(i) - array2(i)

    next

    If there was no movement, all the array1 elements should read close to zero. The highest (and lowest) numbers will tell you where there was the most change or possible movement.

    If you want to do this with just one array instead of two, have the second scan pass just subtract its reading from what is already in the corresponding array1 element. Then you could have another array with the previous set of readings if you want to know which way the target is moving.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Richard Vannoy

    Programming and Electronics Instructor
    www.PICRobots.com
    www.SailingStrategy.info
    www.TeachingTechnicalTraders.com
    ·
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2008-11-15 17:01
    Richard -

    I realize what you posted is just an example, but the PBASIC Stamps only have 26 bytes for variables in RAM. RAM is where you would be declaring those two arrays. Thus 18 X 2 = 36 bytes would be required, and that exceeds the size limit. If you can do with a NIB (4 bits), you've got it made!

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When all else fails, try inserting a new battery.
  • noobmunchernoobmuncher Posts: 124
    edited 2008-11-24 06:18
    Thanks everyone i will let you know when i have a dart gun mounted and firing at intruders lol
Sign In or Register to comment.