ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

how to set framerate of usb_cam above 30FPS?

asked 2018-06-08 07:47:14 -0500

simbha gravatar image

updated 2022-02-22 11:23:58 -0500

lucasw gravatar image

I am using this usb_camera. I want to use the frame rate 120FPS 640x480. I passed the parameter <framerate> in launch file. But when i check the average rate of topic `rostopic hz usb_cam/image_raw . its showing 30HZ only. Actually it should be 120 !!!

I also try hardcoding the ros::Rate to 120, but is doesn't effect the output of average rate.

  bool spin(){
   ros::Rate loop_rate(this -> framerate_);
    while (node_.ok())
    {
    if (cam_.is_capturing()) {
    if (!take_and_send_image()) ROS_WARN("USB camera did not respond in time.");
   }
   //ROS_INFO("framerate_ '%i'", framerate_ );
   ros::spinOnce();
   loop_rate.sleep();
}
return true; }

Are there any restrictions on increasing the framerate above 30FPS. When I change the frame rate below 30 is show the changes but not above the 30FPS. My usb_cam launch file parameters are as:

  <node name="usb_cam" pkg="usb_cam" type="usb_cam_node" output="screen" >
<param name="video_device" value="/dev/video0" />
<param name="image_width" value="640" />
<param name="image_height" value="480" />
<param name="pixel_format" value="yuyv" />
<param name="camera_frame_id" value="usb_cam" />
<param name="io_method" value="mmap"/>
<param name="framerate" value="120" />
</node>

How can I change the framerate in usb_cam above 30FPS.

edit retag flag offensive close merge delete

Comments

Do you see an option to set the framerate that high using guvcview?

lucasw gravatar image lucasw  ( 2018-06-08 10:27:40 -0500 )edit

I want to use with ROS. I think its just a video viewer in linux. if no, please give some link

simbha gravatar image simbha  ( 2018-06-09 06:11:43 -0500 )edit

I want to use withROS. I think its just a video viewer in linux. if no, please give some link

simbha gravatar image simbha  ( 2018-06-09 06:11:43 -0500 )edit

If it doesn't work in guvcview then it probably won't work in usb_cam

lucasw gravatar image lucasw  ( 2018-06-09 10:12:46 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-06-08 22:23:52 -0500

vinaykumarhs2020 gravatar image

You should probably set the pixel_format to MJPG. In the product link you have shared, YUYV supports max 30fps only (make sense because of USB2.0 hardware bandwidth limitation!).

edit flag offensive delete link more

Comments

!!!! This pixel camera is not supported by the camera.

simbha gravatar image simbha  ( 2018-06-09 06:13:39 -0500 )edit

Yes, Actually pixel value needed to be changed, I check that yuyv support only max 30 FPS. I changed to mjpeg

simbha gravatar image simbha  ( 2018-07-30 13:41:09 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2018-06-08 07:47:14 -0500

Seen: 1,419 times

Last updated: Jun 08 '18