usb_cam多台相机使用
前提是一台usb_cam可以用
1.先修改文件
(1). usb_cam_node.cpp的修改
//添加string头文件
#include <ros/ros.h>
#include <usb_cam/usb_cam.h>
#include <image_transport/image_transport.h>
#include <camera_info_manager/camera_info_manager.h>
#include <sstream>
#include <std_srvs/Empty.h>
#include <string>
.......
//增加最后一条代码
// 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);
node_.param("image_topic", image_topic_, std::string("image_raw"));
.......
//将前面的image_pub进行修改,并把他挪到入下位置(load the camera info)
// 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(""));
cinfo_.reset(new camera_info_manager::CameraInfoManager(node_, camera_name_, camera_info_url_));
image_pub_ = it.advertiseCamera(image_topic_.c_str(), 1);
......
//在这个位置加上image_topic_的定义
//std::string start_service_name_, start_service_name_;
bool streaming_status_;
int image_width_, image_height_, framerate_, exposure_, brightness_, contrast_, saturation_, sharpness_, focus_,
white_balance_, gain_;
bool autofocus_, autoexposure_, auto_white_balance_;
std::string image_topic_;
boost::shared_ptr<camera_info_manager::CameraInfoManager> cinfo_;
(2).修改文件中相机节点.lanuch文件的个数,并修改文件(修改部分加粗)