40 arv_stream_set_emit_signals(
p_streams_[i], FALSE);
64 guint64 n_completed_buffers = 0;
65 guint64 n_failures = 0;
66 guint64 n_underruns = 0;
67 arv_stream_get_statistics(
p_streams_[i], &n_completed_buffers, &n_failures, &n_underruns);
68 ROS_INFO(
"Completed buffers = %Lu", (
unsigned long long ) n_completed_buffers);
69 ROS_INFO(
"Failures = %Lu", (
unsigned long long ) n_failures);
70 ROS_INFO(
"Underruns = %Lu", (
unsigned long long ) n_underruns);
75 arv_gv_stream_get_statistics(
reinterpret_cast<ArvGvStream*
>(
p_streams_[i]), &n_resent, &n_missing);
76 ROS_INFO(
"Resent buffers = %Lu", (
unsigned long long ) n_resent);
77 ROS_INFO(
"Missing = %Lu", (
unsigned long long ) n_missing);
84 arv_device_execute_command(
p_device_,
"AcquisitionStop");
104 std::string stream_channel_args;
105 if (pnh.
getParam(
"channel_names", stream_channel_args)) {
111 std::string pixel_format_args;
112 std::vector<std::string> pixel_formats;
113 pnh.
param(
"PixelFormat", pixel_format_args, pixel_format_args);
116 std::string calib_url_args;
117 std::vector<std::string> calib_urls;
118 pnh.
param(
"camera_info_url", calib_url_args, calib_url_args);
123 arv_update_device_list();
124 uint n_interfaces = arv_get_n_interfaces();
125 ROS_INFO(
"# Interfaces: %d", n_interfaces);
127 uint n_devices = arv_get_n_devices();
128 ROS_INFO(
"# Devices: %d", n_devices);
129 for (uint i = 0; i < n_devices; i++)
130 ROS_INFO(
"Device%d: %s", i, arv_get_device_id(i));
156 arv_device_get_string_feature_value(
p_device_,
"DeviceSerialNumber"));
175 ROS_WARN(
"Unable to detect number of supported stream channels.");
202 arv_camera_gv_select_stream_channel(
p_camera_,i);
210 gint64 focus_min64, focus_max64;
211 arv_device_get_integer_feature_bounds(
p_device_,
"FocusPos", &focus_min64, &focus_max64);
222 arv_camera_gv_select_stream_channel(
p_camera_,i);
228 arv_device_set_float_feature_value(
p_device_,
"ExposureTimeAbs",
config_.ExposureTime);
232 arv_device_set_integer_feature_value(
p_device_,
"AcquisitionFrameRateEnable", 1);
242 arv_device_set_string_feature_value(
p_device_,
"TriggerSelector",
"FrameStart");
243 arv_device_set_string_feature_value(
p_device_,
"TriggerMode",
"Off");
271 arv_camera_gv_select_stream_channel(
p_camera_,i);
272 std::string source_selector =
"Source" + std::to_string(i);
273 arv_device_set_string_feature_value(
p_device_,
"SourceSelector", source_selector.c_str());
274 arv_device_set_string_feature_value(
p_device_,
"PixelFormat", pixel_formats[i].c_str());
275 sensors_[i]->pixel_format = std::string(arv_device_get_string_feature_value(
p_device_,
"PixelFormat"));
281 ROS_WARN_STREAM(
"There is no known conversion from " <<
sensors_[i]->pixel_format <<
" to a usual ROS image encoding. Likely you need to implement one.");
284 sensors_[i]->n_bits_pixel = ARV_PIXEL_FORMAT_BIT_PER_PIXEL(
285 arv_device_get_integer_feature_value(
p_device_,
"PixelFormat"));
292 pnh.
param<
double>(
"softwaretriggerrate",
config_.softwaretriggerrate,
config_.softwaretriggerrate);
312 double tf_publish_rate;
313 pnh.
param<
double>(
"tf_publish_rate", tf_publish_rate, 0);
314 if (tf_publish_rate > 0.)
330 ArvGcNode *p_gc_node;
331 GError *error = NULL;
333 p_gc_node = arv_device_get_feature(
p_device_,
"DeviceSerialNumber");
335 if(calib_urls[0].empty()) {
336 if( arv_gc_feature_node_is_implemented( ARV_GC_FEATURE_NODE(p_gc_node), &error) ) {
337 GType device_serial_return_type = arv_gc_feature_node_get_value_type( ARV_GC_FEATURE_NODE(p_gc_node));
341 if (device_serial_return_type == G_TYPE_STRING) {
342 calib_urls[0] = arv_device_get_string_feature_value(
p_device_,
"DeviceSerialNumber");
343 calib_urls[0] +=
".yaml";
344 }
else if (device_serial_return_type == G_TYPE_INT64) {
345 calib_urls[0] = arv_device_get_string_feature_value(
p_device_,
"DeviceID");
346 calib_urls[0] +=
".yaml";
353 std::string camera_info_frame_id =
config_.frame_id;
381 ROS_INFO(
" Using Camera Configuration:");
382 ROS_INFO(
" ---------------------------");
383 ROS_INFO(
" Vendor name = %s", arv_device_get_string_feature_value(
p_device_,
"DeviceVendorName"));
384 ROS_INFO(
" Model name = %s", arv_device_get_string_feature_value(
p_device_,
"DeviceModelName"));
385 ROS_INFO(
" Device id = %s", arv_device_get_string_feature_value(
p_device_,
"DeviceUserID"));
386 ROS_INFO(
" Serial number = %s", arv_device_get_string_feature_value(
p_device_,
"DeviceSerialNumber"));
389 arv_camera_is_uv_device(
p_camera_) ?
"USB3Vision" :
390 (arv_camera_is_gv_device(
p_camera_) ?
"GigEVision" :
"Other"));
393 ROS_INFO(
" ROI x,y,w,h = %d, %d, %d, %d",
roi_.x,
roi_.y,
roi_.width,
roi_.height);
397 " Acquisition Mode = %s",
399 "(not implemented in camera)");
401 " Trigger Mode = %s",
403 "(not implemented in camera)");
405 " Trigger Source = %s",
407 "(not implemented in camera)");
411 ROS_INFO(
" AcquisitionFrameRate = %g hz",
config_.AcquisitionFrameRate);
432 ROS_INFO(
" Network mtu = %lu", arv_device_get_integer_feature_value(
p_device_,
"GevSCPSPacketSize"));
434 ROS_INFO(
" ---------------------------");
452 arv_camera_gv_select_stream_channel(
p_camera_, i);
458 arv_camera_gv_select_stream_channel(
p_camera_, i);
459 const gint n_bytes_payload_stream_ = arv_camera_get_payload(
p_camera_);
471 ROS_WARN(
"Stream %i: Could not create image stream for %s. Retrying...", i,
guid_.c_str());
479 std::vector<image_transport::SubscriberStatusCallback> image_cbs_;
480 std::vector<ros::SubscriberStatusCallback> info_cbs_;
490 std::string topic_name = this->
getName();
498 1, image_cb, image_cb, info_cb, info_cb);
503 StreamIdData* data =
new StreamIdData();
511 arv_stream_set_emit_signals(
p_streams_[i], TRUE);
530 ROS_INFO(
"Done initializing camera_aravis.");
535 const char* feature_name = request.feature.c_str();
536 response.response = arv_device_get_integer_feature_value(this->
p_device_, feature_name);
542 const char* feature_name = request.feature.c_str();
543 guint64 value = request.value;
544 arv_device_set_integer_feature_value(this->
p_device_, feature_name, value);
545 if(arv_device_get_status(this->
p_device_) == ARV_DEVICE_STATUS_SUCCESS) {
555 const char* feature_name = request.feature.c_str();
556 response.response = arv_device_get_float_feature_value(this->
p_device_, feature_name);
562 const char* feature_name = request.feature.c_str();
563 const double value = request.value;
564 arv_device_set_float_feature_value(this->
p_device_, feature_name, value);
565 if(arv_device_get_status(this->
p_device_) == ARV_DEVICE_STATUS_SUCCESS) {
575 const char* feature_name = request.feature.c_str();
576 response.response = arv_device_get_string_feature_value(this->
p_device_, feature_name);
582 const char* feature_name = request.feature.c_str();
583 const char* value = request.value.c_str();
584 arv_device_set_string_feature_value(this->
p_device_, feature_name, value);
585 if(arv_device_get_status(this->
p_device_) == ARV_DEVICE_STATUS_SUCCESS) {
595 const char* feature_name = request.feature.c_str();
596 response.response = arv_device_get_boolean_feature_value(this->
p_device_, feature_name);
602 const char* feature_name = request.feature.c_str();
603 const bool value = request.value;
604 arv_device_set_boolean_feature_value(this->
p_device_, feature_name, value);
605 if(arv_device_get_status(this->
p_device_) == ARV_DEVICE_STATUS_SUCCESS) {
616 std::string ptp_status(arv_device_get_string_feature_value(
p_device_,
"GevIEEE1588Status"));
617 if (ptp_status == std::string(
"Faulty") || ptp_status == std::string(
"Disabled"))
619 ROS_INFO(
"camera_aravis: Reset ptp clock (was set to %s)", ptp_status.c_str());
620 arv_device_set_boolean_feature_value(
p_device_,
"GevIEEE1588",
false);
621 arv_device_set_boolean_feature_value(
p_device_,
"GevIEEE1588",
true);
633 arv_device_set_float_feature_value(
p_device_,
"ExposureTime", msg_ptr->exposure_time);
642 arv_device_set_string_feature_value(
p_device_,
"GainSelector",
"All");
644 arv_device_set_float_feature_value(
p_device_,
"Gain", msg_ptr->gain);
651 arv_device_set_string_feature_value(
p_device_,
"GainSelector",
"Red");
652 arv_device_set_float_feature_value(
p_device_,
"Gain", msg_ptr->gain_red);
657 arv_device_set_string_feature_value(
p_device_,
"GainSelector",
"Green");
658 arv_device_set_float_feature_value(
p_device_,
"Gain", msg_ptr->gain_green);
663 arv_device_set_string_feature_value(
p_device_,
"GainSelector",
"Blue");
664 arv_device_set_float_feature_value(
p_device_,
"Gain", msg_ptr->gain_blue);
675 arv_device_set_string_feature_value(
p_device_,
"BlackLevelSelector",
"All");
677 arv_device_set_float_feature_value(
p_device_,
"BlackLevel", msg_ptr->black_level);
684 arv_device_set_string_feature_value(
p_device_,
"BlackLevelSelector",
"Red");
685 arv_device_set_float_feature_value(
p_device_,
"BlackLevel", msg_ptr->bl_red);
690 arv_device_set_string_feature_value(
p_device_,
"BlackLevelSelector",
"Green");
691 arv_device_set_float_feature_value(
p_device_,
"BlackLevel", msg_ptr->bl_green);
696 arv_device_set_string_feature_value(
p_device_,
"BlackLevelSelector",
"Blue");
697 arv_device_set_float_feature_value(
p_device_,
"BlackLevel", msg_ptr->bl_blue);
703 if (strcmp(
"The Imaging Source Europe GmbH", arv_camera_get_vendor_name(
p_camera_)) == 0)
705 arv_device_set_integer_feature_value(
p_device_,
"WhiteBalanceRedRegister", (
int)(
auto_params_.wb_red * 255.));
706 arv_device_set_integer_feature_value(
p_device_,
"WhiteBalanceGreenRegister", (
int)(
auto_params_.wb_green * 255.));
707 arv_device_set_integer_feature_value(
p_device_,
"WhiteBalanceBlueRegister", (
int)(
auto_params_.wb_blue * 255.));
713 arv_device_set_string_feature_value(
p_device_,
"BalanceRatioSelector",
"Red");
714 arv_device_set_float_feature_value(
p_device_,
"BalanceRatio", msg_ptr->wb_red);
719 arv_device_set_string_feature_value(
p_device_,
"BalanceRatioSelector",
"Green");
720 arv_device_set_float_feature_value(
p_device_,
"BalanceRatio", msg_ptr->wb_green);
725 arv_device_set_string_feature_value(
p_device_,
"BalanceRatioSelector",
"Blue");
726 arv_device_set_float_feature_value(
p_device_,
"BalanceRatio", msg_ptr->wb_blue);
739 std::numeric_limits<double>::quiet_NaN();
752 arv_device_set_string_feature_value(
p_device_,
"GainSelector",
"All");
757 arv_device_set_string_feature_value(
p_device_,
"GainSelector",
"Red");
759 arv_device_set_string_feature_value(
p_device_,
"GainSelector",
"Green");
761 arv_device_set_string_feature_value(
p_device_,
"GainSelector",
"Blue");
770 arv_device_set_string_feature_value(
p_device_,
"BlackLevelSelector",
"All");
775 arv_device_set_string_feature_value(
p_device_,
"BlackLevelSelector",
"Red");
777 arv_device_set_string_feature_value(
p_device_,
"BlackLevelSelector",
"Green");
779 arv_device_set_string_feature_value(
p_device_,
"BlackLevelSelector",
"Blue");
785 if (strcmp(
"The Imaging Source Europe GmbH", arv_camera_get_vendor_name(
p_camera_)) == 0)
787 auto_params_.wb_red = arv_device_get_integer_feature_value(
p_device_,
"WhiteBalanceRedRegister") / 255.;
788 auto_params_.wb_green = arv_device_get_integer_feature_value(
p_device_,
"WhiteBalanceGreenRegister") / 255.;
789 auto_params_.wb_blue = arv_device_get_integer_feature_value(
p_device_,
"WhiteBalanceBlueRegister") / 255.;
794 arv_device_set_string_feature_value(
p_device_,
"BalanceRatioSelector",
"Red");
796 arv_device_set_string_feature_value(
p_device_,
"BalanceRatioSelector",
"Green");
798 arv_device_set_string_feature_value(
p_device_,
"BalanceRatioSelector",
"Blue");
824 arv_device_set_string_feature_value(
p_device_,
"ExposureAuto",
"Off");
828 arv_device_set_string_feature_value(
p_device_,
"GainAuto",
"Off");
832 arv_device_set_string_feature_value(
p_device_,
"GainAutoBalance",
"Off");
836 arv_device_set_string_feature_value(
p_device_,
"BlackLevelAuto",
"Off");
840 arv_device_set_string_feature_value(
p_device_,
"BlackLevelAutoBalance",
"Off");
844 arv_device_set_string_feature_value(
p_device_,
"BalanceWhiteAuto",
"Off");
860 if (channel_name.empty()) {
875 gboolean b_auto_buffer = FALSE;
876 gboolean b_packet_resend = TRUE;
877 unsigned int timeout_packet = 40;
878 unsigned int timeout_frame_retention = 200;
882 if (!ARV_IS_GV_STREAM(p_stream))
884 ROS_WARN(
"Stream is not a GV_STREAM");
889 g_object_set(p_stream,
"socket-buffer", ARV_GV_STREAM_SOCKET_BUFFER_AUTO,
"socket-buffer-size", 0,
891 if (!b_packet_resend)
892 g_object_set(p_stream,
"packet-resend",
893 b_packet_resend ? ARV_GV_STREAM_PACKET_RESEND_ALWAYS : ARV_GV_STREAM_PACKET_RESEND_NEVER,
895 g_object_set(p_stream,
"packet-timeout", timeout_packet * 1000,
"frame-retention", timeout_frame_retention * 1000,
906 if (config.frame_id ==
"")
907 config.frame_id = this->
getName();
910 config.AcquisitionFrameRate = CLAMP(config.AcquisitionFrameRate,
config_min_.AcquisitionFrameRate,
915 config.frame_id =
tf::resolve(tf_prefix, config.frame_id);
921 if (config.AutoSlave)
923 config.ExposureAuto =
"Off";
924 config.GainAuto =
"Off";
929 if (config.ExposureAuto.compare(
"Off") != 0)
931 config.ExposureTime =
config_.ExposureTime;
932 ROS_WARN(
"ExposureAuto is active. Cannot manually set ExposureTime.");
934 if (config.GainAuto.compare(
"Off") != 0)
937 ROS_WARN(
"GainAuto is active. Cannot manually set Gain.");
941 if (config.TriggerMode.compare(
"Off") != 0)
943 config.AcquisitionFrameRate =
config_.AcquisitionFrameRate;
944 ROS_WARN(
"TriggerMode is active (Trigger Source: %s). Cannot manually set AcquisitionFrameRate.",
config_.TriggerSource.c_str());
948 const bool changed_auto_master = (
config_.AutoMaster != config.AutoMaster);
949 const bool changed_auto_slave = (
config_.AutoSlave != config.AutoSlave);
950 const bool changed_acquisition_frame_rate = (
config_.AcquisitionFrameRate != config.AcquisitionFrameRate);
951 const bool changed_exposure_auto = (
config_.ExposureAuto != config.ExposureAuto);
952 const bool changed_exposure_time = (
config_.ExposureTime != config.ExposureTime);
953 const bool changed_gain_auto = (
config_.GainAuto != config.GainAuto);
954 const bool changed_gain = (
config_.Gain != config.Gain);
955 const bool changed_acquisition_mode = (
config_.AcquisitionMode != config.AcquisitionMode);
956 const bool changed_trigger_mode = (
config_.TriggerMode != config.TriggerMode);
957 const bool changed_trigger_source = (
config_.TriggerSource != config.TriggerSource) || changed_trigger_mode;
958 const bool changed_focus_pos = (
config_.FocusPos != config.FocusPos);
959 const bool changed_mtu = (
config_.mtu != config.mtu);
961 if (changed_auto_master)
966 if (changed_auto_slave)
972 if (changed_exposure_time)
976 ROS_INFO(
"Set ExposureTime = %f us", config.ExposureTime);
977 arv_camera_set_exposure_time(
p_camera_, config.ExposureTime);
980 ROS_INFO(
"Camera does not support ExposureTime.");
987 ROS_INFO(
"Set gain = %f", config.Gain);
988 arv_camera_set_gain(
p_camera_, config.Gain);
991 ROS_INFO(
"Camera does not support Gain or GainRaw.");
994 if (changed_exposure_auto)
998 ROS_INFO(
"Set ExposureAuto = %s", config.ExposureAuto.c_str());
999 arv_device_set_string_feature_value(
p_device_,
"ExposureAuto", config.ExposureAuto.c_str());
1000 if (config.ExposureAuto.compare(
"Once") == 0)
1003 config.ExposureTime = arv_camera_get_exposure_time(
p_camera_);
1004 ROS_INFO(
"Get ExposureTime = %f us", config.ExposureTime);
1005 config.ExposureAuto =
"Off";
1009 ROS_INFO(
"Camera does not support ExposureAuto.");
1011 if (changed_gain_auto)
1015 ROS_INFO(
"Set GainAuto = %s", config.GainAuto.c_str());
1016 arv_device_set_string_feature_value(
p_device_,
"GainAuto", config.GainAuto.c_str());
1017 if (config.GainAuto.compare(
"Once") == 0)
1020 config.Gain = arv_camera_get_gain(
p_camera_);
1021 ROS_INFO(
"Get Gain = %f", config.Gain);
1022 config.GainAuto =
"Off";
1026 ROS_INFO(
"Camera does not support GainAuto.");
1029 if (changed_acquisition_frame_rate)
1033 ROS_INFO(
"Set frame rate = %f Hz", config.AcquisitionFrameRate);
1034 arv_camera_set_frame_rate(
p_camera_, config.AcquisitionFrameRate);
1037 ROS_INFO(
"Camera does not support AcquisitionFrameRate.");
1040 if (changed_trigger_mode)
1044 ROS_INFO(
"Set TriggerMode = %s", config.TriggerMode.c_str());
1045 arv_device_set_string_feature_value(
p_device_,
"TriggerMode", config.TriggerMode.c_str());
1048 ROS_INFO(
"Camera does not support TriggerMode.");
1051 if (changed_trigger_source)
1062 ROS_INFO(
"Set TriggerSource = %s", config.TriggerSource.c_str());
1063 arv_device_set_string_feature_value(
p_device_,
"TriggerSource", config.TriggerSource.c_str());
1067 ROS_INFO(
"Camera does not support TriggerSource.");
1071 if (config.TriggerMode.compare(
"On") == 0 && config.TriggerSource.compare(
"Software") == 0)
1075 config_.softwaretriggerrate = config.softwaretriggerrate;
1076 ROS_INFO(
"Set softwaretriggerrate = %f", 1000.0 / ceil(1000.0 / config.softwaretriggerrate));
1083 ROS_INFO(
"Camera does not support TriggerSoftware command.");
1088 if (changed_focus_pos)
1092 ROS_INFO(
"Set FocusPos = %d", config.FocusPos);
1093 arv_device_set_integer_feature_value(
p_device_,
"FocusPos", config.FocusPos);
1095 config.FocusPos = arv_device_get_integer_feature_value(
p_device_,
"FocusPos");
1096 ROS_INFO(
"Get FocusPos = %d", config.FocusPos);
1099 ROS_INFO(
"Camera does not support FocusPos.");
1106 ROS_INFO(
"Set mtu = %d", config.mtu);
1107 arv_device_set_integer_feature_value(
p_device_,
"GevSCPSPacketSize", config.mtu);
1109 config.mtu = arv_device_get_integer_feature_value(
p_device_,
"GevSCPSPacketSize");
1110 ROS_INFO(
"Get mtu = %d", config.mtu);
1113 ROS_INFO(
"Camera does not support mtu (i.e. GevSCPSPacketSize).");
1116 if (changed_acquisition_mode)
1120 ROS_INFO(
"Set AcquisitionMode = %s", config.AcquisitionMode.c_str());
1121 arv_device_set_string_feature_value(
p_device_,
"AcquisitionMode", config.AcquisitionMode.c_str());
1124 arv_device_execute_command(
p_device_,
"AcquisitionStop");
1126 arv_device_execute_command(
p_device_,
"AcquisitionStart");
1129 ROS_INFO(
"Camera does not support AcquisitionMode.");
1144 arv_device_execute_command(
p_device_,
"AcquisitionStop");
1148 arv_device_execute_command(
p_device_,
"AcquisitionStart");
1157 StreamIdData *data = (StreamIdData*) can_instance;
1159 size_t stream_id = data->stream_id;
1166 const std::string stream_frame_id = p_can->
config_.frame_id +
"/" + p_can->
stream_names_[stream_id];
1174 ArvBuffer *p_buffer = arv_stream_try_pop_buffer(p_stream);
1177 gint n_available_buffers;
1178 arv_stream_get_n_buffers(p_stream, &n_available_buffers, NULL);
1179 if (n_available_buffers == 0)
1181 p_can->p_buffer_pools_[stream_id]->allocateBuffers(1);
1184 if (p_buffer != NULL)
1186 if (arv_buffer_get_status(p_buffer) == ARV_BUFFER_STATUS_SUCCESS && p_can->p_buffer_pools_[stream_id]
1187 && p_can->cam_pubs_[stream_id].getNumSubscribers())
1189 (p_can->n_buffers_)++;
1191 sensor_msgs::ImagePtr msg_ptr = (*(p_can->p_buffer_pools_[stream_id]))[p_buffer];
1195 if (p_can->use_ptp_stamp_)
1196 t = arv_buffer_get_timestamp(p_buffer);
1198 t = arv_buffer_get_system_timestamp(p_buffer);
1199 msg_ptr->header.stamp.fromNSec(t);
1201 msg_ptr->header.seq = arv_buffer_get_frame_id(p_buffer);
1203 msg_ptr->header.frame_id = frame_id;
1204 msg_ptr->width = p_can->roi_.width;
1205 msg_ptr->height = p_can->roi_.height;
1206 msg_ptr->encoding = p_can->sensors_[stream_id]->pixel_format;
1207 msg_ptr->step = (msg_ptr->width * p_can->sensors_[stream_id]->n_bits_pixel)/8;
1210 if (p_can->convert_formats[stream_id]) {
1211 sensor_msgs::ImagePtr cvt_msg_ptr = p_can->p_buffer_pools_[stream_id]->getRecyclableImg();
1212 p_can->convert_formats[stream_id](msg_ptr, cvt_msg_ptr);
1213 msg_ptr = cvt_msg_ptr;
1217 if (!p_can->camera_infos_[stream_id]) {
1218 p_can->camera_infos_[stream_id].reset(
new sensor_msgs::CameraInfo);
1220 (*p_can->camera_infos_[stream_id]) = p_can->p_camera_info_managers_[stream_id]->getCameraInfo();
1221 p_can->camera_infos_[stream_id]->header = msg_ptr->header;
1222 if (p_can->camera_infos_[stream_id]->width == 0 || p_can->camera_infos_[stream_id]->height == 0) {
1224 "The fields image_width and image_height seem not to be set in "
1225 "the YAML specified by 'camera_info_url' parameter. Please set "
1226 "them there, because actual image size and specified image size "
1227 "can be different due to the region of interest (ROI) feature. In "
1228 "the YAML the image size should be the one on which the camera was "
1229 "calibrated. See CameraInfo.msg specification!");
1230 p_can->camera_infos_[stream_id]->width = p_can->roi_.width;
1231 p_can->camera_infos_[stream_id]->height = p_can->roi_.height;
1235 p_can->cam_pubs_[stream_id].publish(msg_ptr, p_can->camera_infos_[stream_id]);
1237 if (p_can->pub_ext_camera_info_) {
1238 ExtendedCameraInfo extended_camera_info_msg;
1239 p_can->extended_camera_info_mutex_.lock();
1240 arv_camera_gv_select_stream_channel(p_can->p_camera_, stream_id);
1241 extended_camera_info_msg.camera_info = *(p_can->camera_infos_[stream_id]);
1242 p_can->fillExtendedCameraInfoMessage(extended_camera_info_msg);
1243 p_can->extended_camera_info_mutex_.unlock();
1244 p_can->extended_camera_info_pubs_[stream_id].publish(extended_camera_info_msg);
1248 if (p_can->use_ptp_stamp_)
1249 p_can->resetPtpClock();
1253 if (arv_buffer_get_status(p_buffer) != ARV_BUFFER_STATUS_SUCCESS) {
1256 arv_stream_push_buffer(p_stream, p_buffer);
1261 if (p_can->config_.AutoMaster)
1263 p_can->syncAutoParameters();
1264 p_can->auto_pub_.publish(p_can->auto_params_);
1270 const char *vendor_name = arv_camera_get_vendor_name(
p_camera_);
1272 if (strcmp(
"Basler", vendor_name) == 0) {
1273 msg.exposure_time = arv_device_get_float_feature_value(
p_device_,
"ExposureTimeAbs");
1277 msg.exposure_time = arv_device_get_float_feature_value(
p_device_,
"ExposureTime");
1280 if (strcmp(
"Basler", vendor_name) == 0) {
1281 msg.gain =
static_cast<float>(arv_device_get_integer_feature_value(
p_device_,
"GainRaw"));
1285 msg.gain = arv_device_get_float_feature_value(
p_device_,
"Gain");
1287 if (strcmp(
"Basler", vendor_name) == 0) {
1288 arv_device_set_string_feature_value(
p_device_,
"BlackLevelSelector",
"All");
1289 msg.black_level =
static_cast<float>(arv_device_get_integer_feature_value(
p_device_,
"BlackLevelRaw"));
1290 }
else if (strcmp(
"JAI Corporation", vendor_name) == 0) {
1293 msg.black_level = 0;
1295 arv_device_set_string_feature_value(
p_device_,
"BlackLevelSelector",
"All");
1296 msg.black_level = arv_device_get_float_feature_value(
p_device_,
"BlackLevel");
1300 if (strcmp(
"The Imaging Source Europe GmbH", vendor_name) == 0)
1302 msg.white_balance_red = arv_device_get_integer_feature_value(
p_device_,
"WhiteBalanceRedRegister") / 255.;
1303 msg.white_balance_green = arv_device_get_integer_feature_value(
p_device_,
"WhiteBalanceGreenRegister") / 255.;
1304 msg.white_balance_blue = arv_device_get_integer_feature_value(
p_device_,
"WhiteBalanceBlueRegister") / 255.;
1308 else if (strcmp(
"JAI Corporation", vendor_name) == 0)
1310 msg.white_balance_red = 1.0;
1311 msg.white_balance_green = 1.0;
1312 msg.white_balance_blue = 1.0;
1315 else if (strcmp(
"Basler", vendor_name) == 0)
1317 arv_device_set_string_feature_value(
p_device_,
"BalanceRatioSelector",
"Red");
1318 msg.white_balance_red = arv_device_get_float_feature_value(
p_device_,
"BalanceRatioAbs");
1319 arv_device_set_string_feature_value(
p_device_,
"BalanceRatioSelector",
"Green");
1320 msg.white_balance_green = arv_device_get_float_feature_value(
p_device_,
"BalanceRatioAbs");
1321 arv_device_set_string_feature_value(
p_device_,
"BalanceRatioSelector",
"Blue");
1322 msg.white_balance_blue = arv_device_get_float_feature_value(
p_device_,
"BalanceRatioAbs");
1327 arv_device_set_string_feature_value(
p_device_,
"BalanceRatioSelector",
"Red");
1328 msg.white_balance_red = arv_device_get_float_feature_value(
p_device_,
"BalanceRatio");
1329 arv_device_set_string_feature_value(
p_device_,
"BalanceRatioSelector",
"Green");
1330 msg.white_balance_green = arv_device_get_float_feature_value(
p_device_,
"BalanceRatio");
1331 arv_device_set_string_feature_value(
p_device_,
"BalanceRatioSelector",
"Blue");
1332 msg.white_balance_blue = arv_device_get_float_feature_value(
p_device_,
"BalanceRatio");
1335 if (strcmp(
"Basler", vendor_name) == 0) {
1336 msg.temperature =
static_cast<float>(arv_device_get_float_feature_value(
p_device_,
"TemperatureAbs"));
1340 msg.temperature = arv_device_get_float_feature_value(
p_device_,
"DeviceTemperature");
1348 ROS_ERROR(
"Control to aravis device lost.");
1349 nodelet::NodeletUnload unload_service;
1350 unload_service.request.name = p_can->getName();
1360 ROS_INFO(
"Software trigger started.");
1361 std::chrono::system_clock::time_point next_time = std::chrono::system_clock::now();
1364 next_time += std::chrono::milliseconds(
size_t(std::round(1000.0 /
config_.softwaretriggerrate)));
1369 arv_device_execute_command(
p_device_,
"TriggerSoftware");
1371 if (next_time > std::chrono::system_clock::now())
1373 std::this_thread::sleep_until(next_time);
1377 ROS_WARN(
"Camera Aravis: Missed a software trigger event.");
1378 next_time = std::chrono::system_clock::now();
1381 ROS_INFO(
"Software trigger stopped.");
1387 ROS_WARN(
"Publishing dynamic camera transforms (/tf) at %g Hz", rate);
1411 ArvGc *gc = arv_device_get_genicam(
p_device_);
1415 std::list<ArvDomNode*> todo;
1416 todo.push_front((ArvDomNode*)arv_gc_get_node(gc,
"Root"));
1418 while (!todo.empty())
1421 ArvDomNode *node = todo.front();
1423 const std::string name(arv_dom_node_get_node_name(node));
1428 if (name.compare(
"pInvalidator") == 0)
1432 ArvDomNode *inode = (ArvDomNode*)arv_gc_get_node(gc,
1433 arv_dom_node_get_node_value(arv_dom_node_get_first_child(node)));
1435 todo.push_front(inode);
1440 if (ARV_IS_GC_FEATURE_NODE(node))
1443 ArvGcFeatureNode *fnode = ARV_GC_FEATURE_NODE(node);
1444 const std::string fname(arv_gc_feature_node_get_name(fnode));
1445 const bool usable = arv_gc_feature_node_is_available(fnode, NULL)
1446 && arv_gc_feature_node_is_implemented(fnode, NULL);
1460 ArvDomNodeList *children = arv_dom_node_get_child_nodes(node);
1461 const uint l = arv_dom_node_list_get_length(children);
1462 for (uint i = 0; i < l; ++i)
1464 todo.push_front(arv_dom_node_list_get_item(children, i));
1470 size_t array_start = 0;
1471 size_t array_end = in_arg_string.length();
1472 if(array_start != std::string::npos && array_end != std::string::npos) {
1474 std::stringstream ss(in_arg_string.substr(array_start, array_end - array_start));
1477 getline( ss, temp,
',');
1478 boost::trim_left(temp);
1479 boost::trim_right(temp);
1480 out_args.push_back(temp);
1484 out_args.push_back(in_arg_string);
1501 ArvGcNode *p_gc_node;
1502 GError *error = NULL;
1508 for (iter = xml_rpc_params.
begin(); iter != xml_rpc_params.
end(); iter++)
1510 std::string key = iter->first;
1512 p_gc_node = arv_device_get_feature(
p_device_, key.c_str());
1513 if (p_gc_node && arv_gc_feature_node_is_implemented(ARV_GC_FEATURE_NODE(p_gc_node), &error))
1519 switch (iter->second.getType())
1523 int value = (bool)iter->second;
1524 arv_device_set_integer_feature_value(
p_device_, key.c_str(), value);
1525 ROS_INFO(
"Read parameter (bool) %s: %d", key.c_str(), value);
1531 int value = (int)iter->second;
1532 arv_device_set_integer_feature_value(
p_device_, key.c_str(), value);
1533 ROS_INFO(
"Read parameter (int) %s: %d", key.c_str(), value);
1539 double value = (double)iter->second;
1540 arv_device_set_float_feature_value(
p_device_, key.c_str(), value);
1541 ROS_INFO(
"Read parameter (float) %s: %f", key.c_str(), value);
1547 std::string value = (std::string)iter->second;
1548 arv_device_set_string_feature_value(
p_device_, key.c_str(), value.c_str());
1549 ROS_INFO(
"Read parameter (string) %s: %s", key.c_str(), value.c_str());
1559 ROS_WARN(
"Unhandled rosparam type in writeCameraFeaturesFromRosparam()");