From: Radu B. R. <ru...@cs...> - 2005-11-16 14:03:44
|
Hello, Sorry for answering this late. Here are some explanations on how to use the Controllers in the javaclient.extra package, as well as how to use the PlannerInterface: 1) Controllers 1.a) create a PositionInterface static PositionInterface pi =3D robot.requestInterfacePosition (0, 'a'); 1.b) create a HeadingControl and/or a PositionControl static HeadingControl hc =3D new HeadingControl (pi); static PositionControl pc =3D new PositionControl (pi); 1.c) use [HeadingControl].setDiffHeading (X) for differential heading eg. hc.setDiffHeading (10); 1.c) ...or... use [HeadingControl].setHeading (X) for absolute heading (0..360) eg. hc.setDiffHeading (240); 1.c) ...or... use [PositionControl].moveRobot (X) for moving the robot forward for a specified distance eg. pc.moveRobot (1000); 1.d) additionally you can use the {P,PI,PD,PID}Controllers directly like this: PController pid =3D new PController (1); pid.setGoal (90); while (true) { double now =3D pi.getYaw (); if (now < 0) now +=3D 360; try { Thread.sleep (100); } catch (Exception e) {} int command =3D (int)pid.getCommand (now); pi.setSpeed (0, command); System.out.println (now + " / " + command); } For any other information check the Java API documentation. Also please note, that the above Java classes will only be available in the CVS. We are planning to release a new version of Javaclient soon (Maxim has some suggestion for upgrading some stuff), and then the next major release will be done after Player 2.0 stabilizes. 2) Planning/Localization/VFH 2.a) create a Localization and a Planner interface LocalizeInterface locali =3D robot.requestInterfaceLocalize (0, 'r'); PlannerInterface plani =3D robot.requestInterfacePlanner (0, 'a'); 2.b) define and set an initial pose for the localization (values from playernav) long cov[][] =3D {{250, 0, 0}, {0, 250, 0}, {0, 0, new Double ((Math.PI/6.0)*(Math.PI/6.0) * 180 / Math.PI * 3600 * 180 / Math.PI * 3600).longValue()}}; int mean[] =3D { 0, 0, 0 }; locali.setPose (mean, cov); 2.c) set the goal on the PlannerInterface plani.setGoal (2000, -2000, 0); 2.d) for fun, aditionally print the number of hypotheses, the groundtruth location as well as the planner location in a loop while (true) { System.out.println (locali.getHypothCount ()); System.out.println ("Ground truth: is [ " + posi.getX () + ", " + posi.getY () + ", " + posi.getYaw () + "]"); System.out.println ("Current location is: [" + plani.getPx () + ", " + plani.getPy () + ", " + plani.getPa () + "]"); try { Thread.sleep (100); } catch (Exception e) { } } I hope this works. Cheers, Radu. =C0=D7 =B1=F3 wrote: > Dear, > Radu. > First,thanks for your help.Maybe I can provide some examples for > beginners who never used javaclient of p/s/g. I have written some easy > java programs which use postioninterface,sonarinterface or > laserinterface .And all of them can work well with the > player-1.6.4/stage-1.6.2 . But I don't know how to use the other > interfaces or drivers now.Such as, PIDController,vfh,plannerinterface..= . > If you can help me ,I will try my best to write the (good) tutorial. > :) Yours sincerely, > Thunder > 2005-11-10 > /* The Wuhan University of Technology,China */ --=20 | Radu Bogdan Rusu | http://www9.cs.tum.edu/people/rusu | http://rbrusu.c= om | Intelligent Autonomous Systems Group | Computer Science Department IX | Technische Universitaet Muenchen | Munich, Bavaria, Germany |