Skip to content

Commit

Permalink
Merge pull request #21 from bgromov/trigger
Browse files Browse the repository at this point in the history
Return corrected parameter values to dynamic_reconfigure (fix #14)
  • Loading branch information
jack-oquin committed Aug 30, 2013
2 parents 491e0e1 + 1f69dfd commit 24d71be
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/nodes/trigger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,9 @@ bool Trigger::reconfigure(Config *newconfig)
is_ok = false;
}

// if external trigger is OFF then ignore rest of parameters
if (DC1394_OFF == on_off) return is_ok;

on_off = (dc1394switch_t) newconfig->software_trigger;
if (!Trigger::setSoftwareTriggerPowerState(camera_, on_off))
{
Expand All @@ -439,6 +442,9 @@ bool Trigger::reconfigure(Config *newconfig)
{
if (!Trigger::setMode(camera_, triggerMode_))
{
// Possible if driver compiled against different version of libdc1394
ROS_ASSERT(triggerMode_ <= DC1394_TRIGGER_MODE_MAX);
newconfig->trigger_mode = Trigger::trigger_mode_names_[triggerMode_ - DC1394_TRIGGER_MODE_MIN];
ROS_ERROR("Failed to set trigger mode");
is_ok = false;
}
Expand All @@ -455,6 +461,9 @@ bool Trigger::reconfigure(Config *newconfig)
{
if (!Trigger::setSource(camera_, triggerSource_))
{
// Possible if driver compiled against different version of libdc1394
ROS_ASSERT(triggerSource_ <= DC1394_TRIGGER_SOURCE_MAX);
newconfig->trigger_source = Trigger::trigger_source_names_[triggerSource_ - DC1394_TRIGGER_SOURCE_MIN];
ROS_ERROR("Failed to set trigger source");
is_ok = false;
}
Expand All @@ -474,6 +483,9 @@ bool Trigger::reconfigure(Config *newconfig)
{
if (!Trigger::setPolarity(camera_, triggerPolarity_))
{
// Possible if driver compiled against different version of libdc1394
ROS_ASSERT(triggerPolarity_ <= DC1394_TRIGGER_ACTIVE_MAX);
newconfig->trigger_polarity = Trigger::trigger_polarity_names_[triggerPolarity_ - DC1394_TRIGGER_ACTIVE_MIN];
ROS_ERROR("Failed to set trigger polarity");
is_ok = false;
}
Expand Down

0 comments on commit 24d71be

Please sign in to comment.