Skip to content

Commit

Permalink
Merge pull request #40 from basler/feature/ace_fl_gige_introspection
Browse files Browse the repository at this point in the history
Feature/ace fl gige introspection
  • Loading branch information
thiesmoeller authored Apr 4, 2023
2 parents 78166a5 + e22e26a commit a1d4808
Show file tree
Hide file tree
Showing 8 changed files with 123 additions and 33 deletions.
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
e.g. a `gst-launch-1.0 pylonsrc | .... ` pipeline definition

**Expected behavior**
A clear and concise description of what you expected to happen.


**Environment**
- Camera: Modelname of the camera used
- plugin version info from `gst-inspect-1.0 pylonsrc | grep -E "Descr.*pylon.*|\s+Version\s+[0-9]+"`
- Platform: Hardware platform used
- OS: operating system and version. In case of containerized application, also the operating system of the base system
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
echo "Download result"
ls -l
md5sum *
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: pylon-installer
path: pylon-installer
Expand All @@ -68,7 +68,7 @@ jobs:
name: Build pylon ${{ matrix.py_version }} on ${{ matrix.os }}-x86_64
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: pylon-installer
path: pylon-installer
Expand Down Expand Up @@ -117,11 +117,11 @@ jobs:
os: [ubuntu18.04, ubuntu20.04, ubuntu22.04]
py_version: [7.2.1.25747, 7.1.0.25066, 6.2.0.21487 ]
fail-fast: false
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
name: Build pylon ${{ matrix.py_version }} on ${{ matrix.os }}-aarch64
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: pylon-installer
path: pylon-installer
Expand Down Expand Up @@ -194,15 +194,15 @@ jobs:
needs: prepare
strategy:
matrix:
os: [ubuntu-18.04, ubuntu-20.04, ubuntu-22.04]
os: [ubuntu-20.04, ubuntu-22.04]
py_version: [7.2.1.25747, 7.1.0.25066, 6.3.0.23157 ]
fail-fast: false
runs-on: ${{ matrix.os }}
name: Build pylon ${{ matrix.py_version }} on ${{ matrix.os }}-x64
steps:
- uses: actions/checkout@v3

- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: pylon-installer
path: pylon-installer
Expand Down Expand Up @@ -273,7 +273,7 @@ jobs:
]
runs-on: ubuntu-latest
steps:
- uses: geekyeggo/delete-artifact@v1
- uses: geekyeggo/delete-artifact@v2
continue-on-error: true
with:
name: pylon-installer
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
# Changelog
All notable changes to this project will be documented in this file.

## [0.6.2] - 2023-04-04

### Changed
- automatic rounding of values is default
* behavioural change
* if a value set via gstreamer is not valid for the camera
it will be automaticaylly roundedi
* this can be disabled by `enable-correction=false`

- Filter gev control features to speed up introspection
* exclude gev control dependencies

## [0.6.1] - 2023-03-27

### Changed
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,15 @@ The gstreamer model for properties only represents a static range of a property.
In the registration phase the absolute minimum and maximum values of a feature are registered as gstreamer property.
Per default pylon and the camera still require to set the exact/correct values.
Per default pylon and the camera will round/correct to the nearest valid value.
By using the gstreamer boolean property `enable-correction` the plugin will automatically round/correct to the nearest valid value.
This behaviour can be changed by using the gstreamer boolean property `enable-correction`.
The options for this property are:
* `enable-correction=false` the exact value has to be set. If the value is not valid ( out of range or wrong increment) the property setting is ignored and an error log message generated. This is the default behaviour
* `enable-correction=true` the plugin will round or adjust to the nearest valid value.
* `enable-correction=true` the plugin will round or adjust to the nearest valid value. This is the default behaviour.
* `enable-correction=false` the exact value has to be set. If the value is not valid ( out of range or wrong increment) the property setting is ignored and an error log message generated.
### UserSet handling
Expand Down
4 changes: 2 additions & 2 deletions ext/pylon/gstpylonsrc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ enum {
#define PROP_DEVICE_INDEX_MAX G_MAXINT32
#define PROP_USER_SET_DEFAULT NULL
#define PROP_PFS_LOCATION_DEFAULT NULL
#define PROP_ENABLE_CORRECTION_DEFAULT FALSE
#define PROP_ENABLE_CORRECTION_DEFAULT TRUE
#define PROP_CAM_DEFAULT NULL
#define PROP_STREAM_DEFAULT NULL
#define PROP_CAPTURE_ERROR_DEFAULT ENUM_ABORT
Expand Down Expand Up @@ -681,7 +681,7 @@ static gboolean gst_pylon_src_start(GstBaseSrc *src) {
self,
"Attempting to create camera device with the following configuration:"
"\n\tname: %s\n\tserial number: %s\n\tindex: %d\n\tuser set: %s \n\tPFS "
"filepath: %s \n\tEnable correction: %s."
"filepath: %s \n\tEnable correction: %s.\n"
"If defined, the PFS file will override the user set configuration.",
self->device_user_name, self->device_serial_number, self->device_index,
self->user_set, self->pfs_location,
Expand Down
46 changes: 45 additions & 1 deletion gst-libs/gst/pylon/gstpylonintrospection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,24 @@ static std::vector<GenApi::INode *> gst_pylon_get_valid_categories(
return valid_features;
}

static std::vector<GenApi::INode *> gst_pylon_filter_gev_ctrl(
const std::vector<GenApi::INode *> &feature_list) {
std::vector<GenApi::INode *> valid_features;
/* feature to filter */
const std::vector<std::string> gst_feature_list(
{"GevSCPSPacketSize", "GevSCPD", "GevSCFTD", "GevSCBWR",
"GevSCBWRA"
"GevGVSPExtendedIDMode"});
/* filter out gev control features from feature_list */
for (const auto &feature : feature_list) {
if (std::find(gst_feature_list.begin(), gst_feature_list.end(),
feature->GetName().c_str()) == gst_feature_list.end()) {
valid_features.push_back(feature);
}
}
return valid_features;
}

template <class Type>
std::vector<std::vector<Type>> gst_pylon_cartesian_product(
std::vector<std::vector<Type>> &values) {
Expand Down Expand Up @@ -622,10 +640,36 @@ void gst_pylon_find_limits(GenApi::INode *node, T &minimum_under_all_settings,
maximum_under_all_settings = 2;
GST_DEBUG("Apply BslColorAdjustmentSaturation feature workaround");
return;
}
} else if (node->GetName() == "GevSCBWR") {
minimum_under_all_settings = 0;
maximum_under_all_settings = 100;
GST_DEBUG("Apply GevSCBWR feature workaround");
return;
} else if (node->GetName() == "GevSCBWRA") {
minimum_under_all_settings = 1;
maximum_under_all_settings = 512;
GST_DEBUG("Apply GevSCBWRA feature workaround");
return;
} else if (node->GetName() == "GevSCPD") {
minimum_under_all_settings = 0;
maximum_under_all_settings = 50000000;
GST_DEBUG("Apply GevSCPD feature workaround");
return;
} else if (node->GetName() == "GevSCFTD") {
minimum_under_all_settings = 0;
maximum_under_all_settings = 50000000;
GST_DEBUG("Apply GevSCFTD feature workaround");
return;
};

/* remove any feature from the list that belongs to an unsupported
* category */
available_parent_inv = gst_pylon_get_valid_categories(available_parent_inv);

/* workaround for camera features that have an irrelevant dependency on
* the gige setup parameters */
available_parent_inv = gst_pylon_filter_gev_ctrl(available_parent_inv);

for (auto &node : available_parent_inv) {
tl.add_info(node->GetName().c_str());
}
Expand Down
47 changes: 29 additions & 18 deletions gst-libs/gst/pylon/gstpylonobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,36 +214,47 @@ void gst_pylon_object_set_pylon_feature<GGetInt64, Pylon::CIntegerParameter>(
GstPylonObjectPrivate* priv, GGetInt64 get_value, const GValue* value,
const gchar* name) {
Pylon::CIntegerParameter param(*priv->nodemap, name);
int64_t gst_val = get_value(value);
bool value_corrected = false;

if (priv->enable_correction) {
GST_WARNING(
"Value correction enabled. Values outside of valid ranges will be "
"automatically corrected.");
param.SetValue(
get_value(value),
Pylon::EIntegerValueCorrection::IntegerValueCorrection_Nearest);
} else
/* the rules to check an integer are complex.
* leave decision to correct the value to genicam
*/
try {
param.SetValue(gst_val);
} catch (GenICam::OutOfRangeException&) {
value_corrected = true;
param.SetValue(
gst_val,
Pylon::EIntegerValueCorrection::IntegerValueCorrection_Nearest);
}
} else {
param.SetValue(get_value(value));

GST_INFO("Set Feature %s: %s", name, param.ToString().c_str());
}
GST_INFO("Set Feature %s: %s%s", name, param.ToString().c_str(),
value_corrected ? " [corrected]" : "");
}

template <>
void gst_pylon_object_set_pylon_feature<GGetDouble, Pylon::CFloatParameter>(
GstPylonObjectPrivate* priv, GGetDouble get_value, const GValue* value,
const gchar* name) {
Pylon::CFloatParameter param(*priv->nodemap, name);

if (priv->enable_correction) {
GST_WARNING(
"Value correction enabled. Values outside of valid ranges will be "
"automatically corrected.");
int64_t gst_val = get_value(value);
bool value_corrected = false;
if (priv->enable_correction &&
(gst_val > param.GetMax() || gst_val < param.GetMin())) {
value_corrected = true;
param.SetValue(
get_value(value),
gst_val,
Pylon::EFloatValueCorrection::FloatValueCorrection_ClipToRange);
} else
param.SetValue(get_value(value));
GST_INFO("Set Feature %s: %s", name, param.ToString().c_str());
} else {
param.SetValue(gst_val);
}

GST_INFO("Set Feature %s: %s%s", name, param.ToString().c_str(),
value_corrected ? " [corrected]" : "");
}

template <>
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project('gst-plugin-pylon', 'c', 'cpp',
version : '0.6.1',
version : '0.6.2',
meson_version : '>= 0.61',
default_options : [ 'warning_level=1',
'buildtype=debugoptimized' ])
Expand Down

0 comments on commit a1d4808

Please sign in to comment.