Welcome, Guest. Please login or register.
Did you miss your activation email?

Username: Password:


Pages: [1]   Go Down

Author Topic: Coding PLEO AI to walk around maze  (Read 9537 times)

GradSchool

  • Hatchling
  • Posts: 4
  • Male
Coding PLEO AI to walk around maze
« on: February 27, 2010, 06:55:32 PM »

I have a semester long project due in April.  We wanted PLEO to maneuver through a maze searching for an EGG.  And eat people along the way.  Basically a REAL godzilla version of pleo, not just a little skit.  does anyone have any coding ideas for getting pleo to maneuver through a little maze with walls?  We are trying to figure out how to use any blob or color detection in pleo through the pawn scripting.  Any ideas would be GREAT.  Any ideas..at all.  Thanks!  Aloha.
Logged


InmemoryofRomeo

  • Global Moderator
  • Pleo Grand Master RB
  • * Posts: 6903
  • au Female
  • Pleo(s): Lilo, Stitch, Pleakley, Jumba, Nani, Yuki, Angus, Pluto
  • : 2011 winner2009 winnerTomato Harvest Festivals
  • SAVE THE EARTH It's the only planet with chocolate
    • Professor
    • Wile_E_Coyote
    • Marcie
Re: Coding PLEO AI to walk around maze
« Reply #1 on: February 27, 2010, 11:17:46 PM »

I'm not sure Pleo's camera/hardware is good enough to do that by himself...

I did this via remote control... (see the remote control guide under the programmers thread.) You can also add skits to it for attacking and finding the egg all triggered by remote. I know its not quite what you are after but I'm really not sure that Pleo in his current state could manage that autonomously.

<a href="http://www.youtube.com/watch?v=6YEA5ICbTVM" target="_blank">http://www.youtube.com/watch?v=6YEA5ICbTVM</a>
Logged
Eagerly awaiting Vector and Blue!

justbede

  • Pleo visionary
  • * Posts: 260
  • Male
Re: Coding PLEO AI to walk around maze
« Reply #2 on: February 28, 2010, 10:40:46 AM »

I'd imagine it can be done if you know the language and the limitations of the PDK well enough, if not like IMR says there are other ways to do it.

I'm not sure if they're still around the forum but i'd say "pleopet" of aibohack.com would be someone to get in touch with as they helped develop some of the third party tools for Pleo and surely know more than most about programming for Pleo.
Good luck with the project!
Logged
Innvo Labs, creating life since 2009

Bumblebee

  • Store Owners
  • Pleo adept
  • * Posts: 692
  • Female
  • : Tomato Harvest Festivals
  • The manatee shall bump forever!
Re: Coding PLEO AI to walk around maze
« Reply #3 on: February 28, 2010, 02:38:08 PM »

That's an Intersting video, IMR. :)

Sorry, I'm a programming dunce. I'm of no help!  %)
Logged
Please note: It takes 36 muscles to frown, but it only takes 4 muscles to slap El Stupido upside the head.

mweed

  • Grand Poobah
  • Triassic pleo master
  • ***** Posts: 1758
  • us Male
  • Pleo(s): Bob, Mopey
  • : Tomat Harvest Festivals
    • Professor
    • Wile_E_Coyote
    • Dr_Bunsen_Honeydew
    • Snoopy
    • Bob the Pleo
Re: Coding PLEO AI to walk around maze
« Reply #4 on: March 01, 2010, 02:58:10 PM »

Pleo's camera and hardware have all the capability to do what you want . . .  But not running the LifeOS.   What you most likely need to do is create a new OS (possibly using pieces from the old OS).  With a new OS, you can drop all of the "emotional" baggage, ignore all the sensor input, and just concentrate on processing visual input and IR sensor, and then use the pre-programmed movements.

You will need a very well lit maze with lots of room for pleo to maneuver.  Use high contrast between wall, floor, and egg (i.e., white floor, black walls, bright green egg).  

Then just move the head to pan the camera left . . .  Egg detected?  
     Yes -  Attack egg.  Finished.
     No - Is wall detected?
          No - walk to the left one space.  Start sequence over again.
          Yes - Move head to pan camera straight ahead . . .  Egg detected?
               Yes - Attack egg.  Finished.
               No - Is wall detected?
                    No - walk ahead one space.  Start sequence over agian
                    Yes - Move head to pan camera to the right . . .  Egg detected?
                         Yes - Attack egg.  Finished.
                         No -  Is wall detected?
                              No -- Walk right one space.  Start sequence over again.
                              Yes - dead end.  Rotate body 180 degrees.  Start sequence over again.

