Hi all,

This is my first try to send email to the mailing list.
I have been searching the archive regarding my problem for a while but have not find any thing related to my problem.

I wanted to use SetPose2d to set robot's position to a certain position I desire. I included SimulationProxy to my cpp code:
parse_args(argc,argv);     
PlayerClient            robot(gHostname, port);
Position2dProxy        pp(&robot,gIndex);
SonarProxy            ir(&robot,gIndex);
SimulationProxy        sp(&robot,gIndex);

This one cpp code was intended to use to run multiple robot model through the use of calling the robot's port, ./code -p 6665, ./code -p 6666, etc....
After reading the mailing-list archive I finally udnerstand how to use it:
sp.SetPose2d( (char *)string("robot1").c_str(),x,y, (o- DTOR(90)));
pp.SetSpeed(SPEED/2,0);

in which "robot1" refers to the robot's name defined in the cfg file.
I have this .cfg file, it's a standard config file which listed 4 robot models:

cfg start--------------------------------------------------
driver
(
        name "stage"
        provides ["simulation:0"]
        plugin "libstageplugin"
        worldfile "AMiR.world"
)
driver
(
        name "stage"
        provides ["map:0"]
        model "cave"
)
driver(
        name "stage"
        provides ["position2d:0" "sonar:0"]
        model "robot1"
)
driver(
        name "stage"
        provides ["6666:position2d:0" "6666:sonar:0"]
        model "robot2"
)
driver(
        name "stage"
        provides ["6667:position2d:0" "6667:sonar:0"]
        model "robot3"
)
driver(
        name "stage"
        provides ["6668:position2d:0" "6668:sonar:0"]
        model "robot4"
)

cfg stop---------------------------------------------------

My question is: how should I call the robot's name without typing it one-by-one.
Because I want to make the cpp code 'universal'.
So that if I run each robot by calling its port number, for example port 6668 belongs to robot3
the function SetPose2d will reposition robot model "robot3", etc.

Hence I don't have to retype this part of the code
(char *)string("robot3").c_str()

It is almost like this:
PlayerClient            robot(gHostname, port);

which I think a universal/general way to use one cpp file to run several robot, instead of
PlayerClient            robot(localhost, 6664);

I hope I made myself clear enough because I'm not English :)
Thank you very much.
--

--------------------------------------------------------------------------------
                        .:. ABQORI AULA .:.
       .:. Intelligent System & Robotic Laboratory .:.
      .:. Smart Technology & Robotic Engineering .:.
           .:. Institute of Advanced Technology .:.          
.:. Registered Linux User #483621 Machine #394322 .:.
--------------------------------------------------------------------------------
Skype ID: abqorian
http://www.abqorian.co.cc
http://abqorian.blog.com
http://twitter.com/abqoriaula
http://www.facebook.com/abe.abqorian