Shop OBEX P1 Docs P2 Docs Learn Events
Orginal robot using 3 pings sensors interfaced with Basic Stamp — Parallax Forums

Orginal robot using 3 pings sensors interfaced with Basic Stamp

AustinBAustinB Posts: 1
edited 2009-04-24 04:09 in BASIC Stamp
Hello everyone I’m constructing my own robot using 3 ping sensors interfaced with the Basic stamp.· To propel my robot I am using the Hb-25 Motor controllers with the Motor mount and wheel kit.· It has been long and tedious but finally I have constructed all mechanical parts of the robot including all circuitry. I am now at the point where I am writing the program for the robot so that it may function as a collision avoidance robot with the aid of the three pings.· While I am very familiar with the basics like defining and creating subroutines and controlled movement, I am have a very difficult time writing the overall program in which I can Rev the motors, regulate the speed, define ping distances, and roam around the room with the three stationary pings.· Any guidance would be greatly appreciated!
·

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-04-24 04:09
    Start with the existing sample programs. Write one subroutine to handle one PING. Each time it's called, it returns the distance detected in a variable. Once you get that routine working, write another subroutine for a 2nd PING that returns the distance in a 2nd variable. It can use the same internal variables as the 1st routine. Once both are working, write a 3rd subroutine for the 3rd PING that returns the distance in a 3rd variable.

    The HB-25 controllers will maintain the last set speed and direction until instructed otherwise, so that's not at all time-sensitive. You'll need some subroutines for reading the wheel encoder information and computing the distance travelled.

    Now you have subroutines for all the basic functions. You need to decide how the overall robot will work. Start with a notebook writing down the rules you want the robot to follow as it moves around. Typically, a robot will move from one spot to another when there's no obstacles in the way. Maybe you want your robot to pick the direction with the longest open path. You might want the robot to slowly circle making successive PING readings looking for this longest path. You might have one subroutine for this. Maybe you want a more general subroutine to have the robot turn in a circle by a specified number of degrees or percent of the circle. Maybe you want a separate subroutine to have the robot move a specified distance in a specified direction. As you make up lists of rules, you'll see what the most common actions might be and you can write subroutines for each that makes sense, then combine them (as calls) in a main routine.
Sign In or Register to comment.