Reputation: 2110
I use ros-indigo and ubuntu 14.04. I used usb_cam to get frame from camera but I can't do same task now.
If I run rosbuild_ws/package_dir$ roslaunch camera.launch
command , I get below output :
Unable to open camera calibration file [/home/user/.ros/camera_info/head_camera.yaml]
[ WARN] [1436602681.552893640]: Camera calibration file /home/user/.ros/camera_info/head_camera.yaml not found.
[ INFO] [1436602681.552918876]: Starting 'head_camera' (/dev/video0) at 640x480 via mmap (yuyv) at 30 FPS
[ WARN] [1436602681.584193482]: unknown control 'white_balance_temperature_auto'
[ WARN] [1436602681.587047162]: unknown control 'focus_auto'
To handle these errors&warnings, I try to install usb_Cam. I run rosdep install usb_cam
, the terminal says that #All required rosdeps installed successfully
. I go to usb_cam folder using roscd usb_cam
.
Then I run below command :
/opt/ros/indigo/share/usb_cam$ rosmake usb_cam
No Makefile in package usb_cam
[ rosmake ] Results:
[ rosmake ] Built 39 packages with 0 failures.
[ rosmake ] Summary output to directory
Finally, I run rosbuild_ws/package_dir$ roslaunch camera.launch
, but I get same message. I can't see frame taken from usb camera. How can I get frame from usb cam using usb_cam?
Content of camera.launch :
<!-- This will read a camera and show a streaming feed in a display window. -->
<launch>
<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"/>
</node>
<node name="image_view" pkg="image_view" type="image_view" respawn="false" output="screen">
<remap from="image" to="/usb_cam/image_raw"/>
<param name="autosize" value="true" />
</node>
</launch>
Upvotes: 1
Views: 12823
Reputation: 31
I'm not sure about the warning, but i'm sure you can access the camera already. About the frame rate, you can find it inside usb_cam/nodes/usb_cam_node.cpp The default frame rate should be 30. You can find out all the parameter you need:
node_.param("video_device", video_device_name_, std::string("/dev/video0"));
node_.param("brightness", brightness_, -1); //0-255, -1 "leave alone"
node_.param("contrast", contrast_, -1); //0-255, -1 "leave alone"
node_.param("saturation", saturation_, -1); //0-255, -1 "leave alone"
node_.param("sharpness", sharpness_, -1); //0-255, -1 "leave alone"
// possible values: mmap, read, userptr
node_.param("io_method", io_method_name_, std::string("mmap"));
node_.param("image_width", image_width_, 640);
node_.param("image_height", image_height_, 480);
node_.param("framerate", framerate_, 30);
// possible values: yuyv, uyvy, mjpeg, yuvmono10, rgb24
node_.param("pixel_format", pixel_format_name_, std::string("mjpeg"));
// enable/disable autofocus
node_.param("autofocus", autofocus_, false);
node_.param("focus", focus_, -1); //0-255, -1 "leave alone"
// enable/disable autoexposure
node_.param("autoexposure", autoexposure_, true);
node_.param("exposure", exposure_, 100);
node_.param("gain", gain_, -1); //0-100?, -1 "leave alone"
// enable/disable auto white balance temperature
node_.param("auto_white_balance", auto_white_balance_, true);
node_.param("white_balance", white_balance_, 4000);
// load the camera info
node_.param("camera_frame_id", img_.header.frame_id, std::string("head_camera"));
node_.param("camera_name", camera_name_, std::string("head_camera"));
node_.param("camera_info_url", camera_info_url_, std::string(""));
then you may change them in launch file like this :
<param name="autoexposure" value="false" />
<param name="auto_whitebalance" value="false" />
<param name="auto_focus" value="false" />
<param name="auto_brigthness" value="false" />
i'm new on this too, hopefully can give some help.
Upvotes: 0