Nevermind, I have figured it out.
I was using the cfg file with device index to test the other method.
I forgot to change the cfg file back to use different port number :)
Hi Rich, thanks for your ideas. I was able to figure out your second idea. That was a great idea to capture the robot's model name.
I didn't notice that indices could be used to represent different device.
But for your first suggestion, I failed. I tried your first suggestion, I came up with these lines:
PlayerClient stage(gHostname, 6665);
PlayerClient robot(gHostname, port);
SonarProxy ir(&robot, gIndex);
I then use the port number argument to run the robot. But, it still only run on robot port 6665, not on another robot (port) with the following error message:
playerc error : connect call on [localhost:6666] failed with error [111:Connection refused]I keep the previous switch-case to catch the robot's model name:
terminate called after throwing an instance of 'PlayerCc::PlayerError'
AbortedWhat's wrong with these lines?
case 6666: robot = "robot2"; break;
case 6667: robot = "robot3"; break;
default: robot = "robot1";
Only for curiosity:
How is this "create two PlayerClient thing" actually work? I knew how to connect them, but then that's it. I don't know what next.
I've found a lot of "create two PlayerClient thing" suggestions for different problems within this mailing list. But, none has actually replied that they managed to do it.
Anyway, thanks again.