|
From: fly r. <roa...@ho...> - 2005-08-18 23:47:04
|
Hi all,
I am sorry to send two more repearted messages to the server (e.g.
"questions about using java code with simulator" and "how to use the
simulator with java code"). Becasue i sent this thread the day before
yesterday, but couldn't see any new one from the mailing list. So im so fool
to send two more. Could the administrator cancel the two more ones please?
and i have one more question. when i ran the code as follow:
PlayerClient player = new PlayerClient("localhost",6665);
PositionInterface post = player.requestInterfacePosition(0,
'r'); //a, r or w
SimulationInterface simulation =
player.requestInterfaceSimulation(0, 'r');
player.runThreaded(-1, -1);
//now loop this stuff...
player.readAll();
//update the global data so every behaviour can access it
simulation.set2DPose("pioneer", 1000, 1000, 0);
simulation.get2DPose("pioneer");
int currentX = simulation.getSimulationPose2D().getX();
int currentY = simulation.getSimulationPose2D().getY();
int currentYaw = simulation.getSimulationPose2D().getTheta();
System.out.println("Position (" + currentX + "/"+ currentY + ")
Angle " +
"is " + currentYaw + " ");
and the result is like this:
[PlayerClient] : Got response for device 4(stage) with access: r
[PlayerClient] : Got response for device 31(stage) with access: r
Exception in thread "main" java.lang.NullPointerException
at robotsimulation.Test1.main(Test1.java:36)
[Simulation] : Handling NAR of size = 0
it seems the currentX, Y, Yaw don't get any return value from
getSimulationPose2D(). but i want to get the value of pose of the robot in
the simulator. any one get ideas?
thanks very much
Jun
_________________________________________________________________
Be the first to hear what's new at MSN - sign up to our free newsletters!
http://www.msn.co.uk/newsletters
|