ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Hi you must to use loop_rate.sleep() in the end of while to control your loop rate
2 | No.2 Revision |
Hi you must to use loop_rate.sleep() in the end of while to control your loop rate
while(ros::ok() ){
counter++;
#if 1
ros::Time time = ros::Time::now();
cv_ptr->encoding = "bgr8";
cv_ptr->header.stamp = time;
cv_ptr->header.frame_id = "/Sufyan_ImageTopic";
#endif
cv_ptr->image = image;
image_pub_.publish(cv_ptr->toImageMsg());
ROS_INFO("ImageMsg Send.");
#endif
loop_rate.sleep();
}