Commit 82ab4e22 authored by Barcis, Michal's avatar Barcis, Michal
Browse files

proper frame numbers

parent 3a09dbb4
......@@ -77,7 +77,7 @@ void adapt(
size_t* adapted_width,
size_t* adapted_height)
{
*rate_adaptation = 0.2;
*rate_adaptation = 0.1;
if(factor >= 1) {
*adapted_width = 640;
*adapted_height = 480;
......@@ -205,6 +205,7 @@ int main(int argc, char * argv[])
msg->is_bigendian = false;
size_t i = 1;
size_t frame_id = 1;
double rate_adaptation;
size_t adapted_width;
size_t adapted_height;
......@@ -236,7 +237,7 @@ int main(int argc, char * argv[])
if (!frame.empty()) {
// Convert to a ROS image
if (!is_flipped) {
convert_frame_to_message(frame, i, msg);
convert_frame_to_message(frame, frame_id, msg);
} else {
// Flip the frame if needed
cv::flip(frame, flipped_frame, 1);
......@@ -253,8 +254,9 @@ int main(int argc, char * argv[])
}
// Publish the image message and increment the frame_id.
if(i%(int)(1/rate_adaptation) == 0) {
RCLCPP_DEBUG(node_logger, "Publishing image #%zd", i)
RCLCPP_INFO(node_logger, "Publishing image #%zd", frame_id)
pub->publish(msg);
++frame_id;
}else{
RCLCPP_DEBUG(node_logger, "Skipping image #%zd", i)
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment