Trouble logging uint8 message fields
#include <ros/ros.h>
#include "turtlesim/Color.h"
#include <iomanip>
void apple(const turtlesim::Color& msg)
{
ROS_INFO_STREAM(std::setprecision ( 0 )
<< " color=(" << msg.r << " , " << msg.b << " , " << msg.g << " ) ");
}
int main(int argc, char **argv)
{
ros::init(argc, argv, "pose_subscriber");
ros::NodeHandle n;
ros::Subscriber pose_sub = n.subscribe("/turtle1/color_sensor", 10, &apple);
ros::spin();
return 0;
}
why do my output so strange? my output is like a lot of this:
[ INFO] [1582904454.849200284]: color=(E , ? , V )
can someone tell me where do i did wrong?thanks very much!
I provided an answer, but I also re-tagged and edited your question title. The original title was not descriptive enough. In the future, please try to follow the Support guidelines to get the best possible help: http://wiki.ros.org/Support