## Re: [Playerstage-users] DISTANCE covered by each robot?

 Re: [Playerstage-users] DISTANCE covered by each robot? From: Giulio Zecca - 2008-04-29 20:23:04 ```Yes that was the idea. Anyway, it has already been answered by Kevin Barry on Wed, 23 Apr 2008 :D I finally put the function in the main loop, the result is not so accurate, due to sleeps and blocking functions, but it still does the trick for now. I will treat it in a different thread when I'll have some time to spend on it ;) Thanks On Tue, 2008-04-29 at 21:46 +0800, Edward Rankin wrote: > That only gives you the linear distance from the starting point. > > Giulio is asking for accumulated distance which is has to be computed > cumulatively. What you want to do is to pull the current x/y of the > robot at regular intervals use the below formula to find the distance > travelled since the last time you obtained the x/y and add it to the > distance already computed in past intervals. > > Regards, > > Edward > > Sohaib Rashid wrote: > > Giulio, > > > > distance=sqrt { (y_final-y_initial)*(y_final-y_initial) + > > (i_final-i_initial)*(i_final-i_initial) } > > > > the above formula tells you the actual distance that you're robot > > has covered from the starting/initial point > > to the final/destination point. > > > > if you also want the theta of orientation then > > > > theta=atan { (y_final-y_initial) / (i_final-i_initial) } > > > > go to cplusplus.com for details on atan and atan2 which is actually > > theta inverse. > > > > Hope this helps! > > > > > > > > > > On Tue, Apr 29, 2008 at 5:39 PM, Richard Vaughan > > wrote: > > There isn't one. You'll need to do the geometry. > > > > Richard/ > > > > On Wed, Apr 23, 2008 at 7:55 PM, Giulio Zecca > > wrote: > > > Thanks for the answer, but that function only prints: > > > xpos ypos theta speed sidespeed turn > > stall > > > > > > I need instead a function to show how many meters the > > robot covered up > > > to the time of the call, which, of course, is quite > > different from the > > > mere linear distance. > > > i.e. when the robot reaches its target, my code will > > print both the > > > shortest path and the real distance made by the robot. > > > > > > So, is there a function to show the accumulated distance? > > > Or do I have to write one? (in that case, any hint will > > be appreciated) > > > > > > Thanks > > > > > > > > > On Mon, 2008-04-14 at 22:53 +0500, Sohaib Rashid wrote: > > > > you can display the odometry at any time by the > > following commands > > > > > > > > robot.Read(); > > > > std::cout< > > > > > > > you can reset the odometry by the following commands > > > > > > > > robot.Read(); > > > > pp.ResetOdometry(0,0,0); > > > > > > > > > > > > On Mon, Apr 14, 2008 at 10:17 PM, > > wrote: > > > > Hi, I am using Player 2.0.5 and I would like > > the robots to > > > > print at > > > > certain times of the execution the distance > > covered from the > > > > start. > > > > Is it possible with simulated drivers or > > odometry or > > > > position2dProxy or > > > > other? > > > > > > > > If so, is there a command to reset this > > distance when needed, > > > > during the > > > > execution? > > > > > > > > Thanks > > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------- > > > > This SF.net email is sponsored by the 2008 > > JavaOne(SM) > > > > Conference > > > > Don't miss this year's exciting event. There's > > still time to > > > > save \$100. > > > > Use priority code J8TL2D2. > > > > > > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone > > > > _______________________________________________ > > > > Playerstage-users mailing list > > > > Playerstage-users@... > > > > > > https://lists.sourceforge.net/lists/listinfo/playerstage-users > > > > > > > > > > > > > > > > -- > > > > Sohaib Rashid > > > > Voice +92-321-5876844 > > > > > > ------------------------------------------------------------------------- > > > > This SF.net email is sponsored by the 2008 JavaOne(SM) > > Conference > > > > Don't miss this year's exciting event. There's still > > time to save \$100. > > > > Use priority code J8TL2D2. > > > > > > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone > > > > _______________________________________________ > > Playerstage-users mailing list > > Playerstage-users@... > > https://lists.sourceforge.net/lists/listinfo/playerstage-users > > > > > > > > > > > ------------------------------------------------------------------------- > > > This SF.net email is sponsored by the 2008 JavaOne(SM) > > Conference > > > Don't miss this year's exciting event. There's still time > > to save \$100. > > > Use priority code J8TL2D2. > > > > > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone > > > _______________________________________________ > > > Playerstage-users mailing list > > > Playerstage-users@... > > > > > https://lists.sourceforge.net/lists/listinfo/playerstage-users > > > > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by the 2008 JavaOne(SM) > > Conference > > Don't miss this year's exciting event. There's still time to > > save \$100. > > Use priority code J8TL2D2. > > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone > > _______________________________________________ > > Playerstage-users mailing list > > Playerstage-users@... > > https://lists.sourceforge.net/lists/listinfo/playerstage-users > > > > > > > > -- > > Sohaib Rashid > > Voice +92-321-5876844 > > > > ____________________________________________________________________ > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > > Don't miss this year's exciting event. There's still time to save \$100. > > Use priority code J8TL2D2. > > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone > > > > ____________________________________________________________________ > > > > _______________________________________________ > > Playerstage-users mailing list > > Playerstage-users@... > > https://lists.sourceforge.net/lists/listinfo/playerstage-users > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > Don't miss this year's exciting event. There's still time to save \$100. > Use priority code J8TL2D2. > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone > _______________________________________________ Playerstage-users mailing list Playerstage-users@... https://lists.sourceforge.net/lists/listinfo/playerstage-users ```