Commit 341d5d57 authored by Locatelli's avatar Locatelli
Browse files

Merge V4 in master

parent 13c22fde
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>NomadSpecialModules</name>
<name>nomad-special-modules</name>
<comment></comment>
<projects>
<project>NomadModules</project>
......
To compile and install the modules:
To compile and install the modules, do:
./build.sh
cd build
make mod
......@@ -21,7 +21,7 @@ autoconf
automake --gnu --add-missing
export CXXFLAGS="$CXXFLAGS -Wall -Wconversion -O2 -g -pthread"
export CXXFLAGS="$CXXFLAGS -Wall -Wconversion -g -pthread"
cd build
../configure --prefix=$NOMAD_HOME/mod
<module name="axisrecorder">
<controller class="axis::AxisRecorder"/>
<include path="$(NOMAD_HOME)/../nomad-modules/src"/>
<include path="$(NOMAD_HOME)/../NomadModules/src"/>
</module>
......@@ -64,7 +64,7 @@ void DualCount::preStart() {
*/
void DualCount::gateStart() {
m_DPPTimeGate->mode = acquisition::TimeAcquisitionController::TIME_MODE;
m_DPPTimeGate->timeType = acquisition::TimeAcquisitionController::SECOND;
m_DPPTimeGate->timeType = unit::SECOND;
m_DPPTimeGate->time.setpoint = m_TimeSetPointSecond;
time10.setpoint = m_TimeSetPointSecond * 10;
time100.setpoint = m_TimeSetPointSecond * 100;
......
<module name="cadarache">
<controller class="cadarache::DualCount"/>
<include path="$(NOMAD_HOME)/../nomad-modules/src"/>
<include path="$(NOMAD_HOME)/../NomadModules/src"/>
</module>
......@@ -61,7 +61,7 @@ CameraSetting::CameraSetting(const string& name) :
stringhbinning.init(this, NOSAVE| SPY, "actualstringhbin", "wantedstringhbin", "hBinn");
stringmode.init(this, NOSAVE| SPY, "actualstringmode", "wantedstringmode", "Frame");
temperature.init(this, SAVE| SPY, "actualtemp", "wantedtemp", "Temp");
temperature.setUnit("~degree");
temperature.setUnit(unit::CELSIUS);
m_CamDriver.init(this, "cammeraDriver");
detectorController.init(this, "detectorController");
......
<module name="camera">
<controller class="camera::CameraSetting"/>
<include path="$(NOMAD_HOME)/../nomad-modules/src"/>
<include path="$(NOMAD_HOME)/../NomadModules/src"/>
</module>
......@@ -18,9 +18,14 @@
#include "DirectCamera.h"
#include <thread>
#include <chrono>
#include "CImg.h"
#include "controllers/common/family/Families.h"
using namespace std;
using namespace cimg_library;
namespace dif_s {
......@@ -30,7 +35,7 @@ const string DirectCamera::TYPE = "direct_camera";
* Constructor
*/
DirectCamera::DirectCamera(const string& name) :
utilities::ImageData(name), controller::Stoppable(this) {
ExperimentController(name), controller::Stoppable(this) {
setFamily(family::ACQUISITION, family::SETTING);
......@@ -44,12 +49,23 @@ DirectCamera::DirectCamera(const string& name) :
deltaPosition.init(this, SAVE, "delta_position");
exposureTime.init(this, SAVE, "exposure_time");
exposureTime.setUnit("s");
rgbData.init(this, NOSAVE, "rgb_data");
livedatax.init(this, NOSAVE, "livedatax");
livedatay.init(this, NOSAVE, "livedatay");
livedatargb.init(this, NOSAVE, "livedatargb");
livedatax_light.init(this, NOSAVE, "livedatax_light");
livedatay_light.init(this, NOSAVE, "livedatay_light");
livedatargb_light.init(this, NOSAVE, "livedatargb_light");
sampleTime.init(this, SAVE, "sample_time");
counter.init(this, NOSAVE, "counter");
registerFunction(TYPE);
m_Scan.init(this, "scan");
m_Driver.init(this, "driver");
liveView = true;
m_livedataxLightArray = nullptr;
m_livedatayLightArray = nullptr;
m_livedatargbLightArray = nullptr;
}
......@@ -57,14 +73,18 @@ DirectCamera::DirectCamera(const string& name) :
* Destructor
*/
DirectCamera::~DirectCamera() {
delete [] m_livedataxLightArray;
delete [] m_livedatayLightArray;
delete [] m_livedatargbLightArray;
}
/*
* postConfiguration
*/
void DirectCamera::postConfiguration() {
registerUpdater(m_Driver->RGBData, &DirectCamera::updateRGBData, this);
registerUpdater(m_Driver->PNGData, &DirectCamera::updatePNGData, this);
registerUpdater(m_Driver->livedatax, &DirectCamera::updatePictureXData, this);
registerUpdater(m_Driver->livedatay, &DirectCamera::updatePictureYData, this);
registerUpdater(m_Driver->livedatargb, &DirectCamera::updatePictureRGBData, this);
}
/*
......@@ -78,8 +98,8 @@ void DirectCamera::start() {
if (liveView() == true) {
commandStatus.setRunning();
do {
m_Driver.execute(driver::SYNCHRONIZE_READ_COMMAND, true);
usleep(100000);
m_Driver.execute(DirectCameraCommon::DO_PICTURE_COMMAND, true);
std::this_thread::sleep_for(std::chrono::milliseconds(sampleTime()));
} while(isStopped() == false);
}
else {
......@@ -131,18 +151,47 @@ void DirectCamera::updateProgression() {
}
}
void DirectCamera::updateRGBData() {
rgbData = m_Driver->RGBData();
void DirectCamera::updatePictureXData() {
livedatax.update(m_Driver->livedatax());
livedatax.setSize(m_Driver->livedatax.getSize());
}
void DirectCamera::updatePNGData() {
type = m_Driver->pixelFormat();
xSize = m_Driver->width();
ySize = m_Driver->height();
size = m_Driver->PNGData.getSize() * 4;
content = m_Driver->PNGData();
content.setSize(m_Driver->PNGData.getSize());
content.sendEvent();
void DirectCamera::updatePictureYData() {
livedatay.update(m_Driver->livedatay());
livedatay.setSize(m_Driver->livedatay.getSize());
}
/*
* updatePictureRGBData
*/
void DirectCamera::updatePictureRGBData() {
livedatargb.update(m_Driver->livedatargb());
livedatargb.setSize(m_Driver->livedatargb.getSize());
counter.update(counter() + 1);
livedatargb.sendEvent();
CImg<int32> img(m_Driver->livedatargb(), livedatax.getSize(), livedatay.getSize());
CImg<int32> res = img.resize(LIGHT_XSIZE, LIGHT_YSIZE);
if (m_livedatargbLightArray == nullptr) {
m_livedataxLightArray = new int32[LIGHT_XSIZE];
for(uint32 i = 0; i < LIGHT_XSIZE; ++i) {
m_livedataxLightArray[i] = i;
}
livedatax_light.update(m_livedataxLightArray);
livedatax_light.setSize(LIGHT_XSIZE);
m_livedatayLightArray = new int32[LIGHT_YSIZE];
for(uint32 i = 0; i < LIGHT_YSIZE; ++i) {
m_livedatayLightArray[i] = i;
}
livedatay_light.update(m_livedatayLightArray);
livedatay_light.setSize(LIGHT_YSIZE);
m_livedatargbLightArray = new int32[LIGHT_YSIZE * LIGHT_XSIZE];
livedatargb_light.update(m_livedatargbLightArray);
livedatargb_light.setSize(LIGHT_YSIZE * LIGHT_XSIZE);
}
memcpy(m_livedatargbLightArray, res.data(), LIGHT_YSIZE * LIGHT_XSIZE * sizeof(int32));
livedatargb_light.sendEvent();
}
......
......@@ -26,9 +26,7 @@
#define DIRECTCAMERA_H
#include "controllers/common/scanlegacy/ParameterizableScan1D.h"
#include "controllers/common/utilities/imageviewer/ImageData.h"
#include "controllers/common/acquisition/ImageGeneratable.h"
#include "drivers/imagingsources/dfk31au03/Dfk31Au03Driver.h"
#include "DirectCameraCommon.h"
namespace dif_s {
......@@ -39,7 +37,7 @@ namespace dif_s {
* \par
* This class contains mathematics methods. It described sample properties
*/
class DirectCamera: public utilities::ImageData, public acquisition::ImageGeneratable, public controller::Stoppable {
class DirectCamera: public ExperimentController, public controller::Stoppable {
public:
......@@ -68,7 +66,17 @@ public:
Property<float64> endedPosition;
Property<float64> deltaPosition;
Property<float64> exposureTime;
Property<std::string> rgbData;
ArrayProperty<int32> livedatax;
ArrayProperty<int32> livedatay;
ArrayProperty<int32> livedatargb;
ArrayProperty<int32> livedatax_light;
ArrayProperty<int32> livedatay_light;
ArrayProperty<int32> livedatargb_light;
Property<int32> sampleTime;
Property<int32> counter;
private:
......@@ -80,7 +88,7 @@ private:
virtual void postConfiguration();
ControllerPtr<scan::ParameterizableScan1D> m_Scan;
DriverPtr<dfk41au03::Dfk31Au03Driver> m_Driver;
DriverPtr<DirectCameraCommon> m_Driver;
/*!
* \brief Start command
......@@ -96,10 +104,17 @@ private:
*/
virtual void stop();
void updateRGBData();
void updatePNGData();
void updatePictureXData();
void updatePictureYData();
void updatePictureRGBData();
void updateProgression();
int32* m_livedataxLightArray;
int32* m_livedatayLightArray;
int32* m_livedatargbLightArray;
const static int32 LIGHT_XSIZE = 900;
const static int32 LIGHT_YSIZE = 800;
};
}
......
/*
* 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.
*/
#include "DirectCameraCommon.h"
namespace dif_s {
const std::string DirectCameraCommon::TYPE = "dif_camera_picture_common";
const std::string DirectCameraCommon::DO_PICTURE_COMMAND = "do_picture";
/*
* Constructor
*/
DirectCameraCommon::DirectCameraCommon() : DeviceDriver() {
m_LiveDataX = nullptr;
m_LiveDataY = nullptr;
m_LiveDataRGB = nullptr;
}
/*
* Constructor
*/
DirectCameraCommon::DirectCameraCommon(const std::string& name) {
m_LiveDataX = nullptr;
m_LiveDataY = nullptr;
m_LiveDataRGB = nullptr;
DeviceDriver::init(name);
init(name);
}
DirectCameraCommon::~DirectCameraCommon() {
delete [] m_LiveDataX;
delete [] m_LiveDataY;
delete [] m_LiveDataRGB;
}
/*
* init
*/
void DirectCameraCommon::init(const std::string& name) {
DeviceDriver::init(name);
livedatax.init(this, NOSAVE, "livedatax");
livedatay.init(this, NOSAVE, "livedatay");
livedatargb.init(this, NOSAVE, "livedatargb");
directCameraStatus.init(this, NOSAVE, "direct_camera_picture_status");
initCommand(DO_PICTURE_COMMAND);
}
}
/*
* 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 DIRECTCAMERACOMMON_H
#define DIRECTCAMERACOMMON_H
#include <Driver.h>
#include "drivers/global/DriversCommands.h"
namespace dif_s {
/*!
* \class DirectCameraCommon
* \brief Class described the axis common driver
*
* \par
* This is the global view of all axis driver. Camera common is used by controller.
*/
class DirectCameraCommon: public virtual DeviceDriver {
public:
//! Driver type value
static const std::string TYPE;
/*!
* \brief Constructor
*/
DirectCameraCommon();
/*!
* \brief Constructor
* \param[in] name the name of the device driver
*/
DirectCameraCommon(const std::string& name);
~DirectCameraCommon();
void init(const std::string& name);
/*!
* Global Camera properties
*/
ArrayProperty<int32> livedatax;
ArrayProperty<int32> livedatay;
ArrayProperty<int32> livedatargb;
Property<int32> directCameraStatus; //! status property
/*!
* \brief compute global axis status
* \param[in] value the driver status
*/
virtual void computeDirectCameraStatus(int32 value) {
}
/*!
* \brief Method called for executing a command
*
* \param[in] command the command to apply on the controller
*/
virtual void execute(const std::string& aCommand) {
}
static const std::string DO_PICTURE_COMMAND; //! Apply mask
int32* m_LiveDataX;
int32* m_LiveDataY;
int32* m_LiveDataRGB;
};
}
#endif //DIRECTCAMERACOMMON_H
<module name="dif_s">
<controller class="dif_s::DirectCamera"/>
<include path="$(NOMAD_HOME)/../nomad-modules/src"/>
<include path="$(NOMAD_HOME)/../NomadModules/src"/>
<link path="/opt/baumer-gapi-sdk/lib" lib="bgapi2_genicam"/>
<link lib="opencv_core"/>
<link lib="opencv_calib3d"/>
<link lib="opencv_highgui"/>
<link lib="opencv_core"/>
<link lib="opencv_calib3d"/>
<link lib="opencv_highgui"/>
<include path="/opt/baumer-gapi-sdk/include/bgapi2_genicam"/>
</module>
......@@ -36,3 +36,14 @@ direct_camera.started_positionPrefix=Started
direct_camera.ended_positionPrefix=Ended
direct_camera.delta_positionPrefix=Delta
direct_camera.exposure_timePrefix=Time (s)
direct_camera.title=Live
direct_camera.sample_timePrefix=Refresh Frequency
direct_camera.1sValue=1000
direct_camera.1sLabel=1s
direct_camera.500msValue=500
direct_camera.500msLabel=500ms
direct_camera.250msValue=250
direct_camera.250msLabel=250ms
direct_camera.100msValue=100
direct_camera.100msLabel=100ms
\ No newline at end of file
<plotdatas>
<plotdata key="livedata" rgb="true" legend_key="genericDataLabel" plugins="SETUP">
<dataX p_role="direct_camera1" p_name="livedatax"/>
<dataY p_role="direct_camera1" p_name="livedatay"/>
<dataZ p_role="direct_camera1" p_name="livedatargb"/>
</plotdata>
</plotdatas>
\ No newline at end of file
......@@ -2,4 +2,13 @@
<controller type="direct_camera">
<property name="livedatax" type="int32array">
</property>
<property name="livedatay" type="int32array">
</property>
<property name="livedatargb" type="int32array">
</property>
<property name="sample_time" type="int32">
</property>
</controller>
......@@ -32,5 +32,10 @@
<!-- <text role="direct_camera1" property="exposure_time" prefix="direct_camera.exposure_timePrefix"/> -->
</switchable_composite>
<switchable_composite switcher_key="live_viewSwitcher" switch_values="true">
<combo role="direct_camera1" property="sample_time" prefix="direct_camera.sample_timePrefix" valuesAndLabels="direct_camera.1s,direct_camera.500ms,direct_camera.250ms,direct_camera.100ms"/>
<plot_launcher role="direct_camera1" data="livedata" title="direct_camera.title" height="20" spaceBefore="false"/>
</switchable_composite>
<!-- </switchable_composite> -->
</plugin>
......@@ -33,6 +33,7 @@ CyclopsDataPath::CyclopsDataPath(const string& name) :
setFamily(family::ACQUISITION, family::SETTING);
datadrive.init(this, SAVE, "datadrive");
datapath.init(this, SAVE, "datapath");
dataname.init(this, SAVE, "dataname");
......@@ -74,7 +75,7 @@ void CyclopsDataPath::start() {
boost::filesystem::create_directory(path);
log(Level::s_Info) << "create local data path " << path.string() << endlog;
}
m_CamDriver->fileDirectory = datapath();
m_CamDriver->fileDirectory =datadrive()+":\\"+datapath();
m_CamDriver->fileName = dataname();
log(Level::s_Info) << "set data path " << datapath() << " and name " << dataname() << endlog;
commandStatus.setIdle();
......
......@@ -59,6 +59,7 @@ public:
*/
Property<std::string> dataname;
Property<std::string> datapath;
Property<std::string> datadrive;
private:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment