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];
146 ROS_ERROR(
"could not get camera feature information");
152 &newconfig->auto_brightness, &newconfig->brightness);
154 &newconfig->auto_exposure, &newconfig->exposure);
156 &newconfig->auto_focus, &newconfig->focus);
158 &newconfig->auto_gain, &newconfig->gain);
160 &newconfig->auto_gamma, &newconfig->gamma);
162 &newconfig->auto_hue, &newconfig->hue);
164 &newconfig->auto_iris, &newconfig->iris);
166 &newconfig->auto_saturation, &newconfig->saturation);
168 &newconfig->auto_sharpness, &newconfig->sharpness);
170 &newconfig->auto_shutter, &newconfig->shutter);
172 &newconfig->auto_trigger, &newconfig->trigger);
174 &newconfig->auto_pan, &newconfig->pan);
176 &newconfig->auto_frame_rate_feature, &newconfig->frame_rate_feature);
177 configure(DC1394_FEATURE_WHITE_BALANCE, &newconfig->auto_white_balance,
178 &newconfig->white_balance_BU, &newconfig->white_balance_RV);
180 &newconfig->auto_zoom, &newconfig->zoom);
184 retval =
trigger_->initialize(newconfig);
206 oldconfig_.auto_brightness, &newconfig->auto_brightness,
207 oldconfig_.brightness, &newconfig->brightness);
209 oldconfig_.auto_exposure, &newconfig->auto_exposure,
212 oldconfig_.auto_focus, &newconfig->auto_focus,
218 oldconfig_.auto_gamma, &newconfig->auto_gamma,
227 oldconfig_.auto_saturation, &newconfig->auto_saturation,
228 oldconfig_.saturation, &newconfig->saturation);
230 oldconfig_.auto_sharpness, &newconfig->auto_sharpness,
233 oldconfig_.auto_shutter, &newconfig->auto_shutter,
239 oldconfig_.auto_frame_rate_feature, &newconfig->auto_frame_rate_feature,
240 oldconfig_.frame_rate_feature, &newconfig->frame_rate_feature);
242 oldconfig_.auto_trigger, &newconfig->auto_trigger,
248 &newconfig->auto_white_balance,
249 oldconfig_.white_balance_BU, &newconfig->white_balance_BU,
250 oldconfig_.white_balance_RV, &newconfig->white_balance_RV);
286 double *value,
double *value2)
289 dc1394feature_info_t *finfo =
292 if (!finfo->available)
294 *control = camera1394stereo::Camera1394Stereo_None;
300 case camera1394stereo::Camera1394Stereo_Off:
304 case camera1394stereo::Camera1394Stereo_Query:
308 case camera1394stereo::Camera1394Stereo_Auto:
309 if (!
setMode(finfo, DC1394_FEATURE_MODE_AUTO))
315 case camera1394stereo::Camera1394Stereo_Manual:
316 if (!
setMode(finfo, DC1394_FEATURE_MODE_MANUAL))
323 if (finfo->absolute_capable && finfo->abs_control)
327 if (DC1394_SUCCESS ==
328 dc1394_feature_get_absolute_boundaries(
camera_, feature,
333 *value = (double) fmin;
334 else if (*value > fmax)
335 *value = (double) fmax;
340 << featureName(feature) <<
" boundaries ");
345 if (DC1394_SUCCESS !=
346 dc1394_feature_set_absolute_value(
camera_, feature, fval))
349 << featureName(feature) <<
" to " << fval);
355 *value = rint(*value);
358 if (*value < finfo->
min)
359 *value = (double) finfo->min;
360 else if (*value > finfo->max)
361 *value = (double) finfo->max;
364 uint32_t ival = (uint32_t) *value;
367 if (feature == DC1394_FEATURE_WHITE_BALANCE)
369 *value2 = rint(*value2);
372 if (*value2 < finfo->min)
373 *value2 = (double) finfo->min;
374 else if (*value2 > finfo->max)
375 *value2 = (double) finfo->max;
377 uint32_t ival2 = (uint32_t) *value2;
378 rc = dc1394_feature_whitebalance_set_value(
camera_, ival, ival2);
383 rc = dc1394_feature_set_value(
camera_, feature, ival);
385 if (rc != DC1394_SUCCESS)
388 << featureName(feature) <<
" to " << ival);
393 case camera1394stereo::Camera1394Stereo_OnePush:
395 setMode(finfo, DC1394_FEATURE_MODE_ONE_PUSH_AUTO);
401 case camera1394stereo::Camera1394Stereo_None:
404 <<
" exists, cannot set to None");
409 <<
") for feature " << featureName(feature));
415 <<
" now in state " << *control);
427 dc1394feature_t feature = finfo->id;
430 if (!finfo->available)
433 return camera1394stereo::Camera1394Stereo_None;
436 if (finfo->on_off_capable)
440 rc = dc1394_feature_get_power(
camera_, feature, &pwr);
441 if (rc != DC1394_SUCCESS)
444 <<
" Power setting ");
446 else if (pwr == DC1394_OFF)
449 return camera1394stereo::Camera1394Stereo_Off;
454 dc1394feature_mode_t mode;
455 rc = dc1394_feature_get_mode(
camera_, feature, &mode);
456 if (rc != DC1394_SUCCESS)
459 << featureName(feature));
461 return camera1394stereo::Camera1394Stereo_Off;
466 case DC1394_FEATURE_MODE_MANUAL:
467 return camera1394stereo::Camera1394Stereo_Manual;
468 case DC1394_FEATURE_MODE_AUTO:
469 return camera1394stereo::Camera1394Stereo_Auto;
470 case DC1394_FEATURE_MODE_ONE_PUSH_AUTO:
471 return camera1394stereo::Camera1394Stereo_OnePush;
473 return camera1394stereo::Camera1394Stereo_Off;
487 double *value,
double *value2)
489 dc1394feature_t feature = finfo->id;
492 if (!finfo->readout_capable)
495 <<
" value not available from device");
499 if (feature == DC1394_FEATURE_WHITE_BALANCE)
502 if (finfo->absolute_capable && finfo->abs_control)
506 rc = DC1394_FUNCTION_NOT_SUPPORTED;
513 rc = dc1394_feature_whitebalance_get_value(
camera_, &bu_val, &rv_val);
514 if (DC1394_SUCCESS == rc)
521 if (DC1394_SUCCESS == rc)
524 <<
" Blue/U: " << *value
525 <<
" Red/V: " << *value2);
530 << featureName(feature));
536 if (finfo->absolute_capable && finfo->abs_control)
540 rc = dc1394_feature_get_absolute_value(
camera_, feature, &fval);
541 if (DC1394_SUCCESS == rc)
549 rc = dc1394_feature_get_value(
camera_, feature, &ival);
550 if (DC1394_SUCCESS == rc)
555 if (DC1394_SUCCESS == rc)
558 <<
" has value " << *value);
563 << featureName(feature));
578 dc1394feature_t feature = finfo->id;
582 <<
" mode to " << modeName(mode));
583 if (DC1394_SUCCESS !=
584 dc1394_feature_set_mode(
camera_, feature, mode))
587 <<
" mode to " << modeName(mode));
595 <<
" mode for feature " << featureName(feature));
609 dc1394feature_t feature = finfo->id;
610 if (finfo->on_off_capable)
613 if (DC1394_SUCCESS !=
614 dc1394_feature_set_power(
camera_, feature, DC1394_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_
state_t getState(dc1394feature_info_t *finfo)
dc1394featureset_t feature_set_
that camera's feature set
camera1394stereo::Camera1394StereoConfig Config
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)
Camera1394 features interface.
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)
void setOff(dc1394feature_info_t *finfo)
int state_t
camera1394::Camera1394_* state values
#define ROS_INFO_STREAM(args)
Config oldconfig_
previous Config settings