Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphael Palefsky-Smith committed Nov 27, 2017
1 parent 77301f2 commit d9633fa
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 10 deletions.
8 changes: 4 additions & 4 deletions cmake/FindEbus.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand All @@ -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()
Expand All @@ -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}
Expand Down
1 change: 1 addition & 0 deletions include/flir_gige/flir_gige.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion install/set_puregev_gen
Original file line number Diff line number Diff line change
@@ -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
Expand Down
57 changes: 57 additions & 0 deletions launch/auto.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<launch>
<!-- Common Interface -->
<arg name="device" default="0.0.0.0"/>
<arg name="rate" default="30"/>

<!-- Camera Settings -->
<arg name="ip_address" default="$(arg device)"/>
<arg name="camera_name" default="flir_ax5"/>
<arg name="camera" default="thermal"/>
<arg name="frame_id" default="$(arg camera)"/>
<arg name="calib_url" default=""/>
<arg name="fps" default="$(arg rate)"/>
<arg name="raw" default="true"/>

<!-- Node Settings -->
<arg name="output" default="screen"/>
<arg name="view" default="false"/>
<arg name="calib" default="false"/>
<arg name="calib_proc" default="false"/>
<arg name="thermal_proc" default="false"/>

<!-- Node -->
<node pkg="flir_gige" type="flir_gige_node" name="$(arg camera)"
output="$(arg output)">
<param name="identifier" type="string" value="$(arg ip_address)"/>
<param name="camera_name" type="string" value="$(arg camera_name)"/>
<param name="calib_url" type="string" value="$(arg calib_url)"/>
<param name="frame_id" type="string" value="$(arg frame_id)"/>
<param name="fps" type="double" value="$(arg fps)"/>
<param name="raw" type="bool" value="$(arg raw)"/>
</node>

<!-- View -->
<arg name="image" default="image_raw"/>
<node if="$(arg view)"
pkg="image_view" type="image_view" name="viewer"
output="$(arg output)" ns="$(arg camera)" args="image:=$(arg image)">
</node>

<!--Calib proc-->
<node if="$(arg calib_proc)"
pkg="flir_gige" type="calib_proc_node" name="calib_proc"
ns="$(arg camera)">
</node>

<!-- Calib -->
<group if="$(arg calib)">
<arg name="pattern" default="chessboard"/>
<arg name="size"/>
<arg name="square"/>
<node pkg="camera_calibration" type="cameracalibrator.py"
name="calibrator" output="screen"
args="-p $(arg pattern) -s $(arg size) -q $(arg square)
image:=/$(arg camera)/image_raw camera:=/$(arg camera)">
</node>
</group>
</launch>
47 changes: 43 additions & 4 deletions src/flir_gige/flir_gige.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include <PvGenParameterArray.h>
#include <PvGenParameter.h>
#include <PvGenEnum.h>

namespace flir_gige {

Expand All @@ -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() {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -244,6 +260,28 @@ void FlirGige::CacheParams() {
param_array_->GetIntegerValue("Width", width);
param_array_->GetIntegerValue("Height", height);

// PvGenEnum *lBitPawmeter = dynamic_cast<PvGenEnum *>( 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);

Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/thermal_proc/thermal_proc_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <algorithm>
#include <cmath>

#include <opencv2/contrib/contrib.hpp>


namespace flir_gige {

Expand Down

0 comments on commit d9633fa

Please sign in to comment.