56 static const char *feature_names_[DC1394_FEATURE_NUM] =
87 inline const char *featureName(dc1394feature_t feature)
89 if (feature >= DC1394_FEATURE_MIN && feature <= DC1394_FEATURE_MAX)
90 return feature_names_[feature - DC1394_FEATURE_MIN];
96 static const char *mode_names_[DC1394_FEATURE_MODE_NUM] =
108 inline const char *modeName(dc1394feature_mode_t mode)
110 if (mode >= DC1394_FEATURE_MODE_MIN && mode <= DC1394_FEATURE_MODE_MAX)
111 return mode_names_[mode - DC1394_FEATURE_MODE_MIN];
147 ROS_ERROR(
"could not get camera feature information");
153 &newconfig->auto_brightness, &newconfig->brightness);
155 &newconfig->auto_exposure, &newconfig->exposure);
157 &newconfig->auto_focus, &newconfig->focus);
159 &newconfig->auto_gain, &newconfig->gain);
161 &newconfig->auto_gamma, &newconfig->gamma);
163 &newconfig->auto_hue, &newconfig->hue);
165 &newconfig->auto_iris, &newconfig->iris);
167 &newconfig->auto_pan, &newconfig->pan);
169 &newconfig->auto_saturation, &newconfig->saturation);
171 &newconfig->auto_sharpness, &newconfig->sharpness);
173 &newconfig->auto_shutter, &newconfig->shutter);
175 &newconfig->auto_trigger, &newconfig->trigger);
176 configure(DC1394_FEATURE_WHITE_BALANCE, &newconfig->auto_white_balance,
177 &newconfig->white_balance_BU, &newconfig->white_balance_RV);
179 &newconfig->auto_zoom, &newconfig->zoom);
183 retval =
trigger_->initialize(newconfig);
205 oldconfig_.auto_brightness, &newconfig->auto_brightness,
206 oldconfig_.brightness, &newconfig->brightness);
208 oldconfig_.auto_exposure, &newconfig->auto_exposure,
211 oldconfig_.auto_focus, &newconfig->auto_focus,
217 oldconfig_.auto_gamma, &newconfig->auto_gamma,
229 oldconfig_.auto_saturation, &newconfig->auto_saturation,
230 oldconfig_.saturation, &newconfig->saturation);
232 oldconfig_.auto_sharpness, &newconfig->auto_sharpness,
235 oldconfig_.auto_shutter, &newconfig->auto_shutter,
238 oldconfig_.auto_trigger, &newconfig->auto_trigger,
243 &newconfig->auto_white_balance,
244 oldconfig_.white_balance_BU, &newconfig->white_balance_BU,
245 oldconfig_.white_balance_RV, &newconfig->white_balance_RV);
281 double *value,
double *value2)
284 dc1394feature_info_t *finfo =
287 if (!finfo->available)
289 *control = camera1394::Camera1394_None;
295 case camera1394::Camera1394_Off:
299 case camera1394::Camera1394_Query:
303 case camera1394::Camera1394_Auto:
304 if (!
setMode(finfo, DC1394_FEATURE_MODE_AUTO))
310 case camera1394::Camera1394_Manual:
311 if (!
setMode(finfo, DC1394_FEATURE_MODE_MANUAL))
318 if (finfo->absolute_capable && finfo->abs_control)
322 if (DC1394_SUCCESS ==
323 dc1394_feature_get_absolute_boundaries(
camera_, feature,
328 *value = (double) fmin;
329 else if (*value > fmax)
330 *value = (double) fmax;
335 << featureName(feature) <<
" boundaries ");
340 if (DC1394_SUCCESS !=
341 dc1394_feature_set_absolute_value(
camera_, feature, fval))
344 << featureName(feature) <<
" to " << fval);
350 *value = rint(*value);
353 if (*value < finfo->
min)
354 *value = (double) finfo->min;
355 else if (*value > finfo->max)
356 *value = (double) finfo->max;
359 uint32_t ival = (uint32_t) *value;
362 if (feature == DC1394_FEATURE_WHITE_BALANCE)
364 *value2 = rint(*value2);
367 if (*value2 < finfo->min)
368 *value2 = (double) finfo->min;
369 else if (*value2 > finfo->max)
370 *value2 = (double) finfo->max;
372 uint32_t ival2 = (uint32_t) *value2;
373 rc = dc1394_feature_whitebalance_set_value(
camera_, ival, ival2);
378 rc = dc1394_feature_set_value(
camera_, feature, ival);
380 if (rc != DC1394_SUCCESS)
383 << featureName(feature) <<
" to " << ival);
388 case camera1394::Camera1394_OnePush:
390 setMode(finfo, DC1394_FEATURE_MODE_ONE_PUSH_AUTO);
396 case camera1394::Camera1394_None:
399 <<
" exists, cannot set to None");
404 <<
") for feature " << featureName(feature));
410 <<
" now in state " << *control);
422 dc1394feature_t feature = finfo->id;
425 if (!finfo->available)
428 return camera1394::Camera1394_None;
431 if (finfo->on_off_capable)
435 rc = dc1394_feature_get_power(
camera_, feature, &pwr);
436 if (rc != DC1394_SUCCESS)
439 <<
" Power setting ");
441 else if (pwr == DC1394_OFF)
444 return camera1394::Camera1394_Off;
449 dc1394feature_mode_t mode;
450 rc = dc1394_feature_get_mode(
camera_, feature, &mode);
451 if (rc != DC1394_SUCCESS)
454 << featureName(feature));
456 return camera1394::Camera1394_Off;
461 case DC1394_FEATURE_MODE_MANUAL:
462 return camera1394::Camera1394_Manual;
463 case DC1394_FEATURE_MODE_AUTO:
464 return camera1394::Camera1394_Auto;
465 case DC1394_FEATURE_MODE_ONE_PUSH_AUTO:
466 return camera1394::Camera1394_OnePush;
468 return camera1394::Camera1394_Off;
482 double *value,
double *value2)
484 dc1394feature_t feature = finfo->id;
487 if (!finfo->readout_capable)
490 <<
" value not available from device");
494 if (feature == DC1394_FEATURE_WHITE_BALANCE)
497 if (finfo->absolute_capable && finfo->abs_control)
501 rc = DC1394_FUNCTION_NOT_SUPPORTED;
508 rc = dc1394_feature_whitebalance_get_value(
camera_, &bu_val, &rv_val);
509 if (DC1394_SUCCESS == rc)
516 if (DC1394_SUCCESS == rc)
519 <<
" Blue/U: " << *value
520 <<
" Red/V: " << *value2);
525 << featureName(feature));
531 if (finfo->absolute_capable && finfo->abs_control)
535 rc = dc1394_feature_get_absolute_value(
camera_, feature, &fval);
536 if (DC1394_SUCCESS == rc)
544 rc = dc1394_feature_get_value(
camera_, feature, &ival);
545 if (DC1394_SUCCESS == rc)
550 if (DC1394_SUCCESS == rc)
553 <<
" has value " << *value);
558 << featureName(feature));
573 dc1394feature_t feature = finfo->id;
580 <<
" mode to " << modeName(mode));
581 if (DC1394_SUCCESS !=
582 dc1394_feature_set_mode(
camera_, feature, mode))
585 <<
" mode to " << modeName(mode));
593 <<
" mode for feature " << featureName(feature));
608 dc1394feature_t feature = finfo->id;
609 if (finfo->on_off_capable)
612 <<
" to " << on_off);
613 if (DC1394_SUCCESS !=
614 dc1394_feature_set_power(
camera_, feature, on_off))
617 <<
" power to " << on_off);
643 int old_control,
int *control,
644 double old_value,
double *value)
646 if ((old_control != *control) || (old_value != *value))
670 int old_control,
int *control,
671 double old_value,
double *value,
672 double old_value2,
double *value2)
674 if ((old_control != *control)
675 || (old_value != *value)
676 || (old_value2 != *value2))
678 configure(feature, control, value, value2);
boost::shared_ptr< Trigger > trigger_
void setPower(dc1394feature_info_t *finfo, dc1394switch_t on_off)
state_t getState(dc1394feature_info_t *finfo)
dc1394featureset_t feature_set_
that camera's feature set
dc1394camera_t * camera_
current camera
void reconfigure(Config *newconfig)
void updateIfChanged(dc1394feature_t feature, int old_control, int *control, double old_value, double *value)
bool setMode(dc1394feature_info_t *finfo, dc1394feature_mode_t mode)
void getValues(dc1394feature_info_t *finfo, double *value, double *value2)
void configure(dc1394feature_t feature, int *control, double *value, double *value2=NULL)
bool initialize(Config *newconfig)
bool hasMode(dc1394feature_info_t *finfo, dc1394feature_mode_t mode)
libdc1394 triggering modes interface
#define ROS_WARN_STREAM(args)
#define ROS_DEBUG_STREAM(args)
Features(dc1394camera_t *camera)
int state_t
camera1394::Camera1394_* state values
#define ROS_INFO_STREAM(args)
Config oldconfig_
previous Config settings
camera1394::Camera1394Config Config
Camera1394 features interface.