This 2 days, I could not understand about the player/stage. javaclient2 is one of the client tool for player.
Official site (player/stage)
http://playerstage.sourceforge.net/wiki/Main_Page
Official page(javaclient2 for player/stgage)
http://java-player.sourceforge.net/index.php
The following url is community for javaclient2 for player/stage.
http://www.nabble.com/Javaclient-for-Player-Stage-f3213.html
I try to write sample program same behavior as laserobstacleavoid.cc.
========================================================================
import javaclient2.*;
import javaclient2.structures.PlayerConstants;
import javaclient2.structures.laser.*;
public class TestClassBasic
{
private String hName = "localhost";
private int port = 6664;
private double lLimit = 2;
public TestClassBasic()
{
PlayerClient robot = new PlayerClient(hName, port);
Position2DInterface p2d = robot.requestInterfacePosition2D(1, PlayerConstants.PLAYER_OPEN_MODE);
LaserInterface laser = robot.requestInterfaceLaser(0, PlayerConstants.PLAYER_OPEN_MODE);
PlayerLaserData pld = null;
double speed = 3;
double turn = 0;
int minCounter = 0;
while(true)
{
double newspeed = 0;
double newturnrate = 0;
double minR = 1e9;
double minL = 1e9;
robot.readAll();
pld = laser.getData();
for(int i=0; i pld.getRanges()[i])
{
minR = pld.getRanges()[i];
}
}
for(int i=pld.getIntensity_count()/2; i< minl =" pld.getRanges()[i];" l =" (1e5" r =" (1e5"> 100)
l = 100;
if(r > 100)
r = 100;
newspeed = (r+l)/1e3;
newturnrate = (r-l);
newturnrate = limit(newturnrate);
newturnrate = Math.toRadians(newturnrate);
p2d.setSpeed((float)newspeed, (float)newturnrate);
}// while
}
private double limit(double newturnrate)
{
if(newturnrate < -40) { return(-40); } else if(newturnrate > 40)
{
return(40);
}
return(newturnrate);
}
public static void main(String[] args)
{
TestClassBasic tcb = new TestClassBasic();
}
}
Official site (player/stage)
http://playerstage.sourceforge.net/wiki/Main_Page
Official page(javaclient2 for player/stgage)
http://java-player.sourceforge.net/index.php
The following url is community for javaclient2 for player/stage.
http://www.nabble.com/Javaclient-for-Player-Stage-f3213.html
I try to write sample program same behavior as laserobstacleavoid.cc.
========================================================================
import javaclient2.*;
import javaclient2.structures.PlayerConstants;
import javaclient2.structures.laser.*;
public class TestClassBasic
{
private String hName = "localhost";
private int port = 6664;
private double lLimit = 2;
public TestClassBasic()
{
PlayerClient robot = new PlayerClient(hName, port);
Position2DInterface p2d = robot.requestInterfacePosition2D(1, PlayerConstants.PLAYER_OPEN_MODE);
LaserInterface laser = robot.requestInterfaceLaser(0, PlayerConstants.PLAYER_OPEN_MODE);
PlayerLaserData pld = null;
double speed = 3;
double turn = 0;
int minCounter = 0;
while(true)
{
double newspeed = 0;
double newturnrate = 0;
double minR = 1e9;
double minL = 1e9;
robot.readAll();
pld = laser.getData();
for(int i=0; i
{
minR = pld.getRanges()[i];
}
}
for(int i=pld.getIntensity_count()/2; i
l = 100;
if(r > 100)
r = 100;
newspeed = (r+l)/1e3;
newturnrate = (r-l);
newturnrate = limit(newturnrate);
newturnrate = Math.toRadians(newturnrate);
p2d.setSpeed((float)newspeed, (float)newturnrate);
}// while
}
private double limit(double newturnrate)
{
if(newturnrate < -40) { return(-40); } else if(newturnrate > 40)
{
return(40);
}
return(newturnrate);
}
public static void main(String[] args)
{
TestClassBasic tcb = new TestClassBasic();
}
}
Comments
bren [at] juanantonio [dot] info
Cheers
Thank you for your comment.
What kind of problem did you see?
I think some of other person also have same problem. So I would like to ask here about it, if you can do it. Is it possible?