Shop OBEX P1 Docs P2 Docs Learn Events
Ping Ultrasonic Sensor — Parallax Forums

Ping Ultrasonic Sensor

sCRYedsCRYed Posts: 2
edited 2010-04-21 18:59 in Accessories
I am kind of new to this but i need help programming my sensor. I have been been working with the Ping Ultrasonic Sensor for about a month now, and all that i have done is get it to measure distance and move. Unfortunately i can't get it to solve any mazes. I am looking for any help i could get.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-04-14 17:39
    This really is only incidentally related to the PING. It sounds like you've gotten the PING to do what it's designed for, namely measuring distances and detecting obstacles. Maze solving is a completely different problem and doesn't even need the PING since you could use whiskers to detect the walls of the maze. The Wikipedia has some information on maze solving. Follow the links in the article below and you'll find more than enough information to get you started.

    en.wikipedia.org/wiki/Maze_solving_algorithm
  • sCRYedsCRYed Posts: 2
    edited 2010-04-15 15:51
    The information was helpful. and i know what i need to do the only question is how? i have gotten it look for the closest object and move towards it after storing the distance of left, right, and forward. but I need help trying to reverse that affect. And doing that will solve any maze it is put through. Unfortunately i am not the best programmer. You are right though, the Whiskers would make the job a lot easier, but i am doing this in a class and the whiskers a already being used by most of the people. I want to prove that it can be done and never have to re-write the program to solve a different maze.
  • Mike GreenMike Green Posts: 23,101
    edited 2010-04-15 16:13
    What do you mean by "reverse that affect"?

    Basically, you have to implement one of the maze solving algorithms described in the Wikipedia article and its links. All of these use trial and error, essentially recording where they've been and what they've tried so they don't repeat the same mistakes.

    One of the problems using a Stamp is that it has limited storage (less than 26 bytes) for its map (of what it's tried). You may want to add some external EEPROM or SRAM or you may want to replace your BS2 with one of the other Stamp models with more storage (like the BS2p or BS2pe).

    Another issue that's hard to solve is "How does the BoeBot know where it is in the maze?". There will always be some slippage as the BoeBot moves around. Eventually it may think it's in one location, but really be in the next maze position over. That causes all sorts of problems in backtracking when it reaches a dead end. Sometimes you can use existing "doors", corners, and corridors in the maze to help in backtracking through the maze.
  • RoboticsProfessorRoboticsProfessor Posts: 54
    edited 2010-04-21 17:39
    Since you use the Ping))), I presume you are solving a maze with walls instead of a maze made by lines on the floor.

    I have created a slide show that explains line maze solving in detail. It is at:

    www.richardvannoy.info/line-maze-algorithm.php

    Although it talks about following a line maze drawn on the floor, the solution of a walled maze can use the same algorithm, so maybe my slide show will help.

    (I just noticed I can attach it, so see attachment.)

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

    Programming and Electronics Instructor
    www.RichardVannoy.info
  • FranklinFranklin Posts: 4,747
    edited 2010-04-21 18:59
    Nice work Richard.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
Sign In or Register to comment.