From: Robert L. <rj...@ab...> - 2007-05-18 14:08:51
|
Dear all, This is probably quite an easy issue to solve but being quite new to using Player has me a bit stumped. I am trying to get hold of the odometry information from a robot as I will be using this in a robot learning task. I have tried writing a simple example to print the pose to standard out which I have included below. I think it is probably that the data is not being refreshed but I am not sure why. I was trying this using Player 2.0.4 running on a Pioneer robot, but also tried this locally using everything.cfg that comes with stage. Thanks in advance Rob Here is the code: #include <iostream> #include <libplayerc++/playerc++.h> using namespace PlayerCc; using namespace std; int main(int argc, char *argv[]){ PlayerClient robot("localhost"); Position2dProxy pp(&robot,0); //have tried this with PULL too robot.SetDataMode(PLAYERC_DATAMODE_PUSH); //robot.SetReplaceRule(true, PLAYER_MSGTYPE_DATA, -1, 1); pp.SetMotorEnable(true) ; double turnrate = 0.5, speed = 0.4; pp.RequestGeom (); pp.ResetOdometry (); pp.SetOdometry(0.0, 0.0,0.0); int i=0; while(i<100){ robot.Read(); cout << pp.GetPose() << endl; pp.SetSpeed(speed, turnrate); i++; } } ------------------------------------ Robert Lloyd - PhD Student Room B45 Department of Computer Science Penglais Campus Aberystwyth Ceredigion Wales, UK SY23 3DB rj...@ab... |