when i comple this code it says,
wander.cc:28: error: 'Wander' was not declared in this scope
I got this code from Jenny Owen's tuorial on Player/Stage. In that one th Wander function is not decalred. Could you please tell me why I am getting this error and how to declare the function.
following is my code
#include <stdio.h>
#include <unistd.h>
#include <time.h>
#include <libplayerc++/playerc++.h>
int main(int argc, char *argv[])
{
using namespace PlayerCc;
// double Wander (forwardSpeed, turnSpeed);
PlayerClient robot("localhost", 6665);
Position2dProxy p2dProxy(&robot, 0);
double forwardSpeed, turnSpeed;
srand(time(NULL));
p2dProxy.SetMotorEnable(1);
p2dProxy.RequestGeom();
// robot.Read();
while(true)
{
robot.Read();
printf("wandering\n");
Wander( &forwardSpeed, &turnSpeed);
p2dProxy.SetSpeed(forwardSpeed, dtor(turnSpeed));
sleep(1);
}
}
void Wander(double *forwardSpeed, double *turnSpeed)
{
int maxSpeed = 1;
int maxTurn = 90;
double fspeed, tspeed;
fspeed = rand()%11;
fspeed = (fspeed/10*maxSpeed);
tspeed = rand()%(2*maxTurn);
tspeed = tspeed - maxTurn;
*forwardSpeed = fspeed;
*turnSpeed = tspeed;
}