ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
your code compares the pointers of the strings. These are different, because those are two unique strings. If you want to compare the content of the string, use https://www.cplusplus.com/reference/string/string/compare/ This would be in your code ...
if (commands.data.compare(scan.data) == 0)
{
scanning(pos, flag, minAngle, maxAngle, myservo, servoPos, pub_pos, scansNum, range_msg, pub_range);
nh.loginfo("Scanning...");
}
etc