|
From: Faruq <wri...@ya...> - 2007-04-24 13:02:37
|
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#a10160562
Sent from the java-player-users mailing list archive at Nabble.com.
|