Shop OBEX P1 Docs P2 Docs Learn Events
Problem with Boe-Bot code — Parallax Forums

Problem with Boe-Bot code

LawrenceLawrence Posts: 4
edited 2005-06-18 21:57 in Robotics
Hello all of you that are interested in robotics.

My objective is to
create a program for the boe bot to be able to go all around a space (house in this case), avoiding
obstacles and all that sort of things using 2 IR. The programation is pretty much like the one in the book of Andy Lindsay that came with the kit.
The avoidance of objects is well done, the only problem is the way·the robot·goes forward:
it goes forward·for a certain time, than stops, than
goes, than stops and so on. I don't see· a solution but my knowledges
about
robotics are·still relatively·limited.

I think the robot does that because it cannot go forward and scan for
objects at the same time, what I mean is that it can't do 2 things at
the same time. I have changed my code lots of time and I realy can't see the solution to this problem.

The latest experimentation code I has made is atached so if the interested people could just take a look and maybe try it. I will then put it on the Project section of the forum.

Thanks,
····· Lawrence sad.gif

Post Edited By Moderator (Dave Andreae (Parallax)) : 6/13/2005 11:15:57 PM GMT

Comments

  • Tom WalkerTom Walker Posts: 509
    edited 2005-06-14 15:22
    This sounds like aproblem best served by Jon's task-switching framework. A search of these fora should point you in the right direction.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Truly Understand the Fundamentals and the Path will be so much easier...
  • edited 2005-06-14 18:25
    Where is that task-switchng framework? My forum searches didn't seem to turn up any posts with code.
  • edited 2005-06-14 18:42
    Maybe your IF...THEN statement isn't covering all conditions. Try adding an ELSE with a brief 4 kHz FREQOUT to the piezospeaker right before the ENDIF.· If you get high pitched chirps when the Boe-Bot stalls, it might indicate a missing condition.·

    Here's an interesting trick - combine your two nibbles into a byte and evaluate it with a SELECT...CASE statement. With two nibbles, you can evaluate them as individual digits if you use the $ hexadecimal operator. It's very convenient.

    irBoth······· VAR· Byte
    irDetectLeft· VAR· irBoth.HIGHNIB
    irDetectRight VAR· irBoth.LOWNIB

    '
    ' Etc...
    '

    SELECT irBoth
    · CASE $55, $45, $54 ',...Etc
    ··· GOSUB Forward
    · CASE $33
    ··· GOSUB Forward_1
    ··'...Etc.
    · CASE ELSE
    ··· FREQOUT 4, 50, 4000
    · ENDSELECT

    Post Edited (Andy Lindsay (Parallax)) : 6/14/2005 6:55:28 PM GMT
  • PARPAR Posts: 285
    edited 2005-06-15 03:42
    Andy Lindsay (Parallax) said...
    Where is that task-switchng framework? My forum searches didn't seem to turn up any posts with code.

    Andy, See:

    http://forums.parallax.com/showthread.php?p=537942

    PAR
  • LawrenceLawrence Posts: 4
    edited 2005-06-17 18:51
    Hum... so what you are saing is that my robot is having that strange behavior because in my IF-THEN-ELSE statement there are some conditions missing? confused.gif
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-06-17 19:23
    What they are saying Lawrence is that you have 20 mSec pauses all over the place, then a 100 mSec pause before you go around again.

    The task code tries to put the 20 mSec 'refresh' delay in the main routine -- because your robot can be doing something besides 'pausing' for 20 mSec -- like deciding what to do next.

    It's completely possible for your robot to 'decide' to turn left, then leave the left turn action for another 'task'. With Servo's, your robot CAN do two things at once -- Send the PULSOUT to both servo's, then go do something else for a while before you send the PULSOUT again.
  • Tricky NekroTricky Nekro Posts: 218
    edited 2005-06-17 20:37
    And something more:
    Debug commands are not so memory effective...
    You will surely find it difficult if you want to expand your code and also having debug messages.
    They may also slow down your robot's overall speed.
    Your overall code is quite impressive and nicely done containing details that for most of us may seem useless but are the one who makes the difference and give the robot a very good precission...
    Keep trying...wink.gif


    P.S.
    I think that if you activate the Hide_Shadow mode you will have problem with you bot...
    It may stuck...
    But this may not be true because you have the other two SubRoutines...
    then...my bad...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Rule your Destiny-
    --Be Good. Be Bad. Be Provas--
  • LawrenceLawrence Posts: 4
    edited 2005-06-17 23:12
    It seems like the value after the PAUSE statement, when changed, changes all the movement of the robot. That seems a litle weird to me, because, even knowing few about PBASIC, I understand that in that FOR comand should define the time the robot makes a movement. The hiding subroutine is still experimental, although it works, it takes a lot of time to the robot to realize al these things. And it takes too much memory. If someone have a Boe Bot wich I think some might have, could you please try this program if you haven't yet? I had already made this program 3 moth ago, but it worked alright! So please could someone take me out of this mess so I can move on? Not like I want you to make the program for me, but this is beiond my knowledge.
    Regards,

    Lawrence
  • LawrenceLawrence Posts: 4
    edited 2005-06-17 23:13
    PS: I hope you all understod what I ment before tongue.gif
  • Tricky NekroTricky Nekro Posts: 218
    edited 2005-06-18 21:57
    Well I 'd love to but a don't have a mobilable bot.

    I am trying to make my own tank robot and I don't even have a boe-bot!!!

    My story about electronics and robotics is a long one...roll.gif

    I have of course a BS2 but I didn't get it from parallaxcry.gif ...

    I am from Greece, and things here are a little difficult...(about ordering anything from Parallax like servos and whatever...)

    And as I stated before, you have to delete all the debug commands, think of it clearly, even if you have debug command, the robot will be always able to be connected to your computer...



    P.S.

    I need a little help about shift-registers, about how·they are programmed...

    I have a MM74HC164 shift-register and I only know about how to control HIGH-LOW by TOGGLEing DATA_ and I need some further documentation about it in order to·expand my knowledge...

    Thanks, for your time, Provas

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Rule your Destiny-
    --Be Good. Be Bad. Be Provas--
Sign In or Register to comment.