changing the frequency of loop
following is the snipet of my code i want to change the frequency with which the image is pubished i tried changing the loop_rate(10) to loop_rate(1) but it didn't work
ros::Rate loop_rate(10);
int counter =0;
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
}
ros::spin();