Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 30 additions & 30 deletions cfg/Camera1394.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -191,69 +191,69 @@ controls = gen.enum([gen.const("Off", int_t, 0, "Use fixed value"),
gen.add("auto_brightness", int_t, SensorLevels.RECONFIGURE_RUNNING,
"Brightness control state.", 1, 0, 4, edit_method = controls)

gen.add("brightness", double_t, SensorLevels.RECONFIGURE_RUNNING,
"Black level offset.", 0., 0., 4095.)
gen.add("brightness", int_t, SensorLevels.RECONFIGURE_RUNNING,
"Black level offset.", 0, 0, 4095)

gen.add("auto_exposure", int_t, SensorLevels.RECONFIGURE_RUNNING,
"Combined Gain, Iris & Shutter control.",
1, 0, 4, edit_method = controls)

gen.add("exposure", double_t, SensorLevels.RECONFIGURE_RUNNING,
"Auto exposure value (like contrast).", 0., -10., 4095.)
gen.add("exposure", int_t, SensorLevels.RECONFIGURE_RUNNING,
"Auto exposure value (like contrast).", 0, 0, 4095)

gen.add("auto_focus", int_t, SensorLevels.RECONFIGURE_RUNNING,
"Focus control state.", 1, 0, 4, edit_method= controls)

gen.add("focus", double_t, SensorLevels.RECONFIGURE_RUNNING,
"Focus control.", 0., 0., 4095.)
gen.add("focus", int_t, SensorLevels.RECONFIGURE_RUNNING,
"Focus control.", 0, 0, 4095)

gen.add("auto_gain", int_t, SensorLevels.RECONFIGURE_RUNNING,
"Gain control state.", 1, 0, 4, edit_method = controls)

gen.add("gain", double_t, SensorLevels.RECONFIGURE_RUNNING,
"Relative circuit gain.", 0., -10., 4095)
gen.add("gain", int_t, SensorLevels.RECONFIGURE_RUNNING,
"Relative circuit gain.", 0, 0, 4095)

gen.add("auto_gamma", int_t, SensorLevels.RECONFIGURE_RUNNING,
"Gamma control state.", 1, 0, 4, edit_method = controls)

gen.add("gamma", double_t, SensorLevels.RECONFIGURE_RUNNING,
"Gamma expansion exponent.", 2.2, 0., 10.)
gen.add("gamma", int_t, SensorLevels.RECONFIGURE_RUNNING,
"Gamma expansion exponent.", 0, 0, 4095)

gen.add("auto_hue", int_t, SensorLevels.RECONFIGURE_RUNNING,
"Hue control state.", 1, 0, 4, edit_method = controls)

gen.add("hue", double_t, SensorLevels.RECONFIGURE_RUNNING,
"Color phase.", 0., 0., 4095.)
gen.add("hue", int_t, SensorLevels.RECONFIGURE_RUNNING,
"Color phase.", 0, 0, 4095)

gen.add("auto_iris", int_t, SensorLevels.RECONFIGURE_RUNNING,
"Iris control state.", 1, 0, 4, edit_method = controls)

gen.add("iris", double_t, SensorLevels.RECONFIGURE_RUNNING,
"Iris control.", 8., 0., 4095.)
gen.add("iris", int_t, SensorLevels.RECONFIGURE_RUNNING,
"Iris control.", 0, 0, 4095)

gen.add("auto_pan", int_t, SensorLevels.RECONFIGURE_RUNNING,
"Pan control state.", 1, 0, 4, edit_method = controls)

gen.add("pan", double_t, SensorLevels.RECONFIGURE_RUNNING,
"Pan control.", 0., 0., 4095.)
gen.add("pan", int_t, SensorLevels.RECONFIGURE_RUNNING,
"Pan control.", 0, 0, 4095)

gen.add("auto_saturation", int_t, SensorLevels.RECONFIGURE_RUNNING,
"Saturation control state.", 1, 0, 4, edit_method = controls)

gen.add("saturation", double_t, SensorLevels.RECONFIGURE_RUNNING,
"Color saturation.", 1., 0., 4095.)
gen.add("saturation", int_t, SensorLevels.RECONFIGURE_RUNNING,
"Color saturation.", 0, 0, 4095)

gen.add("auto_sharpness", int_t, SensorLevels.RECONFIGURE_RUNNING,
"Sharpness control state.", 1, 0, 4, edit_method = controls)

gen.add("sharpness", double_t, SensorLevels.RECONFIGURE_RUNNING,
"Image sharpness.", 1., 0., 4095.)
gen.add("sharpness", int_t, SensorLevels.RECONFIGURE_RUNNING,
"Image sharpness.", 1, 0, 4095)

gen.add("auto_shutter", int_t, SensorLevels.RECONFIGURE_RUNNING,
"Shutter control state.", 1, 0, 4, edit_method = controls)

gen.add("shutter", double_t, SensorLevels.RECONFIGURE_RUNNING,
"Shutter speed.", 1., 0., 4095.)
gen.add("shutter", int_t, SensorLevels.RECONFIGURE_RUNNING,
"Shutter speed.", 0, 0, 4095)

gen.add("external_trigger", bool_t, SensorLevels.RECONFIGURE_RUNNING,
"External trigger power state", False)
Expand Down Expand Up @@ -299,25 +299,25 @@ gen.add("trigger_polarity", str_t, SensorLevels.RECONFIGURE_RUNNING,
gen.add("auto_trigger", int_t, SensorLevels.RECONFIGURE_RUNNING,
"Trigger control state.", 1, 0, 4, edit_method = controls)

gen.add("trigger", double_t, SensorLevels.RECONFIGURE_RUNNING,
"Trigger parameter N", 0., 0., 4095.)
gen.add("trigger", int_t, SensorLevels.RECONFIGURE_RUNNING,
"Trigger parameter N", 0, 0, 4095)

gen.add("auto_white_balance", int_t, SensorLevels.RECONFIGURE_RUNNING,
"White balance control state.", 1, 0, 4, edit_method = controls)

gen.add("white_balance_BU", double_t, SensorLevels.RECONFIGURE_RUNNING,
gen.add("white_balance_BU", int_t, SensorLevels.RECONFIGURE_RUNNING,
"Blue or U component of white balance.",
0., 0., 4095.)
0, 0, 4095)

gen.add("white_balance_RV", double_t, SensorLevels.RECONFIGURE_RUNNING,
gen.add("white_balance_RV", int_t, SensorLevels.RECONFIGURE_RUNNING,
"Red or V component of white balance.",
0., 0., 4095.)
0, 0, 4095)

gen.add("auto_zoom", int_t, SensorLevels.RECONFIGURE_RUNNING,
"Zoom control state.", 1, 0, 4, edit_method = controls)

gen.add("zoom", double_t, SensorLevels.RECONFIGURE_RUNNING,
"Zoom control.", 0., 0., 4095.)
gen.add("zoom", int_t, SensorLevels.RECONFIGURE_RUNNING,
"Zoom control.", 0, 0, 4095)

PACKAGE='camera1394'
exit(gen.generate(PACKAGE, "Camera1394", "Camera1394"))
61 changes: 7 additions & 54 deletions src/nodes/features.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ void Features::reconfigure(Config *newconfig)
* represent all possible option values accurately.
*/
void Features::configure(dc1394feature_t feature, int *control,
double *value, double *value2)
int *value, int *value2)
{
// device-relevant information for this feature
dc1394feature_info_t *finfo =
Expand Down Expand Up @@ -314,37 +314,7 @@ void Features::configure(dc1394feature_t feature, int *control,
break;
}

// TODO: break this into some internal methods
if (finfo->absolute_capable && finfo->abs_control)
{
// supports reading and setting float value
float fmin, fmax;
if (DC1394_SUCCESS ==
dc1394_feature_get_absolute_boundaries(camera_, feature,
&fmin, &fmax))
{
// clamp *value between minimum and maximum
if (*value < fmin)
*value = (double) fmin;
else if (*value > fmax)
*value = (double) fmax;
}
else
{
ROS_WARN_STREAM("failed to get feature "
<< featureName(feature) << " boundaries ");
}

// @todo handle absolute White Balance values
float fval = *value;
if (DC1394_SUCCESS !=
dc1394_feature_set_absolute_value(camera_, feature, fval))
{
ROS_WARN_STREAM("failed to set feature "
<< featureName(feature) << " to " << fval);
}
}
else // no float representation
// no float representation
{
// round requested value to nearest integer
*value = rint(*value);
Expand Down Expand Up @@ -479,7 +449,7 @@ Features::state_t Features::getState(dc1394feature_info_t *finfo)
* for white balance. Otherwise NULL.
*/
void Features::getValues(dc1394feature_info_t *finfo,
double *value, double *value2)
int *value, int *value2)
{
dc1394feature_t feature = finfo->id;
dc1394error_t rc;
Expand All @@ -494,13 +464,6 @@ void Features::getValues(dc1394feature_info_t *finfo,
if (feature == DC1394_FEATURE_WHITE_BALANCE)
{
// handle White Balance separately, it has two components
if (finfo->absolute_capable && finfo->abs_control)
{
// supports reading and setting float value
// @todo get absolute White Balance values
rc = DC1394_FUNCTION_NOT_SUPPORTED;
}
else
{
// get integer White Balance values
uint32_t bu_val;
Expand Down Expand Up @@ -528,17 +491,7 @@ void Features::getValues(dc1394feature_info_t *finfo,
else
{
// other features only have one component
if (finfo->absolute_capable && finfo->abs_control)
{
// supports reading and setting float value
float fval;
rc = dc1394_feature_get_absolute_value(camera_, feature, &fval);
if (DC1394_SUCCESS == rc)
{
*value = fval; // convert to double
}
}
else // no float representation
// no float representation
{
uint32_t ival;
rc = dc1394_feature_get_value(camera_, feature, &ival);
Expand Down Expand Up @@ -641,7 +594,7 @@ void Features::setPower(dc1394feature_info_t *finfo, dc1394switch_t on_off)
*/
void Features::updateIfChanged(dc1394feature_t feature,
int old_control, int *control,
double old_value, double *value)
int old_value, int *value)
{
if ((old_control != *control) || (old_value != *value))
{
Expand All @@ -668,8 +621,8 @@ void Features::updateIfChanged(dc1394feature_t feature,
*/
void Features::updateIfChanged(dc1394feature_t feature,
int old_control, int *control,
double old_value, double *value,
double old_value2, double *value2)
int old_value, int *value,
int old_value2, int *value2)
{
if ((old_control != *control)
|| (old_value != *value)
Expand Down
10 changes: 5 additions & 5 deletions src/nodes/features.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ class Features
typedef int state_t; ///< camera1394::Camera1394_* state values

void configure(dc1394feature_t feature, int *control,
double *value, double *value2=NULL);
int *value, int *value2=NULL);
state_t getState(dc1394feature_info_t *finfo);
void getValues(dc1394feature_info_t *finfo,
double *value, double *value2);
int *value, int *value2);

/** Does this camera feature support a given mode?
*
Expand Down Expand Up @@ -117,11 +117,11 @@ class Features
void setPower(dc1394feature_info_t *finfo, dc1394switch_t on_off);
void updateIfChanged(dc1394feature_t feature,
int old_control, int *control,
double old_value, double *value);
int old_value, int *value);
void updateIfChanged(dc1394feature_t feature,
int old_control, int *control,
double old_value, double *value,
double old_value2, double *value2);
int old_value, int *value,
int old_value2, int *value2);

dc1394camera_t *camera_; ///< current camera
dc1394featureset_t feature_set_; ///< that camera's feature set
Expand Down