This repository contains programming samples for Sick Visionary-T Mini CX (V3S105-1AAAAAA) and Sick Visionary-S CX (V3S102-1AAAAAA and V3S102-1AABAAB).
The entry point for our camera programming samples is the Python Welcome Demo and the Cpp Welcome Demo. These welcome demos provide an overview to the functionalities offered by the Visionary Python and C++ API. They cover aspects such as device connection, user authentication (login and logout), parameter adjustments, along with the streaming and storage of images and point clouds.
For new users we recommended to follow the samples in the following order:
The source code is released under The Unlicense.
The samples in this repository have been tested with the following platforms:
| Platform | Compiler | Version | Notes |
|---|---|---|---|
Windows |
Visual Studio / Build Tools |
2022 (MSVC = 19.3x) |
|
Windows |
gcc (mingw64) |
14.2.0 (>= 11.1) |
|
Linux inside WSL2 |
gcc |
11.4.0 (>= 11.1) |
finding_and_connecting_devices (AutoIP) and image_streaming_and_storing (UDP) will not work with default WSL2 configuration (NAT) |
Ensure you have a recent version of cmake [1] and a compiler available on your machine’s system. If you are working on windows with a recent version of VisualStudio[2], take care to have a CMake version supporting your version of Visual Studio.
After cloning this repository, open a Command Prompt window and navigate to sick_visionary_samples directory. Run these additional git commands to have the correct submodules in place
[3]:
-
git submodule update --init --recursive
Most of the sample code (see more details below) is designed for use with Python 3.7 to Python 3.11 (code is tested with Python 3.8 and 3.10). Install Python from its official website. Python 3.8 is recommended and frequently tested, but it is not a strict requirement.
If another version is already installed, create an isolated virtual environment using python -m venv to ensure compatibility with the samples.
For Linux users, the repository provides a minimal bootstrap script that uses the system default python3, creates a virtual environment and installs Python requirements.
From the repository root directory:
chmod +x setup_linux_env.sh ./setup_linux_env.sh
Afterwards, activate the environment:
source .venv_sick_visionary_samples/bin/activate
For Windows users, the repository provides a PowerShell bootstrap script that locates py or python, creates a virtual environment and installs Python requirements.
From the repository root directory in a PowerShell terminal:
.\setup_windows_env.ps1
Afterwards, activate the environment:
.\.venv_sick_visionary_samples\Scripts\Activate.ps1
Sample how to set up a Python virtual environment
Any Python version in the supported range (3.7 - 3.11) can be used. The example below uses Python 3.10 (the default on Ubuntu 22.04), but the same steps apply to any compatible version.
Linux
# check the currently used Python version $ python3 --version Python 3.10.x # create a virtual environment using the system default python3 $ python3 -m venv .venv_sick_visionary_samples # activate the virtual environment $ source .venv_sick_visionary_samples/bin/activate (.venv_sick_visionary_samples) $ python --version Python 3.10.x # install the requirenments (.venv_sick_visionary_samples) $ pip install -r requirements.txt # To quit/exit the virtual environment (.venv_sick_visionary_samples) $ deactivate $
Windows
# check the currently used Python version C:\projects\visionary_samples> python --version Python 3.10.2 # create a virtual environment using the built-in venv module C:\projects\visionary_samples> python -m venv .venv_sick_visionary_samples # activate the virtual environment C:\projects\visionary_samples> .venv_sick_visionary_samples\Scripts\activate (.venv_sick_visionary_samples) C:\projects\visionary_samples> python --version Python 3.10.2 # install the requirenments (.venv_sick_visionary_samples) C:\projects\visionary_samples> pip install -r requirements.txt # To quit/exit the virtual environment (.venv_sick_visionary_samples) C:\projects\visionary_samples> deactivate C:\projects\visionary_samples>
All required Python packages needed for working with the samples are defined in requirements.txt.
|
Note
|
requirements.txt also installs a local shared helper module from shared/python.
Therefore, run the install command from the repository root directory.
|
Installation of requirements.txt fails?
If the installation fails with an error message similar to the following (message may vary depending on the package name):
ERROR: Could not find a version that satisfies the requirement genicam (from versions: none) ERROR: No matching distribution found for genicam
In this case it is very likely that the package is not provided for your current Python version. This can happen when maintainers of packages need more time to adopt their package to new Python releases. To verify, go to https://pypi.org/ and search for the failing package. Navigate to "Download files" to see a full list of wheel packages. You can derive from the file name which Python versions are supported. Example: if the file name contains *-cp311-* that whl file is for Python version 3.11.
With this information you should be able to select the correct Python version to be installed and used in your virtualenv.
After activation, run the Python samples from the repository root. E.g. to run the Python Welcome demo, execute the following command from the top-level directory:
python visionary_welcome/python/capture.py -i 192.168.1.10 -d Visionary-S --mode stream --save_images --save_pointcloud --save_optimized_pointcloudDepending on your environment, you may need to use python or python3. Make sure to adjust the IP address (-i) and device type (-d) to match your specific device.
The welcome demo supports the following command line options:
| Argument | Type | Default | Description |
|---|---|---|---|
|
string |
|
IP address of the Visionary device. |
|
string |
|
Visionary product type. Choices: |
|
string |
|
Streaming mode. Choices: |
|
float |
|
Duration in seconds. Used with |
|
int |
|
Number of frames to capture. Used with |
|
flag |
off |
Save non-optimized point cloud as |
|
flag |
off |
Save optimized point cloud as |
|
flag |
off |
Save depth/intensity/confidence maps as PNG per frame to |
To leave the virtual environment, run:
$ deactivate|
Note
|
Replace the installation commands with the equivalent for your operating system or Python environment if necessary. |
To build the C++ samples, it is suggested to proceed like this [4]:
-
cmake -B buildoptionally also specify other options like -G for custom generator
|
Note
|
If you run into WARNING_AS_ERROR issue with some compiler (which is enabled per default) just use the cmake override |
Now you can build the files with the chosen build-system you’ve generated them for, for instance, open the solution in VisualStudio or run make/ninja.
-
cmake --build build
|
Note
|
To build set(BUILD_SHARED_LIBS ON) // Enable building with shared librariesWhen if (BUILD_SHARED_LIBS)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/output)
endif()This setup is especially important on Windows, where |
To run the C++ welcome demo, follow these steps:
-
Navigate to the
output/directory from the top-level directory:
$ cd build/output/-
Execute the
welcomedemo with the specified IP address and device:
$ ./welcome -i127.0.0.1 -dVisionary-SRemember to adjust the IP address (-i) and device type (-d) to match your specific device.
Depending on the nature of your question, there are two support channels:
-
For questions regarding the code shared in this repo please check the FAQ first and search if an issue already exists. If a related issue doesn’t exist, you can open a new issue using the issue form.
-
For application or device specific questions look for common solutions and knowledge articles on the Sick Support Portal. If your question is not answered there, open a ticket on the Sick Support Portal.