35 #define DEBUG_PRINTS 1 57 nhp_.
param(
"frame_id", frame_id, std::string(
""));
75 sensor_msgs::Image img;
77 sensor_msgs::CameraInfo ci =
info_man_->getCameraInfo();
78 ci.header.stamp = img.header.stamp = ros_time;
79 img.header.frame_id = ci.header.frame_id;
82 ROS_WARN_STREAM(
"Function frameToImage returned 0. No image published.");
100 if (newconfig.frame_id ==
"") {
101 newconfig.frame_id =
"camera";
109 Config config = newconfig;
112 }
catch (
const std::exception& e) {
120 sensor_msgs::CameraInfo ci =
info_man_->getCameraInfo();
123 ci.header.frame_id = config.frame_id;
126 int binning_or_decimation_x = std::max(config.binning_x, config.decimation_x);
127 int binning_or_decimation_y = std::max(config.binning_y, config.decimation_y);
130 ci.height = config.height;
131 ci.width = config.width;
132 ci.binning_x = binning_or_decimation_x;
133 ci.binning_y = binning_or_decimation_y;
136 ci.roi.x_offset = config.roi_offset_x;
137 ci.roi.y_offset = config.roi_offset_y;
138 ci.roi.height = config.roi_height;
139 ci.roi.width = config.roi_width;
142 std::string camera_info_url;
145 info_man_->setCameraName(config.frame_id);
146 if (
info_man_->validateURL(camera_info_url)) {
147 info_man_->loadCameraInfo(camera_info_url);
154 bool roiMatchesCalibration = (ci.height == config.roi_height
155 && ci.width == config.roi_width);
156 bool resolutionMatchesCalibration = (ci.width == config.width
157 && ci.height == config.height);
159 ci.roi.do_rectify = roiMatchesCalibration || resolutionMatchesCalibration;
void configure(Config &newconfig, uint32_t level)
ReconfigureServer reconfigure_server_
void publish(const sensor_msgs::Image &image, const sensor_msgs::CameraInfo &info) const
boost::shared_ptr< camera_info_manager::CameraInfoManager > info_man_
NetPointer< Frame, AVT::VmbAPINET::Frame > FramePtr
image_transport::ImageTransport it_
uint32_t getNumSubscribers() const
std::string getName(void *handle)
void setCallback(frameCallbackFunc callback=&avt_vimba_camera::AvtVimbaCamera::defaultFrameCallback)
bool frameToImage(const FramePtr vimba_frame_ptr, sensor_msgs::Image &image)
avt_vimba_camera::AvtVimbaCameraConfig Config
std::string camera_info_url_
void updateConfig(Config &config)
CameraPublisher advertiseCamera(const std::string &base_topic, uint32_t queue_size, bool latch=false)
void start(std::string ip_str, std::string guid_str, bool debug_prints=true)
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
MonoCamera(ros::NodeHandle nh, ros::NodeHandle nhp)
image_transport::CameraPublisher pub_
void updateCameraInfo(const Config &config)
#define ROS_WARN_STREAM(args)
bool getParam(const std::string &key, std::string &s) const
void frameCallback(const FramePtr &vimba_frame_ptr)
#define ROS_ERROR_STREAM(args)