ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

Put line breaks "\n" (or std::endl https://stackoverflow.com/questions/213907/c-stdendl-vs-n) at the end of your std::cout calls.

You probably also want to dereference msg otherwise you'll only get a point location in hexadecimal:

std::cout << *msg << "\n";

ROS_INFO_STREAM also would work and ends up in a log file among other features, and doesn't need a linebreak.

Put line breaks "\n" (or std::endl std::endl https://stackoverflow.com/questions/213907/c-stdendl-vs-n) at the end of your std::cout calls.

You probably also want to dereference msg otherwise you'll only get a point location in hexadecimal:

std::cout << *msg << "\n";

ROS_INFO_STREAM also would work and ends up in a log file among other features, and doesn't need a linebreak.

Put line breaks "\n" (or std::endl https://stackoverflow.com/questions/213907/c-stdendl-vs-n) at the end of your std::cout calls.

You probably also want to dereference msg otherwise you'll only get a point location in hexadecimal:

std::cout << *msg << "\n";

ROS_INFO_STREAM also would work and ends up in a log file among other features, and doesn't need a linebreak.

Additionally, comparing a c_str() to a string isn't what you want, just omit it and do a string to string comparison: https://stackoverflow.com/questions/23707392/value-equality-of-c-str-string-vs-c-str-c-str

Put line breaks "\n" (or std::endl https://stackoverflow.com/questions/213907/c-stdendl-vs-n) at the end of your std::cout calls.

You probably also want to dereference msg otherwise you'll only get a point location in hexadecimal:

std::cout << *msg << "\n";

ROS_INFO_STREAM also would work and ends up in a log file among other features, and doesn't need a linebreak.

Additionally, comparing a char* c_str() to a string char* isn't what you want, just omit it c_str() and do a string to string comparison: https://stackoverflow.com/questions/23707392/value-equality-of-c-str-string-vs-c-str-c-str

Put line breaks "\n" (or std::endl https://stackoverflow.com/questions/213907/c-stdendl-vs-n) at the end of your std::cout calls.

You probably also want to dereference msg otherwise you'll only get a point location in hexadecimal:

std::cout << *msg << "\n";

ROS_INFO_STREAM also would work and ends up in a log file among other features, and doesn't need a linebreak.

Additionally, comparing a char* c_str() to a char* isn't what you want, just omit c_str() and do a string to string (automatically created from the char* "yes") comparison: https://stackoverflow.com/questions/23707392/value-equality-of-c-str-string-vs-c-str-c-str