From: Reed H. <re...@mo...> - 2007-01-26 15:06:23
|
You can do loops and also math in a bash shell, so you can use a script like this to start a series of processes connecting to different ports, equivalent to running a series of commands like: controlProgram --port 6665 & controlProgram --port 6666 & controlProgram --port 6667 & ... #!/bin/bash # # runManySeqPorts.sh # Takes two arguments: number of proceses to start, and the starting port, and then a command # e.g. runManySeqPorts.sh 100 6665 yourProgram # n=$1 shift p=$2 shift while test $p -lt $n do $* --port $p & p=$(($p+1)) done Player also has an optional driver that broadcasts availability of a robot using MDNS (what Apple calls either Rendezvous or Bonjour). Then simply starting player can trigger execution of other programs by an mdns monitoring daemon. You need a library called howl to build this optional driver, and I don't know if howl is maintained anymore; it's been replaced by another library called avanti but avanti may remain somewhat compatibly with howl. See the docs for details. Reed David L wrote: > My ultimate goal is to simulate a population of 50-100 robots for the purpose of investigating emergent behavior. Each robot will act only on the basis of the information provided by its own sensors, and the programs controlling each robot will be similar. I want to run a series of trials and in each trial I will change certain parameters of the program controlling each robot. For example each robot will have some blob following behavior and in each trial I want to change what color of blobs each robot follows. > > I have player/stage downloaded and running, have created a world populated by a couple of robots and can control them with a couple of programs. Now as I begin to increase the population of robots, I have the following questions. > > First, what are the advantages/disadvantages of the different ways of controlling multiple robots in a player/stage simulation? For example, should each robot (model) be differentiated from the others merely by using a different index for its various devices or should it have its own port? (if that even makes sense?maybe stage only communicates with player through a single port?) > > Secondly, assuming I write and run 100 separate c++ programs to control each robot individually, what is the best way people have found for getting the simulation started (without typing in 100 commands each time you want to run a simulation)? I am thinking one would use a shell script that would contain the commands for each program. > > And for changing the constants in each program for the purpose of running different trials? I am thinking it should be possible to systematically name each program (e.g. control1, control2,?) and then write a program or shell script taking a 100-tuple as input that would automatically set the constant in the ith program to the ith member of the 100-tuple. Or is there a better way? > > I am new to all of this (player/stage, linux, c++ programming) so I don?t want to reinvent too many wheels. These are questions I thought others (especially those investigating emergent behavior) might have found solutions to. > > Thanks, > > -David LeWine (NYC high school teacher helping some students investigate emergent behavior) > > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Playerstage-users mailing list > Pla...@li... > https://lists.sourceforge.net/lists/listinfo/playerstage-users > -- (Note, while we like to help out where possible, MobileRobots, Inc. does not officially support Player.) |