I tried to create a new launch file with 1920x1080 resolution for capture. Here it is, to me it looks good.
#> cat launch/camera_module_v2_1920x1080_30fps_autocapture.launch
<?xml version="1.0"?>
<launch>
<arg name="name" default="raspicam_node" />
<node type="raspicam_node" pkg="raspicam_node" name="$(arg name)" output="screen">
<param name="camera_info_url" value="package://$(arg name)/camera_info/camera_module_v2_1920x1080.yaml"/>
<param name="width" value="1920"/>
<param name="height" value="1080"/>
<param name="framerate" value="30"/>
<param name="camera_frame_id" value="raspicam"/>
</node>
<node pkg="rosservice" type="rosservice" name="start_capture" args="call --wait $(arg name)/start_capture"/>
</launch>
However, when I try to subscribe to image_raw, both on the Pi3 or remotely, I get this error
[ERROR] [1520855482.326728991]: Unable to convert 'rgb8' image for display: 'Image is wrongly formed: height * step != size or 1080 * 5760 != 6266880'
And it seems to make sense, given that 6266880 is really the msg.data.size() coming from raspicam_node.cpp:277
if(buffer->flags & (MMAL_BUFFER_HEADER_FLAG_FRAME_END | MMAL_BUFFER_HEADER_FLAG_TRANSMISSION_FAILED)){
sensor_msgs::Image msg;
msg.header.seq = pData->frame;
msg.header.frame_id = tf_prefix;
msg.header.frame_id = camera_frame_id;
msg.header.stamp = ros::Time::now();
msg.height = pData->pstate->height;
msg.width = pData->pstate->width;
msg.encoding = "rgb8";
msg.is_bigendian = 0;
msg.step = pData->pstate->width*3;
msg.data.insert( msg.data.end(), pData->buffer[pData->frame & 1], &(pData->buffer[pData->frame & 1][pData->id]) );
image_pub.publish(msg);
c_info.header.seq = pData->frame;
c_info.header.stamp = msg.header.stamp;
c_info.header.frame_id = msg.header.frame_id;
camera_info_pub.publish(c_info);
pData->frame++;
pData->id = 0;
}
And before publishing, if I add:
msg.data.resize(msg.data.size()-46080);
the topic becomes valid and the image is correctly shown by image_view. Any idea on how to correctly fix this issue?
I tried to create a new launch file with 1920x1080 resolution for capture. Here it is, to me it looks good.
However, when I try to subscribe to
image_raw, both on the Pi3 or remotely, I get this errorAnd it seems to make sense, given that
6266880is really themsg.data.size()coming fromraspicam_node.cpp:277And before publishing, if I add:
the topic becomes valid and the image is correctly shown by image_view. Any idea on how to correctly fix this issue?