From: John O. <joh...@gm...> - 2007-04-24 14:14:28
|
Moving the robot precisely the same distance every time may be a bit difficult since the code is dependant upon the timing of responses. Possibly if you set the update of the simulation to have a very long step time then you can avoid any timing dependant issues. If you are not worried about localization then using the position2d interface with gps odometry is probably easiest. As for the GUI it could be nice to have some sort of swing display that shows data from the robot as an example. A Java version of playerv would be quite a nice example to show, although since playerv does already exist in C it may be a good idea to try something new. Thanks John Faruq wrote: > > Hi, > > Thanks John for you reply. > > Actually my purpose is to demonstrate some scenarios using an intelligent > planner and simulating real-life is not necessary. I need to integrate > many other components with player including a GUI. Let me share some of my > codes as it can be helpful for others ( and also for myself if someone > corrects me :)) > > I am trying to move a robot horizontally (X direction) about 1 meter using > BlobfinderExample > After connecting to robot I code it like this: > > while(!posi.isDataReady()); > /* Determine current pose: default X = -1.0, Y = -3.0, > Yaw = 0.0 */ > currentPose = posi.getData().getPos(); > // print initial pose > System.out.println("Initial X:" + currentPose.getPx() + " Y: " + > currentPose.getPy() > + " Yaw: " + currentPose.getPa()); > > /* Go 1 m horizontally Target: X= 0.0 */ > float target = 1.00f; > desiredPose.setPx(currentPose.getPx() + target); // set desired pose > > while(currentPose.getPx() < desiredPose.getPx()) > { > > posi.setSpeed(0.40f, 0.0f); // move ahead > currentPose = posi.getData().getPos(); // take pose reading > //System.out.println("current pose:" + currentPose.getPx()); > } > > /* Stop */ > posi.setSpeed(0.00f, 0.0f); //stop in this way? > > System.out.println("WJ-Pre X:" + > currentPose.getPx() + " Y: " + currentPose.getPy() > + " Yaw: " + currentPose.getPa()); > > So, I'm getting different results in different run. If you see the output > for current pose, it is different in different run (floating point > problem, I guess ). Anyway, I don't need heavy localization methods. But > I'm expecting to move the robot a fixed distance always in the same > manner. > > BTW, I'm thinking to make a GUI panel to control simulation. I wonder if > anyone did this previously. In that case we may add another example in > java-player website. I think it would be interesting to control using GUI > panel. > > My thanks to all Java-player developers for making this nice client > library. > > Best regards, > > Faruq > -- View this message in context: http://www.nabble.com/How-can-I-localize-using-LocalizeInterface-tf3622118.html#a10161808 Sent from the java-player-users mailing list archive at Nabble.com. |