read raw_image compressed uint8[] data
Hello everybody! I'm trying to read the datas of the "sensor_msgs/CompressedImage" message in a c++ program. Therefore I want to read the uint8[] data array. While using the callback function, nothing is happening (e.g. using ROS_INFO, when there is activity). When I'm watching the /image_raw/compressed topic, the data array is infinit. That's why I can't predefine an arraysize. Is there any possibility to get the data into a c++ code to read it separatly? Thanks
// ROS ///////////////////////////////////////////
ros::init(argc, argv, "talker_camera_eye");
ROS_INFO("%s", "start");
ros::NodeHandle n;
ros::Subscriber translation_sub = n.subscribe("wc_backdrive/camera_eye/image_raw/compressed", 1000, translateCallback);
ros::Publisher translation_pub = n.advertise<sensor_msgs::CompressedImage>("compressed_image", 1000);
while (ros::ok())
{
translation_pub.publish(testmsg);
ros::spinOnce();
}
return 0;
}
//
void translateCallback(const sensor_msgs::CompressedImage::ConstPtr& msg)
{testmsg.data =msg->data;
//perturbedmsg.data = testmsg.data;
ROS_INFO("%s", msg->data.size());ROS_INFO( "test");
for (int i=0; i<msg->data.size();i++){
ROS_INFO( "test");
}
You should probably post the code of your node, at least the one of the subscriber setup and the callback.