Shop OBEX P1 Docs P2 Docs Learn Events
HELP WITH QTIs AND IRs ON BOE_BOT — Parallax Forums

HELP WITH QTIs AND IRs ON BOE_BOT

navagos87navagos87 Posts: 8
edited 2011-09-22 00:40 in Robotics
Hello eveyryone,

I have programmed my boe-bot to follow a black tape and everything is fine with that!
I also want to avoid any object on the line of sight on the tape-path but, I am stuck on that..
I 've tried different ways to solve this problem but I can't put the code in the right order to work properly, or I just don't use the right commands...
Can anyone help me please?? Is there already a post for that??

Thanks in advance!

Comments

  • PublisonPublison Posts: 12,366
    edited 2011-09-11 10:11
    What kind of sensor are you using for Line of Sight? The code may be a little tight trying to run the QTI routine And the Forward Sensor AND the servo routines.

    Could you post the code you are trying to use as an attachment? Info on the sensor would be great.
  • SRLMSRLM Posts: 5,045
    edited 2011-09-11 10:13
    Traditionally, you're more likely to get a helpful response from the forums if you post your attempts at solving a problem, and asking a specific question rather than "is the answer available". What have you tried already?
  • navagos87navagos87 Posts: 8
    edited 2011-09-11 10:26
    I' m using the IRs LEDs and receivers so to avoid objects.
    Here is the code so far , on the right there are notes at Greek so don't mention them :D
    For using the IR pairs I have tried in different ways the other code and the "Adapt RoamingWithWiskers.bs2 for use with IR pairs" (Robotics with the boe-bot page 250).31_FastIR.bs2
  • PublisonPublison Posts: 12,366
    edited 2011-09-11 10:32
    Question. You never described what is not working. What are your symptoms?
  • navagos87navagos87 Posts: 8
    edited 2011-09-11 10:42
    Sorry for that, new to forum..
    Well, for example, in the following case the left IR pair detects an object and it stops eveything.
    I've put two blue leds at every side so to know exactly when one IR pair detects an object. When there is an object ,passes one sec and it stops moving.

    Thanks for your time guys..
  • SRLMSRLM Posts: 5,045
    edited 2011-09-13 00:36
    A couple of thoughts on your code:

    1) you have four bits of QTI sensor data, so that is 16 possible combinations (2^4). In your code, I count 10 cases and one else. You should probably have 16 cases, and no else so that your robot will always do something. As it is, your robot will stop (until you move it...) when it gets to one of those 6 cases.
    2) In the case statement, you should move the common elements (GOSUB, PULSOUT) out of the case statements and inline with the case statements. It's better coding practice.
    3) You have a DO-LOOP nested in a DO-LOOP, yet the inner loop is never exited making the outer loop a once only event.
    4) In your Turn_R and Turn_L routines you need to add a pause statement for the servos, and you'll need some sort of pause for the main loop area where you have the CASE statement

    Try these, and if you are still having issues be sure to post updated code and a detailed description of what is happening and what you expect (want) to happen.
  • navagos87navagos87 Posts: 8
    edited 2011-09-13 09:21
    ok thanks for your help , I 'll try to correct the code ..
    :D
  • navagos87navagos87 Posts: 8
    edited 2011-09-22 00:40
    Well, I tried to take the results of all the sensors in the same routine and not to have 2 subroutines, so the servos have a clear command wha to do.
    So, I have placed the QTI code in a "If..then..elseif" routine (which can have exactly 16 "If-elseif" statements and another "If..then..elseif" for the IRs.
    For better robot response I placed a third IR in the middle. Now, I have to solve what to do in the case that the robot finds an object ,turn accordingly the IR, but because it is ordered to do nothing in the case of QTIs = 0000 ,when it comes of the black tape it does nothing to go back the line after the object (but in a few attempts the solution will come I hope :D )
    Additional, I put the 6 missing cases ,although some of them hypothetical will never appear in my task, like 0101.
Sign In or Register to comment.