This is basic logic for what I assume you are trying to do (brute force to find way through maze, not "solve" or "learn" the maze).   You could instead do a full visual sweep left to right to see if the egg is in sight and where the walls are first, process the logic to make the decision, then walk as determined by the logic.

The head movement and walking left/straight/right, and turning around can all be done using pre-developed movements from the PDK.  The logic is pretty simple to program.  So all you really need to work on is processing the visual and IR signals to detect the walls/egg.
« Last Edit: March 01, 2010, 03:03:09 PM by mweed »
Logged

PleoPet

  • Pleontologist
  • * Posts: 162
  • Female
Re: Coding PLEO AI to walk around maze
« Reply #5 on: March 02, 2010, 09:14:25 AM »

There are several ways to approach it. Here are some ideas:

You can do the visual approach, where Pleo looks at the maze (from a distance), and figures out where to walk. You will need to color code the entire maze (eg: one color for floor, another color for walls, a different color for the target/egg. Pick Red or Blue or Green). Then Pleo walks the maze intelligently, perhaps using the IR obstacle detection or re-evaluating the camera data to align the walking with the walls.
The camera data is hard to process yourself using Pawn. You will want to turn off the automatic tracking, and do your own processing using the camera_request_average/camera_get_average() functions to do rough . It may be a little slow, but for a full field of view, you'll have to move the neck, and poll the data in several directions/angles. Lighting is important.

A more direct/organic way is like mweed suggests. You can use the built in color tracking for the egg when it gets close. The rest of the random walking can use the IR obstacle sensor (in the nose).
Try the higher level IR obstacle sensor notifications first. They may be too coarse.

The first two approaches require programming everything in Pawn running on the Pleo itself. A variant on the first approach is to put a web-cam on your ceiling and aim down at the robot maze. That way you can track the maze and precise movement of the Pleo in a 2D world. You will need a radio link from a PC (with the webcam) to the Pleo. See the XBee modification for a low cost alternative. The PC commands the Pleo to walk forward, and it uses the webcam to verify it is walking in a straight line.
NOTE: this is how many of the RoboCup robot competitions are done with logic running on a PC and robots taking orders. Program in any programming language you like. The Pawn programming is very simple. Can be simulated much more easily than the other approaches.

-----
Other notes:
In most of these approaches there are two prevailing problems
#1) Walking is only an approximation. Any walking will naturally have some drift so you need to correct it.
#2) Aim the head first. The camera and IR obstacle detection are in the head/nose. So much of the logic will be in aiming the head, waiting for the new data (the camera can be slow) and then evaluating the current view.

Any program built with the PDK will automatically replace the built-in program (PLEO_PM). That way you can make a dedicated Pawn program that will only do the maze walking.

----
IMHO: I'd recommend starting with something much simpler. If going for the obstacle avoidance approach, make Pleo walk forward continuously with slight course corrections if it sees a wall on either side. Test it by making it walk straight, then put a few obstacles on either side. Then make a more complicated maze.
Logged

justbede

  • Pleo visionary
  • * Posts: 260
  • Male
Re: Coding PLEO AI to walk around maze
« Reply #6 on: March 02, 2010, 10:22:55 AM »

Go Mweed + Pleopet!!! ;D
Logged
Innvo Labs, creating life since 2009

InmemoryofRomeo

  • Global Moderator
  • Pleo Grand Master RB
  • * Posts: 6903
  • au Female
  • Pleo(s): Lilo, Stitch, Pleakley, Jumba, Nani, Yuki, Angus, Pluto
  • : 2011 winner2009 winnerTomato Harvest Festivals
  • SAVE THE EARTH It's the only planet with chocolate
    • Professor
    • Wile_E_Coyote
    • Marcie
Re: Coding PLEO AI to walk around maze
« Reply #7 on: March 02, 2010, 03:47:02 PM »

I'm still not convinced the camera will be good enough for the color matching in 'real world' conditions. You are going to have to run some tests to experiment with colors and lighting, you need very easily discernible colors and your lighting is going to have to be set up to avoid too many dark shadows (a dark shadow can trigger Pleo to act like there is a edge detected or an obstacle detected). I think the best approach may be trying out a simple color recognition program (there is an example in the PDK) and just seeing how to get the best out of the camera (or finding out if the camera is even suitable) before going ahead with anything complex. If you search you tube someone did install a better camera in Pleo once with good results.
Logged
Eagerly awaiting Vector and Blue!

