ActivityBot / Propeller C: Maze Solving Programming Help

Hello everyone! I need some assistance with my robotics code, and would very much appreciate it if anyone could help. I am coding the Activity Bot to solve a wall maze using Propeller C. So far, the robot is equipped with an ultrasound sensor to detect objects in the front and two infrared sensors on the left and right to detect things on either side. So far, the robot can make it all the way through the maze until the very end. As you can see by the code, once the ultrasound sensor detects an object, it stops and checks the infrared sensors on either side to see which way to turn. The problem with the maze, however, is that it does not detect with the infrared sensors while it is still moving, so it cannot turn to the maze exit.

I tried to make the infrared code work while the robot was still moving, but when I did that the robot spun in circles. My idea now is to increase the frequency of the infrared sensors so that it detects things further away and turns if it detects nothing (where the exit is). However, I don't know if this will work. Can anyone please help me go in the right direction?

Thanks!

Code:
Spoiler:

Comments

  • 10 Comments sorted by Date Added Votes
  • Is this a class project/assignment? We won't do your work for you, but hopefully someone will be able to give you a few pointers.

    -Phil
    “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. -Antoine de Saint-Exupery
  • Is this a class project/assignment? We won't do your work for you, but hopefully someone will be able to give you a few pointers.

    -Phil

    It is for a class assignment, but I'm not looking for anyone to do my work for me haha. In fact, I've mostly been pretty self-sufficient but unfortuantely I've been stuck on this problem the past few days. I've tried dozens of things but none of 'em seem to work.

    Thanks!
  • ampersand wrote: »
    .....
    once the ultrasound sensor detects an object, it stops and checks the infrared sensors on either side to see which way to turn.......

    I tried to make the infrared code work while the robot was still moving, but when I did that the robot spun in circles.

    No code posted so I’m guessing that when the robot detects an object and stops there is an opening on one side or the other for it to turn towards. Could it be that when you are checking the sensors while moving that both sensors either sense no opening or both sides open and cause the spinning? Try a dead end corridor and then an object with both sides open to see what happens.
    In science there is no authority. There is only experiment.
    Life is unpredictable. Eat dessert first.
  • kwinn wrote: »
    No code posted

    You have to click on the "Spoilers" button to see it.

    I haven't seen this feature used to hide code before. I think there could be times when this feature would come in handy.

    Good luck with the project ampersand.

  • Duane Degn wrote: »
    kwinn wrote: »
    No code posted

    You have to click on the "Spoilers" button to see it.

    I haven't seen this feature used to hide code before. I think there could be times when this feature would come in handy.

    Good luck with the project ampersand.

    Thanks Duane. Saw "Spoiler" but had no idea that it was for code. Is that the new normal for posting code?
    In science there is no authority. There is only experiment.
    Life is unpredictable. Eat dessert first.
  • PublisonPublison Posts: 9,505
    edited March 22 Vote Up-1Vote Down
    kwinn wrote: »
    Duane Degn wrote: »
    kwinn wrote: »
    No code posted

    You have to click on the "Spoilers" button to see it.

    I haven't seen this feature used to hide code before. I think there could be times when this feature would come in handy.

    Good luck with the project ampersand.

    Thanks Duane. Saw "Spoiler" but had no idea that it was for code. Is that the new normal for posting code?

    Not sure what the "Spoiler" tag is supposed to do:
    Users may prevent accidental spoiler by wrapping text in spoiler tags. This requires the text to be clicked in order to read it.

    This plugin allows users to hide sensitive or revealing information behind clickable barriers to prevent accidental spoilers.

    And, no, it's not normally used for code. I've only seen it used twice.


    Infernal Machine
  • Perhaps putting the IR system into a separate cog and have that cog update a global variable to indicate an opening in a side wall. This way you or your program can "decide" whether or not to "explore" the opening as a possible exit.
    Florida, between St. Petersburg and the Gulf of Mexico

    Do not look directly into laser with remaining good eye...
  • Hal Albach wrote: »
    Perhaps putting the IR system into a separate cog and have that cog update a global variable to indicate an opening in a side wall. This way you or your program can "decide" whether or not to "explore" the opening as a possible exit.

    Thanks for the help, I'll try this!
  • Have you tried turning it off and back on?
  • Hey. Did you ever get it to work. If so could i see the updated code possibly. Just wanted to see how you did it because im confused on how to do the cogs
Sign In or Register to comment.