I forgot to mention, I'm running player v4.0.0 and stage v3.2.2


On Sat, Apr 27, 2013 at 3:33 PM, p s <playerstagequestion@gmail.com> wrote:
Hi Rich,
I would have replied sooner but I wanted to try it again.

Yes I have tried giving it a slower velocity. The line of code looks like this:
pp.GoTo((player_pose2d_t){xDest,yDest,rad},(player_pose2d_t){0.10, 0.0, 0.0});
This did not change the speed of the robot at all.
I also tried it like this :
pp.GoTo((player_pose2d_t){xDest,yDest,rad},0.5);
but that gave me a compile error. 

Any thoughts?


>Have you tried issuing another GoTo(pos, vel) with the same position and >a slower velocity? >Rich



On Wed, Apr 24, 2013 at 8:28 PM, p s <playerstagequestion@gmail.com> wrote:
Hi I'm new to using player stage and am trying to control my simulated
robots speed as it moves between set coordinates using GoTo(). Here is
my code:

// Includes
#include <stdio.h>
#include <string>
#include <iostream>
#include <libplayerc++/playerc++.h>

using namespace PlayerCc;
using namespace std;
 #define DISTANCEDELTATHRESHOLD 0.01
// Initialization


void moveTo(PlayerClient& myRobot, Position2dProxy& pp, double xDest,
double yDest, double rad)
{
    double distanceDelta = 1000;

    myRobot.Read();
    //pp.SetSpeed(2.0, 0.0);
    pp.GoTo((player_pose2d_t){xDest,yDest,rad},(player_pose2d_t){10.0,
10.0, 0});
    sleep(1);
    while(distanceDelta >= DISTANCEDELTATHRESHOLD)
    {

    myRobot.Read();
    double x = pp.GetXPos();
    double y = pp.GetYPos();

    cout << "x :" << x << endl;
    cout << "y :" << y << endl;
    distanceDelta = (xDest - x) * (xDest - x)  + (yDest - y) * (yDest - y);
        cout << distanceDelta << endl;
     sleep(1);
    }
}


int main(int argc, char *argv[])
{
    //Initialize x and y to prevent the code from locking during the
while check in moveTo
    double x = 100;
    double y = 100;
    //make moveSize # of steps
    const int moveSize = 8;
    double move[][moveSize] ={
    {-6,-2,-2,2,2,2,6,8},
    {-4,-4,6,6,5,5,3,3}
    };
    // Connect to the local player process on port 6665
    PlayerClient myRobot("localhost", 6665);

    // Create a position 2d proxy
    Position2dProxy pp(&myRobot, 0);
    pp.RequestGeom();

    for(int i = 0; i < moveSize; i++)
    {
        cout << "Moving to step #: " << i <<endl;
        moveTo(myRobot, pp, move[0][i], move[1][i],0);
    }

// 0 of program
    return 0;
}

And my config file:

# Desc: Player sample configuration file for controlling Stage devices
# Author:  Richard Vaughan
# Date: 1 December 2004

# CVS: $Id: simple.cfg,v 1.35 2008-01-15 01:25:42 rtv Exp $


# load the Stage plugin simulation driver
driver
(
  name "stage"
  provides [ "simulation:0" ]
  plugin "stageplugin"

  # load the named file into the simulator
  worldfile "midterm.world"
)

# Create a Stage driver and attach position2d and laser interfaces
# to the model "r0"
driver
(
  name "stage"
  provides [ "6665:position2d:0" "6665:ranger:0" "6665:ranger:1" ]
  model "r0"
)

driver
(
  name "stage"
  provides [ "6666:position2d:0" "6666:ranger:0" "6666:ranger:1" ]
  model "r1"
)

driver
(
  name "goto"
  provides ["position2d:100" "dio:0"]
  requires ["position2d:0"]
  debug 1
  reactive 1
)

My problem is that in the "GoTo()" I can set the coordinates I desire
my robot to go to but I can't seem to change its speed as it moves
between points. If I try to use the "SetSpeed()" function I can alter
the speed but I can no longer move to a desired coordinate position.
Is there a way to control the speed as the robot moves to a distinct
set of coordinates? I have done a lot of research, read theFAQs,
checked the mailing list. What am I missing?

Thanks!

~Brennan