reset_positions service - nothing happens

asked 2017-05-12 08:37:41 -0600

Milow gravatar image

I'm trying to reset the position of my turtlebot after a collision against a wall, but nothing happen.

ros::Subscriber sub;
ros::ServiceClient client;

void subscriberCallback(const sensor_msgs::LaserScan::ConstPtr& msg);
void resetPosition();

int main(int argc, char** argv){
    ros::init(argc, argv, "robot_node");
    ros::NodeHandle n;
    client = n.serviceClient<std_srvs::Empty>("/reset_positions");
    sub = n.subscribe("scan", 1000, subscriberCallback);
    std_srvs::Empty reset_srv;
    client.call(reset_srv);
}

void subscriberCallback(const sensor_msgs::LaserScan::ConstPtr& msg){
    //Handle laser data, watch if turtlebot is to close to a wall
    resetPosition(); 
}

void resetPosition(){
    std_srvs::Empty reset_srv;
    client.call(reset_srv);
}

I have no error, nor another feedback. It seems to ignore the call. I'm working on Stage 4.1.1.

Something wrong here ?

edit retag flag offensive close merge delete