GradSchool

  • Hatchling
  • Posts: 4
  • Male
Re: Coding PLEO AI to walk around maze
« Reply #8 on: March 03, 2010, 02:05:41 PM »

WOW.  Great advice, all of your replies have sparked the creative juices to engineer this project efficiently.  I read the replies this morning, and have been coming up with ways to make this work.  Another approach might be an umbilical PLEO, hooked up to MATLAB to do outside processing.  Thank you all.  I will keep everyone update, but I have a quick question:

For those that build in Quincy, can you tell me the build options to set so that I can compile my scripts all in Quincy?  I know to point quincy at the include folder for all include directives, but what about the other options?  Target Path, Runtime working path, Defines....because it seems like Quincy knows to build the include path, but maybe i'm confusing myself with motions.inc and sounds.inc, being different from Sound.inc and Motion.inc
Logged

GradSchool

  • Hatchling
  • Posts: 4
  • Male
Re: Coding PLEO AI to walk around maze
« Reply #9 on: April 26, 2010, 08:51:35 PM »

Well our project is basically done!  We'll post up videos and our project report by the end of the week.  Thanks to all your help!
Logged

InmemoryofRomeo

  • Global Moderator
  • Pleo Grand Master RB
  • * Posts: 6903
  • au Female
  • Pleo(s): Lilo, Stitch, Pleakley, Jumba, Nani, Yuki, Angus, Pluto
  • : 2011 winner2009 winnerTomato Harvest Festivals
  • SAVE THE EARTH It's the only planet with chocolate
    • Professor
    • Wile_E_Coyote
    • Marcie
Re: Coding PLEO AI to walk around maze
« Reply #10 on: April 27, 2010, 03:28:25 AM »

Can't wait to see :) Did you solve the quincy problem? (I assume you did or found a way around it.)
Logged
Eagerly awaiting Vector and Blue!

GradSchool

  • Hatchling
  • Posts: 4
  • Male
PLEO Navigates Maze Autonomously and Localizes Egg Location
« Reply #11 on: April 28, 2010, 09:23:53 AM »

PLEO Finds Egg hidden behind wall.  PLEO uses sound (Baby Cry) to determine egg location, then navigates around city maze till it finds Egg.
<a href="http://www.youtube.com/watch?v=uvKN4fWseAs" target="_blank">http://www.youtube.com/watch?v=uvKN4fWseAs</a>

PLEO Finds Egg hidden in MAP by sound (Music Playing).  At first it makes a wrong decision and then reverts back and decides a better route.
<a href="http://www.youtube.com/watch?v=ck4o-bpyRVo" target="_blank">http://www.youtube.com/watch?v=ck4o-bpyRVo</a>
Logged

Crewella

  • Moderator
  • Pleo Grand Master RB
  • **** Posts: 5671
  • gb Female
  • Pleo(s): Iggy, Budge, Moschops, Monty, Emmy. Belle, Zillah, Tribble
  • : 2010 winnerTomat Harvest Festivals
    • Ginger
    • Pepe_Le_Pew
    • Animal
    • Flying_Ace
Re: Coding PLEO AI to walk around maze
« Reply #12 on: April 28, 2010, 10:08:18 AM »

Well done, that looks great.  And I love the fact that he looks so pleased with himself when he finds the egg! :)
Logged

InmemoryofRomeo

  • Global Moderator
  • Pleo Grand Master RB
  • * Posts: 6903
  • au Female
  • Pleo(s): Lilo, Stitch, Pleakley, Jumba, Nani, Yuki, Angus, Pluto
  • : 2011 winner2009 winnerTomato Harvest Festivals
  • SAVE THE EARTH It's the only planet with chocolate
    • Professor
    • Wile_E_Coyote
    • Marcie
Re: Coding PLEO AI to walk around maze
« Reply #13 on: April 28, 2010, 05:39:29 PM »

Great videos :) It is interesting that on the second Pleo went in the opposite direction at first. But the correction is good :)
Logged
Eagerly awaiting Vector and Blue!
Pages: [1]   Go Up
 

SimplePortal 2.3.5 © 2008-2012, SimplePortal