From: Rich M. <jp...@gm...> - 2011-07-19 14:36:44
|
> -----Original Message----- > From: Simone Gaiera [mailto:sim...@gm...] > Sent: Tuesday, July 19, 2011 8:37 AM > To: pla...@li... > Subject: [Playerstage-users] Problem with setting robot's position > > > Hi I'm using the lastest version of Player under ubuntu, for my project > on > robot Roomba. > I have a map of a real world in which the robot moves so when the robot > bump > in the world I know where it is and I wanna set the correctly position. > I > read the map with opencv so I know all the coordinates of all the wall. > I know that there are SetOdometry(x,y,t) but it doesn't work and I read > all > the topic in this forum but I didn't read a solution. > > Is correctly use set position in the code like that? > > pp.SetOdometry(1,1,0); > roomba500.Read(); > x=pp.GetXPos(); > y=pp.GetYPos(); > t=pp.GetYaw(); > printf("\n odom x:%f y:%f t:%f \n",x,y,t); > > All the other function works correctly but setodometry doesn't work. > With all coordinates the printf print the old coordinates that I had > before > the setodometry. > There is something wrong in my code or is not that the way to do wat i > want? > > Thanks for you time! > SetOdometry()[1] doesn't affect any movement, all it does is set the (x,y,angle) of the position2d interface's odometry counters to the value you assign at that point in space. For example, if your robot is standing still, if you call GetXPos and a value of 10 is returned, then you call SetOdometry(1,1,0), the next time you call GetXPos(), the value that comes back should be the x position you just assigned (1). It adjusts the frame of reference, but does not cause the robot to move. If you want to move your robot, you'll have to send it velocity commands. You can do this directly by calling SetSpeed(), or you can use a planner driver like VFH, nd, or goto that will translate a desired (x,y,angle) point into velocity commands that get the robot to that point. You'll need a planner driver to set positions directly, as the roomba's position2d interface only understands the velocity commands that SetSpeed uses[2]. Rich [1] http://playerstage.sourceforge.net/doc/Player-svn/player/classPlayerCc_1_1Po sition2dProxy.html [2] http://playerstage.sourceforge.net/doc/Player-svn/player/group__driver__room ba.html |