35 #define DEBUG_PRINTS 1 40 : nh_(nh), nhp_(nhp), it_(nhp), cam_(
ros::this_node::
getName())
61 info_man_ = std::shared_ptr<camera_info_manager::CameraInfoManager>(
80 sensor_msgs::Image img;
83 sensor_msgs::CameraInfo ci =
info_man_->getCameraInfo();
89 vimba_frame_ptr->GetTimestamp(frame_timestamp);
94 ci.header.stamp = ros_time;
96 img.header.frame_id = ci.header.frame_id;
97 img.header.stamp = ci.header.stamp;
102 ROS_WARN_STREAM(
"Function frameToImage returned 0. No image published.");
127 Config config = newconfig;
131 catch (
const std::exception& e)
140 sensor_msgs::CameraInfo ci =
info_man_->getCameraInfo();
143 int binning_or_decimation_x = std::max(config.binning_x, config.decimation_x);
144 int binning_or_decimation_y = std::max(config.binning_y, config.decimation_y);
150 if (sensor_width == -1 || sensor_height == -1)
152 ROS_ERROR(
"Could not determine sensor pixel dimensions, camera_info will be wrong");
155 ci.width = sensor_width;
156 ci.height = sensor_height;
157 ci.binning_x = binning_or_decimation_x;
158 ci.binning_y = binning_or_decimation_y;
161 ci.roi.width = config.width * binning_or_decimation_x;
162 ci.roi.height = config.height * binning_or_decimation_y;
163 ci.roi.x_offset = config.offset_x * binning_or_decimation_x;
164 ci.roi.y_offset = config.offset_y * binning_or_decimation_y;
166 bool roi_is_full_image = (ci.roi.width == ci.width && ci.roi.height == ci.height);
167 ci.roi.do_rectify = !roi_is_full_image;
void configure(Config &newconfig, uint32_t level)
ReconfigureServer reconfigure_server_
std::shared_ptr< camera_info_manager::CameraInfoManager > info_man_
bool use_measurement_time_
image_transport::ImageTransport it_
ROSCONSOLE_CONSOLE_IMPL_DECL std::string getName(void *handle)
bool frameToImage(const FramePtr vimba_frame_ptr, sensor_msgs::Image &image)
double getTimestampRealTime(VmbUint64_t timestamp_ticks)
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)
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
void setCallback(frameCallbackFunc callback)
uint32_t getNumSubscribers() const
unsigned long long VmbUint64_t
image_transport::CameraPublisher pub_
void updateCameraInfo(const Config &config)
MonoCamera(ros::NodeHandle &nh, ros::NodeHandle &nhp)
#define ROS_WARN_STREAM(args)
void publish(const sensor_msgs::Image &image, const sensor_msgs::CameraInfo &info) const
void frameCallback(const FramePtr &vimba_frame_ptr)
#define ROS_ERROR_STREAM(args)
void start(const std::string &ip_str, const std::string &guid_str, const std::string &frame_id, bool print_all_features=false)