|
From: Marques, H. G <hg...@es...> - 2005-05-09 22:22:42
|
=20
Hi...
=20
I made the changes suggested but i still have the same problem when the =
laserinterface line is uncommented... The robot moves but the position =
printed from the System.out.println doesn't change.
=20
I'm just using the simple.world that comes originally with stage.
=20
Any other suggestion?
=20
import javaclient.*;
public class Hugo {
public static void main(String[] args) {
String hostToConnect =3D args[0];
int portToConnect =3D Integer.parseInt(args[1]);
System.out.println(" Host: "+hostToConnect+" Port: =
"+portToConnect);
PlayerClient robot =3D new =
PlayerClient(hostToConnect,portToConnect);
PositionInterface ppd =3D robot.requestInterfacePosition(0, =
'a');
// LaserInterface lpd =3D robot.requestInterfaceLaser(0, =
'a');
robot.runThreaded(-1, -1);
=20
for(int i =3D 0; ; i++) { =20
robot.readAll(); =20
for(int j =3D 0; j < 100000000; j++){} =20
ppd.setSpeed(100, 0);
System.out.println(ppd.getX() + " " + ppd.getY());
}
}
}
=20
=20
----------------------------------------------------
Hugo Gravato Marques, University of Essex, PhD Student
PHONE: +44 (0)7854917241, England or +351 962482416, Portugal
ADDRESS: University of Essex, Department of Computer Science,
Wivenhoe Park, Colchester Essex, CO4 3SQ, UK
WEB: http://privatewww.essex.ac.uk/~hgmarq/
=20
=20
=20
<http://privatewww.essex.ac.uk/~hgmarq/>=20
________________________________
From: jav...@li... on behalf of Radu =
Bogdan Rusu
Sent: Sat 07/05/2005 18:08
To: jav...@li...
Subject: Re: [Java-player-users] Position and Laser interfaces conflict?
I'm not quite sure what you're experiencing here. The exact same code =
works
with Javaclient 1.6.2e just fine. By the way, one small note:
- try to use the javaclient.jar file or the classes subdirectory and use
"import javaclient.*;" instead of building your code inside the =
javaclient
sources (hence, the need for "package javaclient;"). I now realize the =
need
for some simple examples for our users... We provided the ANT makefile =
and
shell scripts which should build the classes, the jar and the =
documentation,
but we forgot to explain that to our users. :(
So your code works fine with player and stage (CVSed) and Javaclient =
1.6.2e.
What version of player/stage are you using, and how does your =
config/world
file looks like? I'm quite sure this should work with any version, but =
who
knows... nobody is perfect :)
Cheers,
Radu.
On Sat, May 07, 2005 at 05:11:26PM +0100, Hugo Gravato Marques wrote:
>
>
> Hello...
>
> I've tried to make a small java class in order to understand the way =
the
> interaction between the java client, the player and stage works.
> So far I manage to get information about some sensors and move the =
robot
> around... However I found a problem that I don't understand why it
> happens... When I run the code below I have the information about the
> position of the robot updated every step... And that is OK... But when =
I
> uncomment the (apparently innocent) LaserInterface line I stop having =
that
> information updated and it prints always the same position. Can =
someone help
> me please...
>
> Thanks...
> hugo
>
>
> ******************************* CODE **********************
>
> package javaclient;
>
> public class Test {
> =20
> public static void main(String[] args) {
> =20
> String hostToConnect =3D args[0];
> int portToConnect =3D Integer.parseInt(args[1]);
>
> System.out.println(" Host: "+hostToConnect+" Port: =
"+portToConnect);
> =20
> PlayerClient robot =3D new PlayerClient (hostToConnect, =
portToConnect);
> PositionInterface ppd =3D robot.requestInterfacePosition(0, =
'a');
> =20
> // LaserInterface lpd =3D robot.requestInterfaceLaser(0, =
'a');
> robot.runThreaded(-1, -1);
> =20
> for(int i =3D 0; ; i++) {
> robot.readAll();
>=20
> for(int j =3D 0; j < 100000000; j++){}
> =20
> ppd.setSpeed(100, 0);
> System.out.println(ppd.getX() + " " + ppd.getY());
>
> }
> }
> }
>
>
>
> ----------------------------------------------------
> Hugo Gravato Marques, University of Essex, PhD Student
> PHONE: +44 (0)7854917241, England or +351 962482416, Portugal
> ADDRESS: University of Essex, Department of Computer Science,
> Wivenhoe Park, Colchester Essex, CO4 3SQ, UK
> WEB: http://privatewww.essex.ac.uk/~hgmarq/
>
Yours sincerely,
Radu Bogdan Rusu
--
| Radu Bogdan 'veedee' Rusu | http://www.rbrusu.com
| PhD student/teaching assistant
| Robotics Research Group, Technical University of Cluj-Napoca[.ro]
| The optimist sees a task in every problem.
| The pessimist sees a problem in every task.
-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, =
4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=3D20
_______________________________________________
Java-player-users mailing list
Jav...@li...
https://lists.sourceforge.net/lists/listinfo/java-player-users
|