ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
If you are using move_base to autonomously drive to a location, then using the service provides a return message when it reaches the goal. Otherwise, if you want to use the bool method, it is the same as any other callback. Make a global variable to hold some flag, called reached below, and populate it with the data value from the message.
bool reached = false;
void positionreached(const std_msgs::Bool::ConstPtr& Reached)
{
reached = Reached->data;
}
2 | No.2 Revision |
If you are using move_base to autonomously drive to a location, then using the service provides a return message when it reaches the goal. Otherwise, if you want to use the bool method, it is the same as any other callback. Make a global variable to hold some flag, called reached below, and populate it with the data value from the message.
bool reached = false;
void positionreached(const std_msgs::Bool::ConstPtr& Reached)
{
reached = Reached->data;
}
[EDIT]
Right, Arduino. Try:
void positionreached(const std_msgs::Bool Reached)
{
reached = Reached.data;
}
Also, reached only needs to be bool, not std_msgs::Bool.