From d9633fa87933fd317629b92e325ea83cfe3dc22f Mon Sep 17 00:00:00 2001 From: Raphael Palefsky-Smith Date: Sun, 26 Nov 2017 21:42:58 -0800 Subject: [PATCH] Initial commit --- cmake/FindEbus.cmake | 8 ++-- include/flir_gige/flir_gige.h | 1 + install/set_puregev_gen | 3 +- launch/auto.launch | 57 ++++++++++++++++++++++++++ src/flir_gige/flir_gige.cpp | 47 +++++++++++++++++++-- src/thermal_proc/thermal_proc_node.cpp | 2 +- 6 files changed, 108 insertions(+), 10 deletions(-) create mode 100644 launch/auto.launch diff --git a/cmake/FindEbus.cmake b/cmake/FindEbus.cmake index ae4fc44..9133a86 100644 --- a/cmake/FindEbus.cmake +++ b/cmake/FindEbus.cmake @@ -66,9 +66,9 @@ endmacro(Ebus_REPORT_NOT_FOUND) # Search user-installed locations first, so that we prefer user installs # to system installs where both exist. list(APPEND Ebus_CHECK_INCLUDE_DIRS - /opt/pleora/ebus_sdk/Ubuntu-12.04-x86_64/include) + /opt/pleora/ebus_sdk/Ubuntu-x86_64/include) list(APPEND Ebus_CHECK_LIBRARY_DIRS - /opt/pleora/ebus_sdk/Ubuntu-12.04-x86_64/lib) + /opt/pleora/ebus_sdk/Ubuntu-x86_64/lib) # Check general hints if(Ebus_HINTS AND EXISTS ${Ebus_HINTS}) @@ -87,7 +87,7 @@ if(NOT Ebus_INCLUDE_DIR OR NOT EXISTS ${Ebus_INCLUDE_DIR}) Ebus_REPORT_NOT_FOUND( "Could not find ebus include directory, set Ebus_INCLUDE_DIR to " "path to ebus include directory," - "e.g. /opt/pleora/ebus_sdk/Ubuntu-12.04-x86_64/include.") + "e.g. /opt/pleora/ebus_sdk/Ubuntu-x86_64/include.") else() message(STATUS "ebus include dir found: " ${Ebus_INCLUDE_DIR}) endif() @@ -111,7 +111,7 @@ endif() # called. set(Ebus_FOUND TRUE) -# Extract ebus version from ebus_sdk/Ubuntu-12.04-x86_64/lib/libPvBase.so.x.y.z +# Extract ebus version from ebus_sdk/Ubuntu-x86_64/lib/libPvBase.so.x.y.z if(Ebus_LIBRARY_DIR) file(GLOB Ebus_PVBASE RELATIVE ${Ebus_LIBRARY_DIR} diff --git a/include/flir_gige/flir_gige.h b/include/flir_gige/flir_gige.h index 07c7d47..97c29a4 100644 --- a/include/flir_gige/flir_gige.h +++ b/include/flir_gige/flir_gige.h @@ -55,6 +55,7 @@ class FlirGige { bool FindDevice(const std::string &ip, const PvDeviceInfoGEVVec &dinfo_gev_vec); std::string AvailableDevice(const PvDeviceInfoGEVVec &dinfo_gev_vec) const; + std::string FirstDeviceIPAddress(const PvDeviceInfoGEVVec &dinfo_gev_vec) const; PvDeviceInfoGEVVec GatherGevDevice() const; void ConnectDevice(); diff --git a/install/set_puregev_gen b/install/set_puregev_gen index a5dd874..f50fdf7 100644 --- a/install/set_puregev_gen +++ b/install/set_puregev_gen @@ -1,8 +1,9 @@ #!/bin/sh -export PUREGEV_ROOT=/opt/pleora/ebus_sdk/Ubuntu-12.04-x86_64 +export PUREGEV_ROOT=/opt/pleora/ebus_sdk/Ubuntu-x86_64 export GENICAM_ROOT=$PUREGEV_ROOT/lib/genicam export GENICAM_ROOT_V2_4=$GENICAM_ROOT +export GENICAM_ROOT_V3_0=$GENICAM_ROOT export GENICAM_LOG_CONFIG=$GENICAM_ROOT/log/config/DefaultLogging.properties export GENICAM_LOG_CONFIG_V2_4=$GENICAM_LOG_CONFIG if [ "$HOME" = "/" ]; then diff --git a/launch/auto.launch b/launch/auto.launch new file mode 100644 index 0000000..f7981ea --- /dev/null +++ b/launch/auto.launch @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/flir_gige/flir_gige.cpp b/src/flir_gige/flir_gige.cpp index 545bf89..df723e7 100644 --- a/src/flir_gige/flir_gige.cpp +++ b/src/flir_gige/flir_gige.cpp @@ -9,6 +9,7 @@ #include #include +#include namespace flir_gige { @@ -21,11 +22,19 @@ FlirGige::FlirGige(const std::string &ip_address) result.GetCodeString().GetAscii()); } const PvDeviceInfoGEVVec dinfo_gev_vec = GatherGevDevice(); - if (!FindDevice(ip_address, dinfo_gev_vec)) { - throw std::runtime_error(ip_address + - " not found. Available IP Address(es): " + - AvailableDevice(dinfo_gev_vec)); + + if (ip_address == "0.0.0.0") { + std::string first_address = FirstDeviceIPAddress(dinfo_gev_vec); + if (!first_address.empty() && FindDevice(first_address, dinfo_gev_vec)) { + ip_address_ = first_address; + return; + } } + else if (FindDevice(ip_address, dinfo_gev_vec)) + return; + + throw std::runtime_error(ip_address + " not found. Available IP Address(es): " + + AvailableDevice(dinfo_gev_vec)); } void FlirGige::Connect() { @@ -120,6 +129,13 @@ bool FlirGige::FindDevice(const std::string &ip, return true; } +std::string FlirGige::FirstDeviceIPAddress( + const PvDeviceInfoGEVVec &dinfo_gev_vec) const { + for (const PvDeviceInfoGEV *dinfo : dinfo_gev_vec) + return dinfo->GetIPAddress().GetAscii(); + return ""; +} + std::string FlirGige::AvailableDevice( const PvDeviceInfoGEVVec &dinfo_gev_vec) const { std::string devices; @@ -244,6 +260,28 @@ void FlirGige::CacheParams() { param_array_->GetIntegerValue("Width", width); param_array_->GetIntegerValue("Height", height); + // PvGenEnum *lBitPawmeter = dynamic_cast( param_array_->Get("DigitalOutput")); + + // if ( lBitParameter == NULL ) + // { + // ROS_INFO("Unable to get the bit enum."); + // } else { + // ROS_INFO("GOT BIT ENUM"); + // } + + // // Change bit value. + // int64_t new_bit = 3; + // if ( !lBitParameter->SetValue( new_bit ).IsOK() ) + // { + // ROS_INFO("Unable to change the bit enum."); + // } else { + // ROS_INFO("CHANGED BIT ENUM"); + // } + // param_array_->SetEnumValue("DigitalOutput", new_bit); + + + + int64_t bit; param_array_->GetEnumValue("DigitalOutput", bit); @@ -254,6 +292,7 @@ void FlirGige::CacheParams() { param_array_->GetFloatValue("B", B); param_array_->GetFloatValue("O", O); + cache_.B = B; cache_.F = F; cache_.O = O; diff --git a/src/thermal_proc/thermal_proc_node.cpp b/src/thermal_proc/thermal_proc_node.cpp index 6b9ec2f..208995a 100644 --- a/src/thermal_proc/thermal_proc_node.cpp +++ b/src/thermal_proc/thermal_proc_node.cpp @@ -3,7 +3,7 @@ #include #include -#include + namespace flir_gige {