Shop OBEX P1 Docs P2 Docs Learn Events
Beginner PING))) lowing sensitivity — Parallax Forums

Beginner PING))) lowing sensitivity

VillaroseVillarose Posts: 5
edited 2009-10-08 15:42 in Accessories
I'm new to using the PING))) ultrasonic sensor for the boe-bot, and I'm confused about how to do some things. I found a basic code on Parallax about how to sense and turn away from objects, but how can I lower the sensitivity, so it'll get closer to the object before backing up and turning? Thanks.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-07 16:25
    You need to post the code (or at least a link to the code) that you want to use. How can we tell you what to change unless we can tell what you're using?
  • VillaroseVillarose Posts: 5
    edited 2009-10-07 19:36
    Oh, I admit that was kind of stupid of me. The basic file I'm using can be downloaded here:

    http://www.parallax.com/Portals/0/Downloads/src/prod/RoamingWithPING-V1.0.zip

    I've made quite a few small changes in mine, but none of them seemed to work for what I wanted to do, most likely because I was changing the wrong thing.
  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-07 21:37
    There's a comment "Is Object Farther Than 30 cm?" where the code checks for at least 30cm of space in front of the BoeBot before moving forward. If there's not at least 30cm clear space in front of the BoeBot, the program scans across the front of the BoeBot using the PING servo and the PING looking for a direction with at least 30cm of clear space in front (see just after the label "Ping_Around:" and choosing the direction with the furthest clear distance.

    Since the BoeBot first checked forward for at least 30cm of clear space, then checked again on the scan (Ping_Around), if the scan indicates that the forward direction is best, there must be a problem there (because the first check was ok) and the BoeBot turns around.

    Post Edited (Mike Green) : 10/7/2009 9:42:42 PM GMT
  • VillaroseVillarose Posts: 5
    edited 2009-10-07 21:55
    Do you know if there is any way to lower below 30 cm? I want to get it to navigate a somewhat tight course, so can I have it only scan if there is an object, say, within 15-20 cm?

    ____________
    |................. .^
    |.................20cm
    |.............___ ^
    |......_....||
    |.....[noparse][[/noparse]_]...||
    |............||


    That's an odd picture, but imagine the lines are walls and the box-like shape is the bot. Right now, it's scanning before it reaches the turn, and either turns into the right wall, or attempts to do a 180. I want it to get into the open space between the two routes before scanning, and then turn right.
  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-07 22:10
    Look at the code in the two places I mentioned.

    You really want to make significant changes in the way the program behaves. You're going to have to study the program (and the comments) and understand how it works, then modify it.

    You will probably have to change the algorithm because of the close walls. It's easy to change the two places where there's a 30 to something like 20 or 15, but I don't think that will really do what you want.

    If the BoeBot is not precisely aligned with the walls, it will gradually drift into a wall as it moves along and you want to catch and correct that. You also want to detect when the BoeBot has emerged into the open space and perhaps change its behavior completely.
  • VillaroseVillarose Posts: 5
    edited 2009-10-08 15:08
    Oh, I made a mistake again. I posted the wrong link.

    http://www.parallax.com/Portals/0/Downloads/src/prod/RoamingWithPING-Simple-V1.0.zip

    My mistake. Maybe this will clear up some of my confusion. Would the same type of thing apply to this?
  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-08 15:42
    Yes

    This is not a terribly complicated program. The main portion simply positions the PING servo to several positions in a sweep from one side to the other, then reverses the sweep. At each position, it PINGs and looks at the returned value. If it's less than 600, the BoeBot "takes evasive action" depending on the position of the PING servo, either turning right or left or backing up.

    You really need to take the time to understand how the program works. You could just change the 600 to something else and see if that works for you, but the logic of the program really needs to be changed for your circumstances. What rules could you come up with for how the BoeBot should behave? I'm not talking yet about the programming ... Lay out a list of rules for the BoeBot's behavior under different circumstances.
Sign In or Register to comment.