26 #include <boost/interprocess/sync/scoped_lock.hpp> 30 typedef boost::interprocess::scoped_lock<boost::interprocess::interprocess_mutex>
Lock;
33 unsigned int Pyuv422torgb24(
unsigned char *input_ptr,
unsigned char *output_ptr,
unsigned int image_width,
unsigned int image_height);
34 unsigned int Pyuv422tobgr24(
unsigned char *input_ptr,
unsigned char *output_ptr,
unsigned int image_width,
unsigned int image_height);
35 unsigned int Pyuv422togray8(
unsigned char *input_ptr,
unsigned char *output_ptr,
unsigned int image_width,
unsigned int image_height);
42 boost::this_thread::sleep(boost::posix_time::milliseconds(100));
72 ROS_INFO(
"start show camera image thread");
110 ROS_INFO(
"V4RCamNode::readParams()");
112 ROS_INFO(
"show_camera_image: %s", ((show_camera_image_) ?
"true" :
"false"));
114 ROS_INFO(
"camera_freeze: %s", ((camera_freeze_) ?
"true" :
"false"));
117 ROS_INFO(
"video_device: %s", videoDevice_.c_str());
119 ROS_INFO(
"avi_filename: %s", aviFilename_.c_str());
121 ROS_INFO(
"convert_image: %i", convert_image_);
123 ROS_INFO(
"ratioThumbnail: %i", ratioThumbnail_);
125 ROS_INFO(
"width: %i", width_);
127 ROS_INFO(
"height: %i", height_);
130 ROS_INFO(
"fps: %4.3f", fps_);
132 std::string camera_info_url;
147 for(
int i = 0; i < 9; i++) {
155 for(
int i = 0; i < 5; i++) {
163 for(
int i = 0; i < 9; i++) {
171 for(
int i = 0; i < 12; i++) {
177 ROS_INFO(
"tf_camera_id: %s",
cameraInfo_.header.frame_id.c_str());
179 ROS_INFO(
"frame_id: %s",
cameraInfo_.header.frame_id.c_str());
266 std::stringstream ss;
272 cv::putText(img, ss.str(), cv::Point(10, 15), cv::FONT_HERSHEY_PLAIN, 1, cv::Scalar::all(0), 1, CV_AA);
274 cv::imshow(window_name, img);
276 key = cv::waitKey(50);
279 cv::putText(img,
"OFFLINE", cv::Point(img.cols/4, img.rows/4), cv::FONT_HERSHEY_PLAIN, 5, cv::Scalar::all(0), 3, CV_AA);
280 cv::imshow(window_name, img);
282 cv::destroyWindow(window_name);
292 ROS_INFO(
"action %s, pitch = %4.2f, yaw = %4.2f", msg->action.c_str(), msg->pitch, msg->yaw);
298 ROS_INFO(
"New camera info received");
299 sensor_msgs::CameraInfo &
info = req.camera_info;
304 rsp.status_message = (boost::format(
"Camera_info resolution %ix%i does not match current video " 305 "setting, camera running at resolution %ix%i.")
307 ROS_ERROR(
"%s", rsp.status_message.c_str());
#define DEFAULT_AVIFILENAME
#define DEFAULT_SHOW_CAMERA_IMAGE
bool queueRosParamToV4LCommit_
std::string pullInfoMsg()
int v4lset(ControlEntryPtr entry)
void publish(const sensor_msgs::Image &image, const sensor_msgs::CameraInfo &info) const
image_transport::ImageTransport imageTransport_
sensor_msgs::Image cameraImage_
boost::interprocess::scoped_lock< boost::interprocess::interprocess_mutex > Lock
#define DEFAULT_VIDEODEVICE
const std::vector< ControlEntryPtr > & detectControlEnties()
sensor_msgs::CameraInfo getCameraInfo(void)
bool loadCameraInfo(const std::string &url)
ros::ServiceServer set_camera_info_srv_
image_transport::CameraPublisher cameraPublisher_
boost::interprocess::scoped_lock< boost::interprocess::interprocess_mutex > Lock
std::string videoDevice_
pointer to the v4l2 device
Publisher advertise(const std::string &base_topic, uint32_t queue_size, bool latch=false)
std::string aviFilename_
device name /dev/videoX
boost::thread showCameraImageThread_
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
unsigned int Pyuv422togray8(unsigned char *input_ptr, unsigned char *output_ptr, unsigned int image_width, unsigned int image_height)
Type const & getType() const
bool setCameraInfo(sensor_msgs::SetCameraInfoRequest &req, sensor_msgs::SetCameraInfoResponse &rsp)
#define DEFAULT_CAMERA_FREEZE
uint32_t getNumSubscribers() const
static struct jpginfo info
bool validateURL(const std::string &url)
static const int CONVERT_YUV422toBGR
unsigned int Pyuv422torgb24(unsigned char *input_ptr, unsigned char *output_ptr, unsigned int image_width, unsigned int image_height)
sensor_msgs::CameraInfo cameraInfo_
static const int CONVERT_YUV422toGray
CameraPublisher advertiseCamera(const std::string &base_topic, uint32_t queue_size, bool latch=false)
image_transport::Publisher cameraThumbnailPublisher_
bool showCameraImageThreadActive_
void publish(const sensor_msgs::Image &message) const
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
static const int CONVERT_RAW
timeval timeLastFrame_
frames per second
void commitV4LToRosParams()
bool generate_dynamic_reconfigure_
#define DEFAULT_CONVERT_IMAGE
#define ROS_INFO_STREAM(args)
boost::interprocess::interprocess_mutex mutexImage_
duration between last and the frame before the last one
void callbackSphere(const tuw_uvc::SphereConstPtr &msg)
void commitRosParamsToV4L(bool force=false)
bool getParam(const std::string &key, std::string &s) const
unsigned int Pyuv422tobgr24(unsigned char *input_ptr, unsigned char *output_ptr, unsigned int image_width, unsigned int image_height)
std::vector< ControlEntryPtr > controlEntries_
mutex to secure critical sections
unsigned char * framebuffer
sensor_msgs::Image cameraThumbnail_
double durationLastFrame_
time stamp of the last frame
static const int CONVERT_YUV422toRGB
int v4lget(ControlEntryPtr entry)
#define ROS_ERROR_STREAM(args)
V4RCamNode(ros::NodeHandle &n)
void setParam(const std::string &key, const XmlRpc::XmlRpcValue &v) const
FD initCamera(const std::string &videoDevice="")
vector of the current supported control entries
#define DEFAULT_RATIO_THUMBNAIL
std::string pullErrorMsg()