Shop OBEX P1 Docs P2 Docs Learn Events
HELP with BOE BOT (IR's and QTI's) — Parallax Forums

HELP with BOE BOT (IR's and QTI's)

navagos87navagos87 Posts: 8
edited 2012-08-16 01:16 in Robotics
Hello, in my project I want the BOE BOT make two processes. The first one is with two IR pairs avoid objects and the other is with QTI's sensors follow a black line. I'm stuck in making the robot come back to the black line after it avoids an object. In my programm the robot perfoms the second process successfully and I am trying to resolve my problem with different routines for avoiding objects.
00000_sto_L-R.bs2 Can anyone help me?? (Comments at the side are in Greek).
Thanks a lot.

Comments

  • Martin_HMartin_H Posts: 4,051
    edited 2012-08-14 17:05
    When you avoid the object I would keep reading the QTI sensors. You'll leave the line and it will be on the side of the robot which registered the line last. After you are past the obstacle make a sharp turn in that direction and move forward until the QTIs register the line.
  • navagos87navagos87 Posts: 8
    edited 2012-08-15 05:44
    I have done this ok, I had problem recognizing the line. I want to find a way to avoid every object ,of any shape, that may be on the line, if I do a standar move after I found the object is a correct way but not the best. Somehow the IRs must keep the robot perimetrically around the object avoiding it and then go back to line.
  • Martin_HMartin_H Posts: 4,051
    edited 2012-08-15 06:51
    With the comments in Greek it's hard to tell what you're up to. What I would do is treat the object avoidance like a wall following problem. The robot's primary objective is to follow the line, but if it detects an object it turns away and arcs back to where it came from. When the QTI's pick up the line again it resumes line following behavior. Here's a video of a wall following program I wrote to give you an idea:

    [video=youtube_share;xkYpWYhpIis]

    Like most of my good ideas it came from Robot Builders Bonanza Here's the code:
    ' ==================================================  ============================
    '
    '   File...... SimpleWallFollowing.BSE
    '   Purpose... The robot follows a wall using a single ultrasonic sensor
    '   Author.... Martin Heermance
    '   E-mail.... mheermance@gmail.com
    '   Started... 2012 March 31st
    '   Updated... 2012 April st
    '
    '   {$STAMP BS2e}
    '   {$PBASIC 2.5}
    ' ==================================================  ============================
    
    ' ------------------------------------------------------------------------------
    ' Program Description
    ' ------------------------------------------------------------------------------
    ' This program can be used with a CBA or Boe-bot to follow a wall using only a
    ' single ultrasonic sensor.  The basic concept used is from page 609 of "Robot
    ' Builder's Bonanza" by Gordon McComb
    
    ' ------------------------------------------------------------------------------
    ' Revision History
    ' ------------------------------------------------------------------------------
    
    ' Pin allocations.  You might need to tweak the Ping))) pin.
    Ping           PIN  10  ' Pin for PING))) Sensor
    RMotor         PIN  12  ' Pin for right servo
    LMotor         PIN  13  ' Pin for left servo
    
    ' These values need tweaking for each robot's servos.
    Speed075L      CON 831  ' Fast left
    Speed075R      CON 658  ' Fast right
    Speed050R      CON 685  ' Slow right (to arc)
    
    ' These values control distance from the wall and sharpness of left turn
    WallDistance   CON   5
    TurnCount      CON   40
    
    ' Standard values from Ping))) example
    Trigger        CON    5 ' trigger pulse = 10 uS
    Scale          CON $200 ' raw x 2.00 = uS
    RawToIn        CON  889 ' 1 / 73.746 (with **)
    RawToCm        CON 2257 ' 1 / 29.034 (with **)
    
    ' Trigger Ping)))
    IsHigh         CON   1
    IsLow          CON   0
    
    ' This program is so simple it only needs a single variable to
    ' compute and test the distance to the wall.
    X              VAR Word
    
    ' Execution starts here
    Main:
      ' Pause at start of program to let user set down robot.
      PAUSE 1000
    
      DO
        GOSUB PingDistance
    
        ' If we're far enough from the wall the continue the arc.
        IF (X > WallDistance) THEN
          ' Pulse once
          PULSOUT RMotor, Speed050R
          PULSOUT LMotor, Speed075L
          PAUSE 15
        ELSE
          ' Pulse turn count times to strongly turn away from the wall.
          FOR X = 1 TO TurnCount
            PULSOUT RMotor, Speed050R
            PULSOUT LMotor, Speed050R
            PAUSE 15
          NEXT
        ENDIF
      LOOP
      ' We'll never get here, but it's nice coding style.
      END
    
    ' PingDistance - reads the distance at the current head angle.
    ' Inputs:
    ' Outputs:
    '   X - distance in inches.
    PingDistance:
      Ping = IsLow                                ' make trigger 0-1-0
      PULSOUT Ping, Trigger                       ' activate sensor
      PULSIN  Ping, IsHigh, X                     ' measure echo pulse
      X = X */ Scale                              ' convert to uS
      X = X / 2                                   ' remove return trip
      X = X ** RawToIn                            ' convert to inches
      RETURN
    

    Attached for easy downloading:

    Attachment not found.
  • navagos87navagos87 Posts: 8
    edited 2012-08-16 01:16
    well, finally, I managed make a programm that is pretty good for what I want to do. When I finish that I will post it here with a video. Thanks for your posts :)
Sign In or Register to comment.