From dblank at brynmawr.edu Wed Nov 1 10:17:11 2006 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Wed Nov 1 10:17:59 2006 Subject: [Pyro-users] Debugging AIBO In-Reply-To: <4547CE93.8030106@rpi.edu> References: <4547CE93.8030106@rpi.edu> Message-ID: <4548BA77.2060507@brynmawr.edu> Daniel T. Casner wrote: [snip] > I'm using the newly released Tekkotsu 3.0 so I wonder if a change in > Tekkotsu may have broken the interface to Pyro. Also is there a way I > can get more debugging information out of Pyro to try to diagnose the > problem? Oh, yes, that will be a problem. Many things have changed in version 3.0. For one, we use the Tekkotsu Monitor server's GUI menus from Python to control the robot (start processing, etc.) You'll want to use an earlier version, and make sure that all of the UDP settings have been changed to TCP. See previous email in this list, and the Pyro Aibo page: http://pyrorobotics.org/?page=Using_20the_20Sony_20AIBO_20Robot at the bottom. I'll add a note to that now to make sure to use a version of Tekkotsu < 3.0, until we update. -Doug > Thanks, > > Daniel C. > _______________________________________________ > Pyro-users mailing list > Pyro-users@pyrorobotics.org > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users > > From khasymskia at wlu.edu Thu Nov 2 13:27:28 2006 From: khasymskia at wlu.edu (Alexander Khasymski) Date: Thu Nov 2 13:27:46 2006 Subject: [Pyro-users] Khepera Simulator Message-ID: <4549F240.81AA.00A9.0@wlu.edu> Hi, This probably has an easy solution, but I can't seem to find the answer anywhere. How do I simulate a KheperaII robot in Pyrobot? I'm working on my senior thesis in robotics, which involves evolving controllers for two KheperaII robots to perform a cooperative foraging task, essentially two Kheperas equipped with grippers and a bluetooth wireless kit (http://www.sparkfun.com/commerce/product_info.php?products_id=158) for transferring simple messages between them. I was successful at connecting to the real Khepera robot with Khepera.py and loading several brains, however I'm not sure how to proceed now. Should I use some generic robot like Player to evolve the brain and then load it on the Khepera and would that generate an accurate simulation or should I revert to the kheperasimulator? What do you recommend I use to simulate grippers and communication? Thank you in advance. Aleksandr Khasymski From dblank at brynmawr.edu Fri Nov 3 13:16:17 2006 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Fri Nov 3 13:17:00 2006 Subject: [Pyro-users] Khepera Simulator In-Reply-To: <4549F240.81AA.00A9.0@wlu.edu> References: <4549F240.81AA.00A9.0@wlu.edu> Message-ID: <454B8771.6060104@brynmawr.edu> Alexander, Good question. I don't think that Stage nor Gazebo have a complete Khepera model yet, but that could be added there. I don't think you can use the old khepera simulator as it doesn't have a sim gripper, and had other problems as well. Probably the best way to do this is to add this type of robot to the Pyrobot Simulator. The Pyrobot Simulator has the ability to have grippers, cameras (under Linux), and light sensors. Unfortunately, the gripper that exists in Pyrobot Simulator needs to be parameterized so that it can work on any robot. Take a look at: pyrobot/simulators/pysim.py and pyrobot/plugins/worlds/Pyrobot/CamWorld.py Feel free to either copy the Gripper code and geometry to work with the Khepera, or design a new gripper that can be passed parameters to work with any robot. Patches accepted! If you need more help, please ask questions. -Doug Alexander Khasymski wrote: > Hi, > > This probably has an easy solution, but I can't seem to find the answer > anywhere. How do I simulate a KheperaII robot in Pyrobot? I'm working on > my senior thesis in robotics, which involves evolving controllers for > two KheperaII robots to perform a cooperative foraging task, essentially > two Kheperas equipped with grippers and a bluetooth wireless kit > (http://www.sparkfun.com/commerce/product_info.php?products_id=158) > for transferring simple messages between them. I was successful at > connecting to the real Khepera robot with Khepera.py and loading several > brains, however I'm not sure how to proceed now. > > Should I use some generic robot like Player to evolve the brain and > then load it on the Khepera and would that generate an accurate > simulation or should I revert to the kheperasimulator? What do you > recommend I use to simulate grippers and communication? > > Thank you in advance. > > Aleksandr Khasymski > _______________________________________________ > Pyro-users mailing list > Pyro-users@pyrorobotics.org > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users > > From belindatho at gmail.com Tue Nov 7 18:55:56 2006 From: belindatho at gmail.com (Belinda Thom) Date: Tue Nov 7 18:55:47 2006 Subject: [Pyro-users] Fwd: mac os x / pyro questions In-Reply-To: References: Message-ID: Hi, I'm attempting to install the pyro software on a Mac (os x 10.4) and am following the directions at: http://www.pyrorobotics.org/?page=PyroMac I am wondering if anyone has experience installing this stuff using macports (darwinports) as opposed to Fink. I am also wondering if anyone's used MacPython 2.5 as opposed to 2.4. If you have an experience with this, I'd be very happy to hear from you. Thanks, Dr Belinda Thom From bthom at cs.hmc.edu Mon Nov 13 18:08:17 2006 From: bthom at cs.hmc.edu (belinda thom) Date: Mon Nov 13 18:08:28 2006 Subject: [Pyro-users] pyrobot simulator questions Message-ID: Hi, I have installed pyro on a Mac (10.4.8) using no extra options when running python configure.py. This build allows me to run a pyrobot simulator. I think that only the pyrorobots (i.e. PyrobotRobot.py, PyrobotRobot6000[0-7]) can be used in this simulator. It seems that the only difference between these robots is the ports they connect to. This gives me hope that it might be possible to have multiple robots in a single simulation. How does one set this up using the pyro GUI? Thanks, --b From bthom at cs.hmc.edu Mon Nov 13 18:22:32 2006 From: bthom at cs.hmc.edu (belinda thom) Date: Mon Nov 13 18:22:24 2006 Subject: [Pyro-users] Re: pyrobot simulator questions In-Reply-To: References: Message-ID: Looks like I found the answer to this (and many other questions) in the code in: pyrobot/plugins/worlds/Pyrobot/ :-) Sorry for the email. --b On Nov 13, 2006, at 3:08 PM, belinda thom wrote: > Hi, > > I have installed pyro on a Mac (10.4.8) using no extra options when > running python configure.py. > > This build allows me to run a pyrobot simulator. I think that only > the pyrorobots (i.e. PyrobotRobot.py, PyrobotRobot6000[0-7]) can be > used in this simulator. It seems that the only difference between > these robots is the ports they connect to. This gives me hope that > it might be possible to have multiple robots in a single > simulation. How does one set this up using the pyro GUI? > > Thanks, > > --b From bthom at cs.hmc.edu Mon Nov 13 19:59:38 2006 From: bthom at cs.hmc.edu (belinda thom) Date: Mon Nov 13 19:59:27 2006 Subject: [Pyro-users] mac os x install issues / observations / questions Message-ID: <72BB28E2-00F8-4D97-9860-0B7CC22C7BE0@cs.hmc.edu> Hello, I've gotten pyro running on my G5 Mac (10.4.8 w/gcc 4.0.1). This success was in part due to answering "no" to all the options asked about in python configure.py. In other words: I can only run the Pyrobot simulator. Details of how to manually install pyrobot are not on the install pages, so I'll describe what I did. I've also have couple unresolved issues which I'm hoping other Mac/Pyro users might have ideas about. ISSUES ------ DYING: There have been multiple times I've had to kill X11 b/c pyrobot seems to freeze up. Usually, this is in conjunction with trying to load a new simulator, brain, robot, etc. I'm still unclear about what order things must be done in---I'm very likely misusing something---but regardless, the system shouldn't just die. (Tip: I recently installed macport's carbon-based version of Xemacs, so at least I don't have to restart my heavy-weight editor each time.) SWIG: this software is required for some pyro options that utilize C code (e.g. SOM). On the Mac, makefiles that use swig need to be modified (e.g. Unix-style gcc compiler flags like -shared aren't supported). I found more info on SWIG for Macs at: http:// www.dabeaz.com/cgi-bin/wiki.pl?SwigFaqMaxOSXSharedLibraries. Even w/ this info, I was not able to run that page's simple Tcl/wrapper example (rather than running, using Apple's /usr/bin/tclsh to run fact (24) aborted via an error). If you've had success using SWIG on your Mac I'd really like to talk with you! STDLIB.H: I ran into problems (when compiling w/the SOM option) b/c the setprogname in fileio.h/c conflicts with stdlib.h on Mac OS X. INSTALL ------- 1) Once you've unpacked pyro, type "python configure.py" in the directory where you've unpacked pyro to. On Mac OS X, configure.py works for the most part, but don't believe what it recommends to you for a version number (you might get the right path names for other queried values, but this is not guaranteed). Assuming you've downloaded python24 from macports and you've got Apple's version of X11 installed, you'd enter 2.4 (version), /opt/local/bin/python (location to binary), /opt/local/include/python2.4 (python include path), the /usr/X11R6/include (X11 include path). For all the options, I answered "no" Tip: 10.4.8 comes with both tcl/tk and python, so in principle you shouldn't need to install either to run pyro on your Mac. In the very least, you'll need py-tkinter, and you'll probably want py-numeric. Tip: regarding BSD-for-Mac installs, going thru one provider (e.g. macports) made life much easier than installing things individually. macports supports many of the things you'd need to run stage, gazebo, etc. (SWIG-related issues might cause build problems, though.) 2) type "make clean" and "make". This should finish off your install. 3) open X11 and open an xterm. 4) from the directory where you ran make, type "bin/pyrobot". I leave the xterm open and don't run the command in the background so I have access to various text that pyro logs to this "device" (e.g. help, warning msgs). Hope this is helpful. --b From bthom at cs.hmc.edu Mon Nov 13 20:04:54 2006 From: bthom at cs.hmc.edu (belinda thom) Date: Mon Nov 13 20:04:52 2006 Subject: [Pyro-users] multiple robots question Message-ID: <8C851D8E-BF17-4D97-A36E-F18BF83168C6@cs.hmc.edu> Hi, Can someone point me to some documentation on using multiple robots in a single world? I've looked at BigRoomWithLights2Pioneers.py, which shows me that you can create multiple robots, but I cannot figure out how to access the robots (both self.robot and robot evaluate to integer 0). Perhaps the problem is I haven't loaded a robot--but what does it mean to use the robot tab when multiple robots exist? The same question applies to loading brains. It appears from the code that I need a way to access "sim", but I've not been able to figure out how to do this. Many thanks, --b From dblank at brynmawr.edu Mon Nov 13 20:20:08 2006 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Mon Nov 13 20:19:49 2006 Subject: [Pyro-users] multiple robots question In-Reply-To: <8C851D8E-BF17-4D97-A36E-F18BF83168C6@cs.hmc.edu> References: <8C851D8E-BF17-4D97-A36E-F18BF83168C6@cs.hmc.edu> Message-ID: <37783.68.34.179.248.1163467208.squirrel@webmail.brynmawr.edu> Belinda, The normal method of working with Pyro with multiple robots is: 1) start the server or simulator ("Server:" button) 2) connect onto first robot ("Robot:" button) select PyrobotRobot60000.py 3) load a brain ("Brain" button) In the case of multiple robots, you can do the above, and then start another copy of pyrobot, but: 1) connect onto second robot ("Robot:" button) select PyrobotRobot60001.py 2) load a brain ("Brain:" button) When exiting, you should close the second Pyrobot, then the first. The first pyrobot will shut down the simulator on exit. Now, this method requires a running Pyrobot for each sim robot in the world, and talks to them over sockets. This allows an entire class to connect onto a server, and each student could control a robot in the simulated world. If you display the sim world on a projection computer, then you all can watch. This method may not be practical if a single user wants to run dozens of robots, and there are methods for talking directly to the simulator without using sockets. There is an example of this style of processing in the pyrobot/examples/evolang.py file. Likewise, if you wanted to write a single brain that controls many robots, you could do that too. But the default is above. -Doug On Mon, November 13, 2006 8:04 pm, belinda thom said: > Hi, > > Can someone point me to some documentation on using multiple robots > in a single world? > > I've looked at BigRoomWithLights2Pioneers.py, which shows me that you > can create multiple robots, but I cannot figure out how to access the > robots (both self.robot and robot evaluate to integer 0). Perhaps the > problem is I haven't loaded a robot--but what does it mean to use the > robot tab when multiple robots exist? The same question applies to > loading brains. > > It appears from the code that I need a way to access "sim", but I've > not been able to figure out how to do this. > > Many thanks, > > --b > _______________________________________________ > Pyro-users mailing list > Pyro-users@pyrorobotics.org > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users > -- Douglas S. Blank Associate Professor, Bryn Mawr College http://cs.brynmawr.edu/~dblank/ Office: 610 526 601 From bthom at cs.hmc.edu Tue Nov 14 00:24:36 2006 From: bthom at cs.hmc.edu (belinda thom) Date: Tue Nov 14 00:24:38 2006 Subject: [Pyro-users] pyrobot worlds question Message-ID: <294EE6AA-333B-4D15-B7D8-1FCCB24F154B@cs.hmc.edu> Hello, Why do some of the Pyrobot worlds (e.g. Room.py, LightInMaze.py) have python help string comments about "world with two robots" when, in the source code (in plugins/worlds/Pyrobot), only one robot (robot [0]) has been added. In contrast, BigRoomWith2Pioneers.py's string says it has two robots, and two are actually added (robot[0], robot[1]). If one is to load 3 robots into a world (by opening 3 pyrobot instances) do those 3 robots need to be addressed explicitly in the simulator's corresponding world file? Thanks, --b From bthom at cs.hmc.edu Tue Nov 14 00:29:16 2006 From: bthom at cs.hmc.edu (belinda thom) Date: Tue Nov 14 00:29:09 2006 Subject: [Pyro-users] Re: pyrobot worlds question In-Reply-To: <294EE6AA-333B-4D15-B7D8-1FCCB24F154B@cs.hmc.edu> References: <294EE6AA-333B-4D15-B7D8-1FCCB24F154B@cs.hmc.edu> Message-ID: On Nov 13, 2006, at 9:24 PM, belinda thom wrote: > Hello, > > Why do some of the Pyrobot worlds (e.g. Room.py, LightInMaze.py) > have python help string comments about "world with two robots" > when, in the source code (in plugins/worlds/Pyrobot), only one > robot (robot[0]) has been added. In contrast, > BigRoomWith2Pioneers.py's string says it has two robots, and two > are actually added (robot[0], robot[1]). I think I've answered the first part of this question: sim.addRobot adds an additional item to the sim.robot list each time it is called. Only those robots that need extra devices added need to explicitly be referred to via their indices. > > If one is to load 3 robots into a world (by opening 3 pyrobot > instances) do those 3 robots need to be addressed explicitly in the > simulator's corresponding world file? This one I'm still unsure about. > > Thanks, > --b From dblank at brynmawr.edu Tue Nov 14 00:39:18 2006 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Tue Nov 14 00:38:59 2006 Subject: [Pyro-users] pyrobot worlds question In-Reply-To: <294EE6AA-333B-4D15-B7D8-1FCCB24F154B@cs.hmc.edu> References: <294EE6AA-333B-4D15-B7D8-1FCCB24F154B@cs.hmc.edu> Message-ID: <17232.68.34.179.248.1163482758.squirrel@webmail.brynmawr.edu> On Tue, November 14, 2006 12:24 am, belinda thom said: > Hello, > > Why do some of the Pyrobot worlds (e.g. Room.py, LightInMaze.py) have > python help string comments about "world with two robots" when, in > the source code (in plugins/worlds/Pyrobot), only one robot (robot > [0]) has been added. In contrast, BigRoomWith2Pioneers.py's string > says it has two robots, and two are actually added (robot[0], robot[1]). That's why we shouldn't put comments in code; they just end up wrong :) Thanks, fixed in CVS. > If one is to load 3 robots into a world (by opening 3 pyrobot > instances) do those 3 robots need to be addressed explicitly in the > simulator's corresponding world file? Right, first you create a world file with three robots in it, and assign them port numbers. Then you load the world in the simulator, and can then connect onto them. Note that when you select the robot connection named PyrobotRobot.py, you can specify the host name and port, so you can connect onto a simulator anywhere across the internet (barring any firewall preventions). Battlebots, anyone? -Doug > Thanks, > --b > _______________________________________________ > Pyro-users mailing list > Pyro-users@pyrorobotics.org > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users > -- Douglas S. Blank Associate Professor, Bryn Mawr College http://cs.brynmawr.edu/~dblank/ Office: 610 526 601 From dblank at brynmawr.edu Tue Nov 14 10:36:57 2006 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Tue Nov 14 10:36:39 2006 Subject: [Pyro-users] Multiple simulators on single computer Message-ID: <53658.68.34.179.248.1163518617.squirrel@webmail.brynmawr.edu> > I'm trying to have multiple students running separate > simulators on the same machine - we only have one machine with Pyro > installed. Is that possible? Yes, but it requires an extra step to coordinate what students get what ports. I just tried this to make sure it works. You need to specify in the world file what ports will be used by a robot, and make sure students know what port to connect onto. So, you could: 1) Make a world file for each student, either by name or number. For example, if you take a world file in pyrobot/plugins/world/Pyrobot/Tutorial.py and change the port number from 60000 to 60001, and save this file as pyrobot/plugins/world/Pyrobot/TutorialDavid.py. Make a second copy, change the port number to 60002, and save as pyrobot/plugins/world/Pyrobot/TutorialSara.py 2) Now you need to have a connection for each. You can just use PyrobotRobot.py and David needs to know that when he starts his world to select port 60001, and Sara selects 60002. Or you could copy pyrobot/plugins/robots/PyrobotRobot60000.py to pyrobot/plugins/robots/PyrobotRobotDavid.py and change the port number in the file to 60001. The same with Sara's connection file. I'm not sure how many simulations a single computer can run simultaneously, but I have tried to make it so that it doesn't use any more CPU than necessary. Of course, there is a lot of computation going on. The simulated camera would use up quite a bit of CPU, but otherwise I think you could probably run dozens on a modern CPU. This would also work for a single researcher running multiple experiments simultaneously, but there is another way to do that that doesn't use sockets, and therefore avoids the whole issue. I also use Python on our Beowulf cluster. Combined with the ability to run the simulations without graphics, this speeds up genetic evolutionary simulations. Hope that helps, -Doug -- Douglas S. Blank Associate Professor, Bryn Mawr College http://cs.brynmawr.edu/~dblank/ Office: 610 526 601 From bthom at cs.hmc.edu Tue Nov 14 13:04:51 2006 From: bthom at cs.hmc.edu (belinda thom) Date: Tue Nov 14 13:04:53 2006 Subject: [Pyro-users] pyrobot worlds question In-Reply-To: <4559F4BD.9010501@brynmawr.edu> References: <294EE6AA-333B-4D15-B7D8-1FCCB24F154B@cs.hmc.edu> <17232.68.34.179.248.1163482758.squirrel@webmail.brynmawr.edu> <4DFE1710-DE8D-4474-B3C1-D999621DD68B@cs.hmc.edu> <4559F4BD.9010501@brynmawr.edu> Message-ID: On Nov 14, 2006, at 8:54 AM, Douglas S. Blank wrote: > So you want to have a client create a new robot? That would be a > nice enhancement. Would you send Python expressions to the > simulator over the socket? Or have some predefined robots, by name, > to add? You can actually send python expressions over a Pyrobot > connection, but you need to have a connection to begin with. It > sounds complicated to try to tell someone how to use... I was rather thinking you'd change the world constructor up front so it took an argument of how many robots to create. Then you don't have to write a new world every time the only thing that changes is the number of robots. I suppose you'd have to have a means for giving them initial locations too, so they didn't all sit right on top of each other. My motivation for such a functionality would be to demo braitenberg robots in class, changing the number of robots in the scene on-the- fly (i.e. each time you start up a simluation). I've also written scripts to help me get this multiple robot setup working (given how many ways there are to make errors, this seems worthwhile). So my tcsh script could in principle start 1 simulator (via pyro -s...) and then call n robots (via pyro -r... -b...). From bthom at cs.hmc.edu Wed Nov 15 23:49:58 2006 From: bthom at cs.hmc.edu (belinda thom) Date: Wed Nov 15 23:49:59 2006 Subject: [Pyro-users] STALL / multiple-robot problem Message-ID: <8923E40D-CE48-49F1-A2B0-7096E88300B5@cs.hmc.edu> Symptom: Robots "stall" for no reason when there's multiple robots in a single world. Potential hypothesis: w/multiple threads, various stall flags are becoming corrupted. Setup: An empty room (10 m x 10 m), 3 robots (radii .4 m), all w/ Avoid.py behavior (taken from the brain file downloaded from CVS about 3 days ago). Running G5 Mac w/OS X 10.4. Details: I've used some Mac screen-grabs to document what I mean. The behavior I report below seems to be easy to replicate for each of the 3 robots (its not dependent on order robots are added). Shown on the left is a typical example. On the right is that robot's controller pane, with results shown for several steps. (The only way I changed Avoid.py was to intersperse print statements in its step and auxillary functions to determine if a STALL condition was visible to the robot during its step.) At the point I'm showing the robot, it would have been sitting there for a long time (appearing not to move at all, but actually making micro adjustments to left/right motors, as you can see in the command pane). At no point does the stall value change from "0". Yet every time I hit the step button, for a brief second, the "X: 0.40 .. Th: 13" text flickers to "X:40 .. Th: 13 [STALL!]. And the robot really seems like it will sit there indefinitely. -------------- next part -------------- A non-text attachment was scrubbed... Name: pastedGraphic.png Type: image/png Size: 1997 bytes Desc: not available Url : http://emergent.brynmawr.edu/pipermail/pyro-users/attachments/20061115/cb7f9f9a/pastedGraphic.png -------------- next part -------------- A non-text attachment was scrubbed... Name: pastedGraphic.png Type: image/png Size: 3403 bytes Desc: not available Url : http://emergent.brynmawr.edu/pipermail/pyro-users/attachments/20061115/cb7f9f9a/pastedGraphic-0001.png -------------- next part -------------- I've tried to mimic this behavior in a world that is identical except that it only contains 1 robot and have had no luck. In that case, the robot can always recover from long walls (and only rarely gets stuck in a corner, although then it still doesn't flicker "STALL!"). In the multiple-robot case I've also seen stall behavior when a robot is near a light or another robot (in the single-robot case, the robot walks on top of the light no problem, which is the desired behavior, i think) I am unclear where the "show a STALL on the text bar" order comes from. Avoid.py merely calls move w/translate and rotate values. Since the robot isn't going anywhere (and doesn't seem to see its own flag as stalled) it seems that move's call to motor must somehow be being thrown away. I look forward to hearing any opinions regarding this unfortunate behavior, as until its cleared up, I'm not going to be able to create interesting multi-robot Braitenberg demos. Thanks, --b From dblank at brynmawr.edu Thu Nov 16 23:56:10 2006 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Thu Nov 16 23:55:51 2006 Subject: [Pyro-users] STALL / multiple-robot problem In-Reply-To: <8923E40D-CE48-49F1-A2B0-7096E88300B5@cs.hmc.edu> References: <8923E40D-CE48-49F1-A2B0-7096E88300B5@cs.hmc.edu> Message-ID: <51210.68.34.179.248.1163739370.squirrel@webmail.brynmawr.edu> On Wed, November 15, 2006 11:49 pm, belinda thom said: > > Symptom: Robots "stall" for no reason when there's multiple robots in > a single world. Belinda, Does this happen when you are "running" the brains, or just "stepping"? Stall is a funny sensor in that you can only detect it when you are trying to move and you can't. I can see that that might not work correctly in a "step" situation (because at the end of the step you no longer are trying to move). If you think that there really is a bug, please send a world file, and I'll see if I can replicate. Thanks! -Doug > Potential hypothesis: w/multiple threads, various stall flags are > becoming corrupted. > > Setup: An empty room (10 m x 10 m), 3 robots (radii .4 m), all w/ > Avoid.py behavior (taken from the brain file downloaded from CVS > about 3 days ago). Running G5 Mac w/OS X 10.4. > > Details: > > I've used some Mac screen-grabs to document what I mean. > > The behavior I report below seems to be easy to replicate for each of > the 3 robots (its not dependent on order robots are added). Shown on > the left is a typical example. On the right is that robot's > controller pane, with results shown for several steps. (The only way > I changed Avoid.py was to intersperse print statements in its step > and auxillary functions to determine if a STALL condition was visible > to the robot during its step.) > > At the point I'm showing the robot, it would have been sitting there > for a long time (appearing not to move at all, but actually making > micro adjustments to left/right motors, as you can see in the command > pane). At no point does the stall value change from "0". Yet every > time I hit the step button, for a brief second, the "X: 0.40 .. Th: > 13" text flickers to "X:40 .. Th: 13 [STALL!]. And the robot really > seems like it will sit there indefinitely. > > > I've tried to mimic this behavior in a world that is identical except > that it only contains 1 robot and have had no luck. In that case, the > robot can always recover from long walls (and only rarely gets stuck > in a corner, although then it still doesn't flicker "STALL!"). > > In the multiple-robot case I've also seen stall behavior when a robot > is near a light or another robot (in the single-robot case, the robot > walks on top of the light no problem, which is the desired behavior, > i think) > > I am unclear where the "show a STALL on the text bar" order comes > from. Avoid.py merely calls move w/translate and rotate values. Since > the robot isn't going anywhere (and doesn't seem to see its own flag > as stalled) it seems that move's call to motor must somehow be being > thrown away. > > I look forward to hearing any opinions regarding this unfortunate > behavior, as until its cleared up, I'm not going to be able to create > interesting multi-robot Braitenberg demos. > > Thanks, > > --b_______________________________________________ > Pyro-users mailing list > Pyro-users@pyrorobotics.org > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users > -- Douglas S. Blank Associate Professor, Bryn Mawr College http://cs.brynmawr.edu/~dblank/ Office: 610 526 601 From bthom at cs.hmc.edu Fri Nov 17 20:48:44 2006 From: bthom at cs.hmc.edu (belinda thom) Date: Fri Nov 17 21:53:35 2006 Subject: [Pyro-users] STALL / multiple-robot problem In-Reply-To: <51210.68.34.179.248.1163739370.squirrel@webmail.brynmawr.edu> References: <8923E40D-CE48-49F1-A2B0-7096E88300B5@cs.hmc.edu> <51210.68.34.179.248.1163739370.squirrel@webmail.brynmawr.edu> Message-ID: On Nov 16, 2006, at 8:56 PM, Douglas S. Blank wrote: > On Wed, November 15, 2006 11:49 pm, belinda thom said: >> >> Symptom: Robots "stall" for no reason when there's multiple robots in >> a single world. > > Belinda, > > Does this happen when you are "running" the brains, or just > "stepping"? > > Stall is a funny sensor in that you can only detect it when you are > trying > to move and you can't. I can see that that might not work correctly > in a > "step" situation (because at the end of the step you no longer are > trying > to move). > > If you think that there really is a bug, please send a world file, and > I'll see if I can replicate. > > Thanks! > > -Doug Doug, Below there's two screen shots, one of a single robot in the world, running and non-stalled even though the wall's are not yet touched. In the next screen shot, there's three robots and all think their stalled, even though none is touching the walls yet (they're flags also indicate stalled this time, perhaps because I'm running all three instead of stepping one). In all cases, the robots had brains (Agent.py, modified only to include print lines). In the one-robot case, its running Braitenberg2Lights1Robot.py world, the other is running Bthom.py (a world modified to have 3 randomly placed robots, but otherwise like Braitenberg). This bthom.py world is the one that I'd like to coordinate w/a shell script, so I can parameterize how many robots to instantiate; I discussed that issue in the private email I sent you. I will include the 2 worlds, the brain, and the script I use to launch a world/brain/simulator combo (right now this script needs to be told how many robots to start up, and the number of robots you start up needs to be the same number that the world file accepts). So, for instance, you would call: bt_pyro_sim 3 Avoid.py Bthom.py or bt_pyro_sim 1 Avoid.py Braitenberg2Lights1Robot.py The scripts makes assumptions about where these files live, as well as where pyrobot lives that you can easily change. I'll also include another script, bt_pkill, that if you call w/"bt_kill pyro" should stop all servers/clients, so restarting is easy. Thanks for looking at this stuff. I'm looking forward to hearing what you discover. --b -------------- next part -------------- A non-text attachment was scrubbed... Name: bt_pyro_sim Type: application/octet-stream Size: 991 bytes Desc: not available Url : http://emergent.brynmawr.edu/pipermail/pyro-users/attachments/20061117/72964a40/bt_pyro_sim-0001.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: bt_kill Type: application/octet-stream Size: 1527 bytes Desc: not available Url : http://emergent.brynmawr.edu/pipermail/pyro-users/attachments/20061117/72964a40/bt_kill-0001.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: Avoid.py Type: text/x-python-script Size: 1530 bytes Desc: not available Url : http://emergent.brynmawr.edu/pipermail/pyro-users/attachments/20061117/72964a40/Avoid-0001.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: Braitenberg2Lights1Robot.py Type: text/x-python-script Size: 1004 bytes Desc: not available Url : http://emergent.brynmawr.edu/pipermail/pyro-users/attachments/20061117/72964a40/Braitenberg2Lights1Robot-0001.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: Bthom.py Type: text/x-python-script Size: 6018 bytes Desc: not available Url : http://emergent.brynmawr.edu/pipermail/pyro-users/attachments/20061117/72964a40/Bthom-0001.bin -------------- next part -------------- -------------- next part -------------- A non-text attachment was scrubbed... Name: pastedGraphic.png Type: image/png Size: 2455271 bytes Desc: not available Url : http://emergent.brynmawr.edu/pipermail/pyro-users/attachments/20061117/72964a40/pastedGraphic-0002.png -------------- next part -------------- -------------- next part -------------- A non-text attachment was scrubbed... Name: pastedGraphic.png Type: image/png Size: 1496834 bytes Desc: not available Url : http://emergent.brynmawr.edu/pipermail/pyro-users/attachments/20061117/72964a40/pastedGraphic-0003.png From chrisspen at gmail.com Tue Nov 28 16:04:18 2006 From: chrisspen at gmail.com (Chris S) Date: Tue Nov 28 16:04:28 2006 Subject: [Pyro-users] Numpy Message-ID: I noticed Pyro still makes use of the deprecated Numeric package. Are there any plans to replace this with Numpy? Regards, Chris From dblank at brynmawr.edu Tue Nov 28 17:36:02 2006 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Tue Nov 28 17:36:03 2006 Subject: [Pyro-users] Numpy In-Reply-To: References: Message-ID: <6639.68.34.179.248.1164753362.squirrel@webmail.brynmawr.edu> On Tue, November 28, 2006 4:04 pm, Chris S said: > I noticed Pyro still makes use of the deprecated Numeric package. Are > there any plans to replace this with Numpy? Yes. Patches accepted, if you get to it first! Let us know if you are working on it. -Doug > Regards, > Chris > _______________________________________________ > Pyro-users mailing list > Pyro-users@pyrorobotics.org > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users > -- Douglas S. Blank Associate Professor, Bryn Mawr College http://cs.brynmawr.edu/~dblank/ Office: 610 526 601 From chrisspen at gmail.com Tue Nov 28 18:07:40 2006 From: chrisspen at gmail.com (Chris S) Date: Tue Nov 28 18:07:51 2006 Subject: [Pyro-users] Numpy In-Reply-To: <6639.68.34.179.248.1164753362.squirrel@webmail.brynmawr.edu> References: <6639.68.34.179.248.1164753362.squirrel@webmail.brynmawr.edu> Message-ID: On 11/28/06, Douglas S. Blank wrote: > > On Tue, November 28, 2006 4:04 pm, Chris S said: > > I noticed Pyro still makes use of the deprecated Numeric package. Are > > there any plans to replace this with Numpy? > > Yes. Patches accepted, if you get to it first! Let us know if you are > working on it. It's actually pretty trivial for the most part. There's a section in Travis's Guide to Numpy (http://numpy.scipy.org/numpybooksample.pdf) that covers converting Numeric code (page 38). The good news is most of the conversion can be done automatically, with the aid of functions in numpy.oldnumeric.alter_code1.* I ran numpy.oldnumeric.alter_code1.convertall(%pathToPyrobot%/brain) and was able to use Conx without any problems. I'm a huge fan of Python's unittest module for regression testing, but even though you don't seem to use this, verifying the converted code shouldn't be too hard. Regards, Chris From chrisspen at gmail.com Tue Nov 28 18:10:27 2006 From: chrisspen at gmail.com (Chris S) Date: Tue Nov 28 18:10:28 2006 Subject: [Pyro-users] Website Message-ID: Thought you should know that the first search result on Google for "pyro python robotics" is http://emergent.brynmawr.edu/~dblank/pyro/, which seems to be missing all but the home page. You might want to redirect that page to http://www.pyrorobotics.org/. Regards, Chris From dblank at brynmawr.edu Tue Nov 28 19:41:43 2006 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Tue Nov 28 19:41:41 2006 Subject: [Pyro-users] Website In-Reply-To: References: Message-ID: <3061.68.34.179.248.1164760903.squirrel@webmail.brynmawr.edu> On Tue, November 28, 2006 6:10 pm, Chris S said: > Thought you should know that the first search result on Google for > "pyro python robotics" is http://emergent.brynmawr.edu/~dblank/pyro/, > which seems to be missing all but the home page. You might want to > redirect that page to http://www.pyrorobotics.org/. Oops. Thanks; fixed. -Doug > Regards, > Chris > _______________________________________________ > Pyro-users mailing list > Pyro-users@pyrorobotics.org > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users > -- Douglas S. Blank Associate Professor, Bryn Mawr College http://cs.brynmawr.edu/~dblank/ Office: 610 526 601 From dblank at brynmawr.edu Wed Nov 29 09:45:47 2006 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Wed Nov 29 09:47:01 2006 Subject: [Pyro-users] STALL / multiple-robot problem In-Reply-To: <8923E40D-CE48-49F1-A2B0-7096E88300B5@cs.hmc.edu> References: <8923E40D-CE48-49F1-A2B0-7096E88300B5@cs.hmc.edu> Message-ID: <456D9D1B.8050402@brynmawr.edu> Just updating this thread in the mailing list: The problem turned out to be an incorrect bounding box on the robots. The bounding box is what actually checks to see if a robot crashes into something. The bounding box is just four lines to check for intersection in the simulated world. The robot might actually be drawn with a complicated shape, but the bounding box is what is checked to see if a robot has bumped into something. This makes the Python-based simulator much faster than it would if it checked each line of the robot's shape. You can see the bounding box in the Pyrobot simulator's window by selecting View -> boundingBox. There are other things that you can turn on/off there that can help with debugging. -Doug belinda thom wrote: > > Symptom: Robots "stall" for no reason when there's multiple robots in a > single world. > > Potential hypothesis: w/multiple threads, various stall flags are > becoming corrupted. > > Setup: An empty room (10 m x 10 m), 3 robots (radii .4 m), all > w/Avoid.py behavior (taken from the brain file downloaded from CVS about > 3 days ago). Running G5 Mac w/OS X 10.4. > > Details: > > I've used some Mac screen-grabs to document what I mean. > > The behavior I report below seems to be easy to replicate for each of > the 3 robots (its not dependent on order robots are added). Shown on the > left is a typical example. On the right is that robot's controller pane, > with results shown for several steps. (The only way I changed Avoid.py > was to intersperse print statements in its step and auxillary functions > to determine if a STALL condition was visible to the robot during its > step.) > > At the point I'm showing the robot, it would have been sitting there for > a long time (appearing not to move at all, but actually making micro > adjustments to left/right motors, as you can see in the command pane). > At no point does the stall value change from "0". Yet every time I hit > the step button, for a brief second, the "X: 0.40 .. Th: 13" text > flickers to "X:40 .. Th: 13 [STALL!]. And the robot really seems like it > will sit there indefinitely. > > > ------------------------------------------------------------------------ > > > ------------------------------------------------------------------------ > > > I've tried to mimic this behavior in a world that is identical except > that it only contains 1 robot and have had no luck. In that case, the > robot can always recover from long walls (and only rarely gets stuck in > a corner, although then it still doesn't flicker "STALL!"). > > In the multiple-robot case I've also seen stall behavior when a robot is > near a light or another robot (in the single-robot case, the robot walks > on top of the light no problem, which is the desired behavior, i think) > > I am unclear where the "show a STALL on the text bar" order comes from. > Avoid.py merely calls move w/translate and rotate values. Since the > robot isn't going anywhere (and doesn't seem to see its own flag as > stalled) it seems that move's call to motor must somehow be being thrown > away. > > I look forward to hearing any opinions regarding this unfortunate > behavior, as until its cleared up, I'm not going to be able to create > interesting multi-robot Braitenberg demos. > > Thanks, > > --b > > > ------------------------------------------------------------------------ > > _______________________________________________ > Pyro-users mailing list > Pyro-users@pyrorobotics.org > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users From chrisspen at gmail.com Wed Nov 29 22:36:51 2006 From: chrisspen at gmail.com (Chris S) Date: Wed Nov 29 22:37:01 2006 Subject: [Pyro-users] Deactivate Conx Inputs? Message-ID: I'm not sure if this makes any sense, but is it possible to add, remove, or deactivate certain input nodes in a Conx neural network after it's been trained? For example, consider a network that takes 3-inputs representing colors red, green, and blue. The network has N outputs, each indicating whether or not the color arraignment matches a particular object. Suppose I've trained this network on a corpus to match r,g,b colors to N objects, but now I want to train it on a different corpus missing the color red. I know in this trivial example it would probably be easiest to build and train a separate network, but imagine if this example were scaled to a larger non-trivial network, one with dozens or hundreds of input nodes. In that scenario I've spent a considerable amount of time training the network, so I wouldn't want to start from scratch if I could help it. Would it be possible in this case to "turn-off" the red input, and train/propagate using only the other two colors, but still have the option to "re-activate" the input later to again use the network with all three colors? Regards, Chris From dblank at brynmawr.edu Wed Nov 29 23:43:34 2006 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Wed Nov 29 23:43:33 2006 Subject: [Pyro-users] Deactivate Conx Inputs? In-Reply-To: References: Message-ID: <55143.68.34.179.248.1164861814.squirrel@webmail.brynmawr.edu> On Wed, November 29, 2006 10:36 pm, Chris S said: > I'm not sure if this makes any sense, but is it possible to add, > remove, or deactivate certain input nodes in a Conx neural network > after it's been trained? > > For example, consider a network that takes 3-inputs representing > colors red, green, and blue. The network has N outputs, each > indicating whether or not the color arraignment matches a particular > object. Suppose I've trained this network on a corpus to match r,g,b > colors to N objects, but now I want to train it on a different corpus > missing the color red. > > I know in this trivial example it would probably be easiest to build > and train a separate network, but imagine if this example were scaled > to a larger non-trivial network, one with dozens or hundreds of input > nodes. In that scenario I've spent a considerable amount of time > training the network, so I wouldn't want to start from scratch if I > could help it. > > Would it be possible in this case to "turn-off" the red input, and > train/propagate using only the other two colors, but still have the > option to "re-activate" the input later to again use the network with > all three colors? Chris, Yes, that makes sense and we do things similar quite often. Conx (the neural network toolkit in Pyro) has two concepts that can help here: "frozen" weights and layers; and "active" weights and layers. You can set any group of weights (a Connection object) or a layer (a Layer object) so that the weights are "frozen". This just means that the weights won't change, even if backprop says they should. (Layer objects contain the bias/threshold weights, so that is what gets frozen there). But it sounds like you want the second option. You can set a layer or weight connection group to either be active or not. If a layer/weight group is not active (set equal to 0) then it won't participate in forward propagation of activation, nor will it be involved with backprop of error and changing of weights. To make sure you get the right effect, you can step through the network, watching what changes, like this: % python >>> from pyrobot.brain.conx import * Conx, version 1.233 (regular speed) >>> net = Network() Conx using seed: 1164951718.93 >>> net.addLayers(2, 3, 1) >>> net.interactive = 1 >>> net.step(input = [0, 0], output = [0]) Display network 'Backprop Network': ============================= Layer 'output': (Kind: Output, Size: 1, Active: 1, Frozen: 0) Target : 0.00 Activation: 0.52 ============================= Layer 'hidden': (Kind: Hidden, Size: 3, Active: 1, Frozen: 0) Activation: 0.50 0.48 0.50 ============================= Layer 'input': (Kind: Input, Size: 2, Active: 1, Frozen: 0) Activation: 0.00 0.00 >>> net.step(input = [0, 0], output = [0]) In the network display you can see which layers are active and frozen. You can only turn entire layers off/on (actually a "bank" since you can have these groups next to each other, rather than being technically "layered"). However, you can have layers of single units. Hope that helps, -Doug > Regards, > Chris > _______________________________________________ > Pyro-users mailing list > Pyro-users@pyrorobotics.org > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users > -- Douglas S. Blank Associate Professor, Bryn Mawr College http://cs.brynmawr.edu/~dblank/ Office: 610 526 601 From jalopcar at gmail.com Thu Nov 30 11:49:19 2006 From: jalopcar at gmail.com (Jaime Lopez) Date: Thu Nov 30 11:49:23 2006 Subject: [Pyro-users] new map Message-ID: <138315cf0611300849saa3bde8y6f7ef25d1ef63c6b@mail.gmail.com> Hi pyrobot users, I would like to add a new map into pyrobot, I mean, I want to use the robots inside pyrobot on a new map designed by me (a kind of labyrinth). Anyone can give me some points how to do that? Thanks in advance. -- Jaime Lopez -------------- next part -------------- An HTML attachment was scrubbed... URL: http://emergent.brynmawr.edu/pipermail/pyro-users/attachments/20061130/6ebf05dd/attachment.htm From chrisspen at gmail.com Thu Nov 30 11:59:34 2006 From: chrisspen at gmail.com (Chris S) Date: Thu Nov 30 11:59:41 2006 Subject: [Pyro-users] Named Conx IO Message-ID: Hi Doug, A while ago we talked about giving networks named inputs and outputs for training and propagation. You mentioned this was implemented, but I've been having problems using this feature. As a test I've tried creating a network for simulating a simple logical AND. The two inputs are named 'a' and 'b', and the output is named 'f'. Below is my sample code, and the error it generates. Am I using this feature correctly? Regards, Chris from pyrobot.brain.conx import * # create network net = Network() # create layers net.addLayer('a', 1) net.addLayer('b', 1) net.addLayer('f', 1) net.connect('a', 'f') net.connect('b', 'f') # set patterns patterns = [ [dict(a=0.0, b=0.0), dict(f=0.0)], [dict(a=0.0, b=1.0), dict(f=0.0)], [dict(a=0.0, b=0.0), dict(f=0.0)], [dict(a=0.0, b=0.0), dict(f=1.0)], ] net.setInputsAndTargets(patterns) # set learning parameters net.setEpsilon(0.5) net.setTolerance(0.2) net.setReportRate(1) # learn net.train() >>> Conx, version 1.229 (regular speed) Conx using seed: 1164933601.75 Traceback (most recent call last): File "C:\Documents and Settings\TEMP\Desktop\nntest.py", line 37, in ? net.train() File "C:\Program Files\Python24\lib\site-packages\pyrobot\brain\conx.py", line 1685, in train (tssErr, totalCorrect, totalCount, totalPCorrect) = self.sweep() File "C:\Program Files\Python24\lib\site-packages\pyrobot\brain\conx.py", line 1820, in sweep (error, correct, total, pcorrect) = self.step( **datum ) File "C:\Program Files\Python24\lib\site-packages\pyrobot\brain\conx.py", line 1752, in step self.propagate(**args) File "C:\Program Files\Python24\lib\site-packages\pyrobot\brain\conx.py", line 1964, in propagate self.copyActivations(layer, args[key]) File "C:\Program Files\Python24\lib\site-packages\pyrobot\brain\conx.py", line 1415, in copyActivations layer.copyActivations(vector[start:start+layer.size]) TypeError: unsubscriptable object From dblank at brynmawr.edu Thu Nov 30 12:24:31 2006 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Thu Nov 30 12:25:46 2006 Subject: [Pyro-users] Named Conx IO In-Reply-To: References: Message-ID: <456F13CF.2090406@brynmawr.edu> Chris, Yes, this should work if you get the format of the inputs/targets just right. (But, this isn't using the "pattern" feature of Conx; you're just using the named layer method.) Here is AND again, but notice the list inside the dicts: from pyrobot.brain.conx import * # create network net = Network() # create layers net.addLayer('a', 1) net.addLayer('b', 1) net.addLayer('f', 1) net.connect('a', 'f') net.connect('b', 'f') # set training corpus: corpus = [ [dict(a=[0.0], b=[0.0]), dict(f=[0.0])], [dict(a=[0.0], b=[1.0]), dict(f=[0.0])], [dict(a=[1.0], b=[0.0]), dict(f=[0.0])], [dict(a=[1.0], b=[1.0]), dict(f=[1.0])], ] net.setInputsAndTargets(corpus) # set learning parameters net.setEpsilon(0.5) net.setTolerance(0.2) net.setReportRate(1) # learn net.train() It should learn in about 16 sweeps/epochs. Patterns, on the other hand, are if you want to name a particular vector (not layer). For example: p = {"apple": [1, 0, 0, 1, 0], "banana": [1, 1, 1, 0, 0]} If you want to do that, then you would call net.setPatterns(p), and you could combine that with the named layers. Here is an example with both: from pyrobot.brain.conx import * # create network net = Network() # create layers net.addLayer('a', 1) net.addLayer('b', 1) net.addLayer('f', 1) net.connect('a', 'f') net.connect('b', 'f') p = {"zero": [0.0], "one" : [1.0]} net.setPatterns(p) # set training corpus: corpus = [ [dict(a="zero", b="zero"), dict(f="zero")], [dict(a="zero", b="one"), dict(f="zero")], [dict(a="one", b="zero"), dict(f="zero")], [dict(a="one", b="one"), dict(f="one")], ] net.setInputsAndTargets(corpus) # set learning parameters net.setEpsilon(0.5) net.setTolerance(0.2) net.setReportRate(1) # learn net.train() Notice that the lists inside the dicts is now in the pattern itself. -Doug Chris S wrote: > Hi Doug, > > A while ago we talked about giving networks named inputs and outputs > for training and propagation. You mentioned this was implemented, but > I've been having problems using this feature. > > As a test I've tried creating a network for simulating a simple > logical AND. The two inputs are named 'a' and 'b', and the output is > named 'f'. Below is my sample code, and the error it generates. Am I > using this feature correctly? > > Regards, > Chris > > from pyrobot.brain.conx import * > > # create network > net = Network() > > # create layers > net.addLayer('a', 1) > net.addLayer('b', 1) > net.addLayer('f', 1) > net.connect('a', 'f') > net.connect('b', 'f') > > # set patterns > patterns = [ > [dict(a=0.0, b=0.0), dict(f=0.0)], > [dict(a=0.0, b=1.0), dict(f=0.0)], > [dict(a=0.0, b=0.0), dict(f=0.0)], > [dict(a=0.0, b=0.0), dict(f=1.0)], > ] > net.setInputsAndTargets(patterns) > > # set learning parameters > net.setEpsilon(0.5) > net.setTolerance(0.2) > net.setReportRate(1) > > # learn > net.train() > >>>> > Conx, version 1.229 (regular speed) > Conx using seed: 1164933601.75 > Traceback (most recent call last): > File "C:\Documents and Settings\TEMP\Desktop\nntest.py", line 37, in ? > net.train() > File "C:\Program > Files\Python24\lib\site-packages\pyrobot\brain\conx.py", line 1685, in > train > (tssErr, totalCorrect, totalCount, totalPCorrect) = self.sweep() > File "C:\Program > Files\Python24\lib\site-packages\pyrobot\brain\conx.py", line 1820, in > sweep > (error, correct, total, pcorrect) = self.step( **datum ) > File "C:\Program > Files\Python24\lib\site-packages\pyrobot\brain\conx.py", line 1752, in > step > self.propagate(**args) > File "C:\Program > Files\Python24\lib\site-packages\pyrobot\brain\conx.py", line 1964, in > propagate > self.copyActivations(layer, args[key]) > File "C:\Program > Files\Python24\lib\site-packages\pyrobot\brain\conx.py", line 1415, in > copyActivations > layer.copyActivations(vector[start:start+layer.size]) > TypeError: unsubscriptable object > _______________________________________________ > Pyro-users mailing list > Pyro-users@pyrorobotics.org > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users > > From dblank at brynmawr.edu Thu Nov 30 12:30:38 2006 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Thu Nov 30 12:31:52 2006 Subject: [Pyro-users] new map In-Reply-To: <138315cf0611300849saa3bde8y6f7ef25d1ef63c6b@mail.gmail.com> References: <138315cf0611300849saa3bde8y6f7ef25d1ef63c6b@mail.gmail.com> Message-ID: <456F153E.3050709@brynmawr.edu> Jaime Lopez wrote: > Hi pyrobot users, > > I would like to add a new map into pyrobot, I mean, I want to use the > robots inside pyrobot on a new map designed by me (a kind of labyrinth). > Anyone can give me some points how to do that? > > Thanks in advance. Jamie, This is what we would call a "world" file. Depending on which simulator you use, there are different world file formats. Examples are all in pyrobot/plugins/worlds/ divided by simulator type. The PyrobotSimulator is written in Python, and the most portable (it will run on mac, windows, linux). You can read some about the details here: http://pyrorobotics.org/?page=The_20Pyrobot_20Simulator Other simulators are detailed here: http://pyrorobotics.org/?page=PyroHardware -Doug > -- > Jaime Lopez > > > ------------------------------------------------------------------------ > > _______________________________________________ > Pyro-users mailing list > Pyro-users@pyrorobotics.org > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users From chrisspen at gmail.com Thu Nov 30 14:15:39 2006 From: chrisspen at gmail.com (Chris S) Date: Thu Nov 30 14:15:44 2006 Subject: [Pyro-users] Named Conx IO In-Reply-To: <456F13CF.2090406@brynmawr.edu> References: <456F13CF.2090406@brynmawr.edu> Message-ID: Great, works perfectly. Thanks for the help! Chris On 11/30/06, Douglas S. Blank wrote: > Chris, > > Yes, this should work if you get the format of the inputs/targets just > right. (But, this isn't using the "pattern" feature of Conx; you're just > using the named layer method.) Here is AND again, but notice the list > inside the dicts: > > from pyrobot.brain.conx import * > > # create network > net = Network() > > # create layers > net.addLayer('a', 1) > net.addLayer('b', 1) > net.addLayer('f', 1) > net.connect('a', 'f') > net.connect('b', 'f') > > # set training corpus: > corpus = [ > [dict(a=[0.0], b=[0.0]), dict(f=[0.0])], > [dict(a=[0.0], b=[1.0]), dict(f=[0.0])], > [dict(a=[1.0], b=[0.0]), dict(f=[0.0])], > [dict(a=[1.0], b=[1.0]), dict(f=[1.0])], > ] > > net.setInputsAndTargets(corpus) > > # set learning parameters > net.setEpsilon(0.5) > net.setTolerance(0.2) > net.setReportRate(1) > > # learn > net.train() > > It should learn in about 16 sweeps/epochs. > > Patterns, on the other hand, are if you want to name a particular vector > (not layer). For example: > > p = {"apple": [1, 0, 0, 1, 0], > "banana": [1, 1, 1, 0, 0]} > > If you want to do that, then you would call net.setPatterns(p), and you > could combine that with the named layers. Here is an example with both: > > from pyrobot.brain.conx import * > > # create network > net = Network() > > # create layers > net.addLayer('a', 1) > net.addLayer('b', 1) > net.addLayer('f', 1) > net.connect('a', 'f') > net.connect('b', 'f') > > p = {"zero": [0.0], > "one" : [1.0]} > > net.setPatterns(p) > > # set training corpus: > corpus = [ > [dict(a="zero", b="zero"), dict(f="zero")], > [dict(a="zero", b="one"), dict(f="zero")], > [dict(a="one", b="zero"), dict(f="zero")], > [dict(a="one", b="one"), dict(f="one")], > ] > > net.setInputsAndTargets(corpus) > > # set learning parameters > net.setEpsilon(0.5) > net.setTolerance(0.2) > net.setReportRate(1) > > # learn > net.train() > > Notice that the lists inside the dicts is now in the pattern itself. > > -Doug > > Chris S wrote: > > Hi Doug, > > > > A while ago we talked about giving networks named inputs and outputs > > for training and propagation. You mentioned this was implemented, but > > I've been having problems using this feature. > > > > As a test I've tried creating a network for simulating a simple > > logical AND. The two inputs are named 'a' and 'b', and the output is > > named 'f'. Below is my sample code, and the error it generates. Am I > > using this feature correctly? > > > > Regards, > > Chris > > > > from pyrobot.brain.conx import * > > > > # create network > > net = Network() > > > > # create layers > > net.addLayer('a', 1) > > net.addLayer('b', 1) > > net.addLayer('f', 1) > > net.connect('a', 'f') > > net.connect('b', 'f') > > > > # set patterns > > patterns = [ > > [dict(a=0.0, b=0.0), dict(f=0.0)], > > [dict(a=0.0, b=1.0), dict(f=0.0)], > > [dict(a=0.0, b=0.0), dict(f=0.0)], > > [dict(a=0.0, b=0.0), dict(f=1.0)], > > ] > > net.setInputsAndTargets(patterns) > > > > # set learning parameters > > net.setEpsilon(0.5) > > net.setTolerance(0.2) > > net.setReportRate(1) > > > > # learn > > net.train() > > > >>>> > > Conx, version 1.229 (regular speed) > > Conx using seed: 1164933601.75 > > Traceback (most recent call last): > > File "C:\Documents and Settings\TEMP\Desktop\nntest.py", line 37, in ? > > net.train() > > File "C:\Program > > Files\Python24\lib\site-packages\pyrobot\brain\conx.py", line 1685, in > > train > > (tssErr, totalCorrect, totalCount, totalPCorrect) = self.sweep() > > File "C:\Program > > Files\Python24\lib\site-packages\pyrobot\brain\conx.py", line 1820, in > > sweep > > (error, correct, total, pcorrect) = self.step( **datum ) > > File "C:\Program > > Files\Python24\lib\site-packages\pyrobot\brain\conx.py", line 1752, in > > step > > self.propagate(**args) > > File "C:\Program > > Files\Python24\lib\site-packages\pyrobot\brain\conx.py", line 1964, in > > propagate > > self.copyActivations(layer, args[key]) > > File "C:\Program > > Files\Python24\lib\site-packages\pyrobot\brain\conx.py", line 1415, in > > copyActivations > > layer.copyActivations(vector[start:start+layer.size]) > > TypeError: unsubscriptable object > > _______________________________________________ > > Pyro-users mailing list > > Pyro-users@pyrorobotics.org > > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users > > > > > > From chrisspen at gmail.com Thu Nov 30 15:22:01 2006 From: chrisspen at gmail.com (Chris S) Date: Thu Nov 30 15:22:04 2006 Subject: [Pyro-users] Deactivate Conx Inputs? In-Reply-To: <55143.68.34.179.248.1164861814.squirrel@webmail.brynmawr.edu> References: <55143.68.34.179.248.1164861814.squirrel@webmail.brynmawr.edu> Message-ID: Great, that's exactly what I was looking for! Thanks again. Chris On 11/29/06, Douglas S. Blank wrote: > On Wed, November 29, 2006 10:36 pm, Chris S said: > > I'm not sure if this makes any sense, but is it possible to add, > > remove, or deactivate certain input nodes in a Conx neural network > > after it's been trained? > > > > For example, consider a network that takes 3-inputs representing > > colors red, green, and blue. The network has N outputs, each > > indicating whether or not the color arraignment matches a particular > > object. Suppose I've trained this network on a corpus to match r,g,b > > colors to N objects, but now I want to train it on a different corpus > > missing the color red. > > > > I know in this trivial example it would probably be easiest to build > > and train a separate network, but imagine if this example were scaled > > to a larger non-trivial network, one with dozens or hundreds of input > > nodes. In that scenario I've spent a considerable amount of time > > training the network, so I wouldn't want to start from scratch if I > > could help it. > > > > Would it be possible in this case to "turn-off" the red input, and > > train/propagate using only the other two colors, but still have the > > option to "re-activate" the input later to again use the network with > > all three colors? > > Chris, > > Yes, that makes sense and we do things similar quite often. Conx (the > neural network toolkit in Pyro) has two concepts that can help here: > "frozen" weights and layers; and "active" weights and layers. > > You can set any group of weights (a Connection object) or a layer (a Layer > object) so that the weights are "frozen". This just means that the weights > won't change, even if backprop says they should. (Layer objects contain > the bias/threshold weights, so that is what gets frozen there). > > But it sounds like you want the second option. You can set a layer or > weight connection group to either be active or not. If a layer/weight > group is not active (set equal to 0) then it won't participate in forward > propagation of activation, nor will it be involved with backprop of error > and changing of weights. > > To make sure you get the right effect, you can step through the network, > watching what changes, like this: > > % python > >>> from pyrobot.brain.conx import * > Conx, version 1.233 (regular speed) > >>> net = Network() > Conx using seed: 1164951718.93 > >>> net.addLayers(2, 3, 1) > >>> net.interactive = 1 > >>> net.step(input = [0, 0], output = [0]) > Display network 'Backprop Network': > ============================= > Layer 'output': (Kind: Output, Size: 1, Active: 1, Frozen: 0) > Target : 0.00 > Activation: 0.52 > ============================= > Layer 'hidden': (Kind: Hidden, Size: 3, Active: 1, Frozen: 0) > Activation: 0.50 0.48 0.50 > ============================= > Layer 'input': (Kind: Input, Size: 2, Active: 1, Frozen: 0) > Activation: 0.00 0.00 > >>> net.step(input = [0, 0], output = [0]) > > In the network display you can see which layers are active and frozen. > > You can only turn entire layers off/on (actually a "bank" since you can > have these groups next to each other, rather than being technically > "layered"). However, you can have layers of single units. > > Hope that helps, > > -Doug > > > Regards, > > Chris > > _______________________________________________ > > Pyro-users mailing list > > Pyro-users@pyrorobotics.org > > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users > > > > > -- > Douglas S. Blank > Associate Professor, Bryn Mawr College > http://cs.brynmawr.edu/~dblank/ > Office: 610 526 601 > > From bthom at cs.hmc.edu Thu Nov 30 20:59:01 2006 From: bthom at cs.hmc.edu (belinda thom) Date: Thu Nov 30 20:59:07 2006 Subject: [Pyro-users] path question Message-ID: <5C81CFFA-4BB6-4BC1-A282-14AC32FCC088@cs.hmc.edu> Hi, There is a discussion of how to "use pyro from w/in python" that I'd like to pursue for programming non-robotic ML-experiments: http://emergent.brynmawr.edu/emergent/PyroFromPython? action=highlight&value=pyro+from+python However, I'm uncertain how I should modify my Python environment to be able to find things like: from pyrobot.brain.conex import Network. I'd like to have the ability to start python from anywhere and have it have access to Pyro's modules. Perhaps the PYTHONPATH env variable could be used. I'm not sure what modules in the pyro distribution would need to be added (or how to add them). Advice? Thanks, --b From dblank at brynmawr.edu Thu Nov 30 22:23:19 2006 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Thu Nov 30 22:23:13 2006 Subject: [Pyro-users] path question In-Reply-To: <5C81CFFA-4BB6-4BC1-A282-14AC32FCC088@cs.hmc.edu> References: <5C81CFFA-4BB6-4BC1-A282-14AC32FCC088@cs.hmc.edu> Message-ID: <48801.68.34.179.248.1164943399.squirrel@webmail.brynmawr.edu> On Thu, November 30, 2006 8:59 pm, belinda thom said: > Hi, > > There is a discussion of how to "use pyro from w/in python" that I'd > like to pursue for programming non-robotic ML-experiments: > > http://emergent.brynmawr.edu/emergent/PyroFromPython? > action=highlight&value=pyro+from+python > > However, I'm uncertain how I should modify my Python environment to > be able to find things like: > > from pyrobot.brain.conex import Network. > > I'd like to have the ability to start python from anywhere and have > it have access to Pyro's modules. Perhaps the PYTHONPATH env variable > could be used. I'm not sure what modules in the pyro distribution > would need to be added (or how to add them). Most of Pyro just depends on the normal Python importing mechanism: To import a module, Python looks: 1. in the installed location, usually someplace like /usr/local/python24/site-packages/ You can, of course, put the pyrobot directory there, and you'll be fine. Or: 2. in the current directory. You can have the pyrobot dir in the current dir. (This method may be going away in future versions of Python) Or: 3. in the PYTHONPATH env variable. This can be a list of places where you have your modules sprinkled throughout. In addition to the path, there are a few Pyro modules that need to find some specific files in the pyrobot dir. To allow Pyro to find itself, you just need to define the env variable PYROBOT. For example, if you have pyrobot in your home directory you could do this in bash: export PYTHONPATH=$PYTHONPATH:/home/yourid export PYROBOT=/home/yourid/pyrobot One other tidbit: don't rename the "pyrobot" directory to something else; somewhere it assumes that it is really called "pyrobot". Follow these hints, and you should never have a problem. :) -Doug > Advice? > > Thanks, > --b > _______________________________________________ > Pyro-users mailing list > Pyro-users@pyrorobotics.org > http://emergent.brynmawr.edu/mailman/listinfo/pyro-users > -- Douglas S. Blank Associate Professor, Bryn Mawr College http://cs.brynmawr.edu/~dblank/ Office: 610 526 601