From 14b61089071e8c2c4e14b6ef496b3a2dc694f38a Mon Sep 17 00:00:00 2001 From: Boris Gromov <0xff.root@gmail.com> Date: Thu, 29 Aug 2013 00:17:58 +0900 Subject: [PATCH 1/2] Return corrected parameter value to dynamic_reconfigure --- src/nodes/trigger.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/nodes/trigger.cpp b/src/nodes/trigger.cpp index 5ffb011..f98f9f2 100644 --- a/src/nodes/trigger.cpp +++ b/src/nodes/trigger.cpp @@ -439,6 +439,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; } @@ -455,6 +458,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; } @@ -474,6 +480,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; } From 1f69dfdd06bbe36dddbec15525a1e3c2ffe162b3 Mon Sep 17 00:00:00 2001 From: Boris Gromov <0xff.root@gmail.com> Date: Thu, 29 Aug 2013 01:52:23 +0900 Subject: [PATCH 2/2] Ignore other trigger parameters if 'external_trigger' is false --- src/nodes/trigger.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/nodes/trigger.cpp b/src/nodes/trigger.cpp index f98f9f2..da30cc8 100644 --- a/src/nodes/trigger.cpp +++ b/src/nodes/trigger.cpp @@ -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)) {