Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Instrument Control
NomadSpecialModules
Commits
480b56c2
Commit
480b56c2
authored
Apr 24, 2020
by
Abdelali Elaazzouzi
Browse files
remove pylon
parent
1d8fbb77
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
modgen.jar
deleted
100644 → 0
View file @
1d8fbb77
File deleted
src/controllers/dif/common/Module.xml
View file @
480b56c2
...
...
@@ -5,7 +5,7 @@
<link
lib=
"opencv_core"
/>
<link
lib=
"opencv_calib3d"
/>
<link
lib=
"opencv_highgui"
/>
<link
lib=
"opencv_core"
/>
<link
lib=
"opencv_core"
/>
<link
lib=
"opencv_calib3d"
/>
<link
lib=
"opencv_highgui"
/>
<include
path=
"/opt/baumer-gapi-sdk/include/bgapi2_genicam"
/>
...
...
src/drivers/gigecam/basler/CameraHandler.cpp
deleted
100644 → 0
View file @
1d8fbb77
This diff is collapsed.
Click to expand it.
src/drivers/gigecam/basler/CameraHandler.h
deleted
100644 → 0
View file @
1d8fbb77
#pragma once
#include <thread>
#include <vector>
#include <mutex>
#include <list>
#define _GNULINUX
#include </usr/local/src/baumer/inc/bgapi2_genicam/bgapi2_genicam.hpp>
#include "drivers/gigecam/photonics/DoubleBufferHandler.h"
// the class represents a BGAPI camera object and additional camera specific information
class
CCameraControl
{
public:
// this function activates the feature command
// the feature command use the ExposureTime feature of the camera
// the parameter passes the new exposure time to be written to the camera
void
StartFeatureCommandExposure
(
double
exposure_time
);
// this function activates the capture command
// the parameter passes the number of images to be captured
void
StartCaptureCommand
(
unsigned
int
images
);
// this function checks, if the capture command was activated
// in this case the capture command is automatically reset
bool
IsCommandCaptureActivated
();
// this function checks, if the feature command was activated
// in this case the feature command is automatically reset
bool
IsCommandExposureActivated
();
// this function writes the desired exposure time to the passed camera
bool
ExposureFeatureBGAPI
();
// this function makes all necessary preparations on the buffer management to be able to capture images with BGAPI
// it opens the data stream and creates the camera buffers
void
InitializeBGAPIBufferManagement
();
// this function clears the buffer management and
// deletes the camera buffers
void
DeinitializeBGAPIBufferManagement
();
// this function capture the desired number of images from the passed camera
// and store some additional information (BufferInformation struct)
bool
CaptureBGAPIImages
(
const
bool
*
abort_flag
,
unsigned
int
number_of_images
);
// this function starts the streaming for the passed camera
bool
StartStreamingBGAPI
();
// this function stops the streaming for the passed camera
void
StopStreamingBGAPI
();
// this function fill the BufferInformation struct
void
FillBufferInformation
(
BGAPI2
::
DataStream
*
datastream_pointer
,
BGAPI2
::
Buffer
*
buffer
);
// function to add a string with logging information to the logging string list
void
LoggingStringAdd
(
std
::
string
logging_message
);
// this function returns a logging string and remove this string from the logging string list
std
::
string
LoggingString
();
// function to check, if some logging information is available
bool
LoggingListEmpty
()
{
return
(
logging_list_
.
size
()
==
0
);
}
public:
// buffer exchange strategy (double buffer)
CDoubleBufferHandler
buffer_handler_
;
// BGAPI camera object
BGAPI2
::
Device
*
camera_pointer_
;
// a list to transfer massages, generated by the feature command
std
::
list
<
std
::
string
>
feature_command_message_list_
;
// a mutex to synchronize the access to feature_command_message_list_
std
::
mutex
feature_command_message_list_lock_
;
// a worker thread that captures images from BGAPI
std
::
thread
capture_thread_
;
// a worker thread that control camera features from BGAPI
std
::
thread
feature_thread_
;
// a flag which controls the capture command
bool
command_capture_
;
// a flag which shows if the capture command is active
bool
capture_active_
;
// number of images to capture
unsigned
int
number_of_images_
;
// number of currently captured images
unsigned
int
number_of_captured_images_
;
// number of incomplete images
unsigned
int
number_of_incomplete_images_
;
// a flag which controls the feature command
bool
command_feature_
;
// exposure time to be set
double
exposure_time_
;
private:
// mutex to synchronize the access to capture command flag of all cameras
std
::
mutex
capture_command_lock_
;
// mutex to synchronize the access to feature command flag of all cameras
std
::
mutex
feature_command_lock_
;
// a list which holds logging strings
std
::
list
<
std
::
string
>
logging_list_
;
// a mutex to synchronize the access to the logging list
std
::
mutex
logging_list_lock_
;
};
// the class encapsulate camera search, capture command and feature command
// it also implements the worker threads
class
CCameraHandler
{
// ----
// public functions which are used in the context of the main thread and application threads
// to control the main settings from the user application
// ----
public:
// construction / destruction
CCameraHandler
();
virtual
~
CCameraHandler
();
// this function starts the init thread to search for connected cameras
// it also passed the buffer handler
void
Start
(
CDoubleBufferHandler
buffer_handler
);
// close all connected cameras and frees all BGAPI resources
// this function doesn't run in a separate thread
void
Stop
();
// this function initialize the buffer management of all connected cameras
// it also creates the struct BufferInformation for every camera buffer
// all cameras use 10 buffers to store the image data
// the memory for the camera buffers will be allocated inside BGAPI
// the size of the memory to allocated will determined from the maximum image size
// this function also starts the worker threads
void
StartCameras
();
// this function stops the worker threads
// and deinitialize the BGAPI
void
StopCameras
();
// function to check for an initialisation error
bool
IsInitOK
();
// returns the number of connected cameras
size_t
NumberOfCameras
();
// this function returns the number of images taken by the camera that took the least number of images
unsigned
int
CapturedImages
();
// function to return the camera control vector
const
std
::
vector
<
CCameraControl
*>*
GetCameraControlVector
()
{
return
&
camera_control_
;
}
// this function returns a logging string and remove this string from the logging string list
std
::
string
LoggingString
();
// function to check, if some logging information is available
bool
LoggingListEmpty
()
{
return
(
logging_list_
.
size
()
==
0
);
}
// ----
// public functions which are partly used in the worker threads
// to handle and process the code regarding to main settings
// ----
public:
// this function initializes the Baumer GAPI SDK and
// searches for connected cameras
// all found cameras will be opened to work with
void
InitializeBGAPI
();
// this function deinitialises the Baumer GAPI SDK and
// close all connected cameras
void
DeinitializeBGAPI
();
// function to signal an initialisation error while start up
void
SetInitError
();
// function to add a string with logging information to the logging string list
void
LoggingStringAdd
(
std
::
string
logging_message
);
// this function adds a camera object to the camera control vector
void
AddCamera
(
BGAPI2
::
Device
*
camera_pointer
);
// this function set a flag to signal the worker thread to exit
const
bool
*
FinishWorkerThreads
()
{
return
&
finish_worker_threads_
;
}
private:
// pointer to the buffer handler
CDoubleBufferHandler
buffer_handler_
;
// flag to signal the worker threads to exit themselves
bool
finish_worker_threads_
;
// initialisation thread
std
::
thread
init_thread
;
// camera control vector holds information regarding synchronisation and
// the BGAPI camera object
std
::
vector
<
CCameraControl
*>
camera_control_
;
// flag is set for initialisation errors
bool
init_ok_
;
// a list which holds logging strings
std
::
list
<
std
::
string
>
logging_list_
;
// a mutex to synchronize the access to the logging list
std
::
mutex
logging_list_lock_
;
};
src/drivers/gigecam/basler/RealPhotonicsDriver.cpp
deleted
100644 → 0
View file @
1d8fbb77
This diff is collapsed.
Click to expand it.
src/drivers/gigecam/basler/RealPhotonicsDriver.h
deleted
100644 → 0
View file @
1d8fbb77
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
#ifndef REALPHOTONICSDRIVER_H
#define REALPHOTONICSDRIVER_H
#include <string>
#include <vector>
#define _GNULINUX
#include "Utilities/Counter.h"
#include </usr/local/src/baumer/inc/bgapi2_genicam/bgapi2_genicam.hpp>
#include "drivers/gigecam/photonics/BufferInformation.h"
#include "drivers/gigecam/photonics/CameraHandler.h"
#include "drivers/gigecam/photonics/DoubleBufferHandler.h"
#include "drivers/gigecam/photonics/PhotonicsDef.h"
#include "drivers/gigecam/photonics/PhotonicsState.h"
namespace
photonics
{
/*!
* \class RealPhotonicsDriver
* \brief Real implementation class for the Psl device driver
*
* This class is a real implementation of Psl device driver.
*/
class
RealPhotonicsDriver
:
public
PhotonicsState
{
public:
/*!
* \brief Constructor
* \param[in] owner The device driver main class link
*/
RealPhotonicsDriver
(
PhotonicsDriver
*
owner
);
/*!
* \brief Destructor
*/
virtual
~
RealPhotonicsDriver
();
/*!
* \brief Init command implementation
*/
virtual
void
init
();
/*!
* \brief Clear command implementation
*/
virtual
void
clear
();
/*!
* \brief Write Param command implementation
*/
virtual
void
writeParam
();
/*!
* \brief Read command implementation
*/
virtual
void
read
();
/*!
* \brief Synchronize Read command implementation
*/
virtual
void
synchroniseRead
();
/*!
* \brief Start command implementation
*/
virtual
void
start
();
/*!
* \brief Resume command implementation
*/
virtual
void
resume
();
/*!
* \brief Pause command implementation
*/
virtual
void
pause
();
/*!
* \brief Stop command implementation
*/
virtual
void
stop
();
/*!
* \brief Read Infos command implementation
*/
virtual
void
readStatus
();
/*!
* \brief Read Infos command implementation
*/
virtual
void
readInfos
();
/*!
* \brief Regroup command implementation
*/
// virtual void regroup();
// int32 GetAvailablePhotonicseras();
// std::string getConfigFile(BGAPI2::Device* device);
private:
// a flag which controls the status command
std
::
atomic
<
bool
>
command_status
;
// a flag which controls the calculation command
std
::
atomic
<
bool
>
command_calculation
;
// this function activates the feature command on all connected cameras
// the feature command use the ExposureTime feature of the camera
// the parameter passes the new exposure time to be written to the cameras
void
StartFeatureCommandExposure
(
CCameraHandler
*
camera_handler
,
double
exposure_time
);
// this function activates the capture command on all connected cameras
// the parameter passes the number of images to be captured
void
StartCaptureCommand
(
CCameraHandler
*
camera_handler
,
unsigned
int
images
);
// -------------
// thread control, finish flag and thread functions
// -------------
// a flag which is used to stop all the used threads at once
bool
finish_console_threads
=
false
;
// the thread routine of the status command is used to print status information about the current buffer,
// exposure time, logging information and calculation results
// prints the status information to the console
void
StatusThreadRoutine
(
CCameraHandler
*
camera_handler
);
// the thread routine of the calculation command is used to make a image calculation
// prints the calculation result to the console
void
CalculationThreadRoutine
(
CCameraHandler
*
camera_handler
);
// -------------
// declaration of synchronisation functions needed for synchronized buffer access between the application threads
// -------------
// this function is used to check if new data is available
bool
HasDoubleBufferHandlerNewData
(
CDoubleBufferHandler
*
buffer_handler
);
// this function is used within the thread functions to receive a new buffer
BGAPI2
::
Buffer
*
PullBufferFromDoubleBufferHandler
(
CDoubleBufferHandler
*
buffer_handler
);
// this function is used within the thread functions to return a buffer
void
FreeBufferToDoubleBufferHandler
(
CDoubleBufferHandler
*
buffer_handler
,
BGAPI2
::
Buffer
*
buffer
);
// structure with the buffer object and a reference counter
// the reference counter is incremented with every call to PullBufferFromBufferModule
// and decremented with every call to FreeBufferToBufferModule
// if the reference counter reaches 0 the buffer will return to BGAPI
// the new data flag is available for all application threads
// this flags makes sure that one application thread of one camera process a camera buffer only once
struct
CameraBuffer
{
CameraBuffer
()
{
buffer_
=
nullptr
;
ref_counter_
=
0
;
}
std
::
mutex
lock_
;
BGAPI2
::
Buffer
*
buffer_
;
std
::
atomic
<
int
>
ref_counter_
;
std
::
map
<
std
::
thread
::
id
,
std
::
atomic
<
bool
>>
new_data
;
};
// this map manages all reference counter and buffer objects for each camera
std
::
map
<
CDoubleBufferHandler
*
,
CameraBuffer
>
current_buffer
;
// result of calculation thread stored in a simple map of string
std
::
map
<
CDoubleBufferHandler
*
,
std
::
string
>
calculation_result
;
// mutex to synchronize the access to the calculation result
std
::
mutex
calculation_result_lock
;
// ---------------
// helper function, used to reduce the length of some functions
// ---------------
// initialize buffer structure, which is used for buffer and data exchange between
// the main and application threads
void
InitCurrentBufferStruct
(
CCameraHandler
*
camera_handler
,
std
::
list
<
std
::
thread
::
id
>
thread_id_list
);
// waits until all connected cameras are streaming
// prints the streaming status, camera name and serial number to console
void
WaitUntilStreamingIsActive
(
CCameraHandler
*
camera_handler
);
// function used in automatic mode to wait for all camera buffer
int
WaitOfImages
(
CCameraHandler
*
camera_handler
,
unsigned
int
number_of_images
);
// ---------------
// example application functions used by the application threads
// ---------------
// perform a camera depended the logging output used by the status thread
void
PrintLoggingInformation
(
CCameraControl
*
camera_control
);
// perform the status output used by the status thread
void
PrintCameraStatus
(
CCameraControl
*
camera_control
);
// print calculation results used by status thread
void
PrintCalculationStatus
(
CCameraControl
*
camera_control
);
// perform a mean value calculation used by the calculation thread
void
DoCalculation
(
CCameraControl
*
camera_control
);
// instantiate the camera handler
CCameraHandler
m_camera_handler
;
// instantiate the buffer handler
CDoubleBufferHandler
m_double_buffer
;
// structure with the buffer object and a reference counter
// the reference counter is incremented with every call to PullBufferFromBufferModule
// and decremented with every call to FreeBufferToBufferModule
// if the reference counter reaches 0 the buffer will return to BGAPI
// the new data flag is available for all application threads
// this map manages all reference counter and buffer objects for each camera
std
::
map
<
CDoubleBufferHandler
*
,
CameraBuffer
>
m_current_buffer
;
bool
m_finish_console_threads
;
// a flag which controls the status command
std
::
atomic
<
bool
>
m_command_status
;
int32
m_return_code
;
Counter
m_TimeCounter
;
};
}
#endif //REALPSLDRIVER_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment