Propagation of ROI parameters between ROI-s and Cameras implemented, ver. 2.12.438
This commit is contained in:
@@ -12,6 +12,10 @@ namespace TBF.BenchControl.GenericDevices
|
||||
/// </summary>
|
||||
int CameraNr { get; }
|
||||
|
||||
string RoiParams { get; set; }
|
||||
|
||||
void ClearRoiParams();
|
||||
|
||||
/// <summary>
|
||||
/// Grab one image.
|
||||
/// </summary>
|
||||
|
||||
@@ -11,6 +11,8 @@ namespace TBF.BenchControl.GenericDevices
|
||||
|
||||
bool Detected { get; set; }
|
||||
|
||||
string RoiParams { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Watermeter wheel/arrow detection process.
|
||||
/// </summary>
|
||||
|
||||
@@ -20,8 +20,8 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
{
|
||||
return string.Format("{0}, Name={1}, HWAddress={2}, IPAddress={3}, Serial={4}, Image={5}",
|
||||
this.GetType().Namespace.Substring(17),
|
||||
cameraCfg.Name,
|
||||
cameraCfg.HardwareAddress,
|
||||
CameraCfg.Name,
|
||||
CameraCfg.HardwareAddress,
|
||||
ipAddress == null ? "not detected" : ipAddress.ToString(),
|
||||
string.IsNullOrEmpty(serial) ? "not detected" : serial,
|
||||
string.IsNullOrEmpty(sdCardVer) ? "not detected" : sdCardVer);
|
||||
@@ -36,24 +36,33 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
const string ClpPrompt = "$ ";
|
||||
|
||||
|
||||
readonly CameraCfg cameraCfg;
|
||||
public readonly CameraCfg CameraCfg;
|
||||
public readonly GenericDevices.INetworkAdapter NetAdapter;
|
||||
|
||||
|
||||
public IPAddress IPAddress { get { return ipAddress; } }
|
||||
IPAddress ipAddress;
|
||||
|
||||
public string Hardware { get { return hardware; } }
|
||||
string hardware;
|
||||
public string Hardware { get { return hardware; } }
|
||||
|
||||
public string Revision { get { return revision; } }
|
||||
string revision;
|
||||
public string Revision { get { return revision; } }
|
||||
|
||||
public string Serial { get { return serial; } }
|
||||
string serial;
|
||||
public string Serial { get { return serial; } }
|
||||
|
||||
public string SDCardVer { get { return sdCardVer; } }
|
||||
string sdCardVer;
|
||||
public string SDCardVer { get { return sdCardVer; } }
|
||||
|
||||
|
||||
string roiParams;
|
||||
public string RoiParams
|
||||
{
|
||||
get { return roiParams; }
|
||||
set { roiParams = value; }
|
||||
}
|
||||
public void ClearRoiParams() { roiParams = string.Empty; }
|
||||
|
||||
|
||||
public Telnet.TelnetClient Telnet;
|
||||
@@ -77,7 +86,7 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
public Camera(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
{
|
||||
cameraCfg = cfg as CameraCfg;
|
||||
CameraCfg = cfg as CameraCfg;
|
||||
NetAdapter = TbfComponents.FindComponent(cfg.ParentName, components) as GenericDevices.INetworkAdapter;
|
||||
if (NetAdapter == null) throw new ArgumentNullException("no network adapter");
|
||||
|
||||
@@ -85,6 +94,8 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
terminalDlg = null;
|
||||
|
||||
measurementUdpPortNr = GetNextUdpPortNr();
|
||||
|
||||
ClearRoiParams();
|
||||
|
||||
running = false;
|
||||
|
||||
@@ -95,20 +106,20 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
if (cameraCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
if (CameraCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
|
||||
/// Detect a camera
|
||||
bool cameraDetected = DetectCamera(cameraCfg.HardwareAddress, true,
|
||||
bool cameraDetected = DetectCamera(CameraCfg.HardwareAddress, true,
|
||||
out ipAddress, out hardware, out revision, out serial, out sdCardVer);
|
||||
if (!cameraDetected) throw new Exception(string.Format("Camera {0} with address {1} not detected",
|
||||
Name, cameraCfg.HardwareAddress));
|
||||
Name, CameraCfg.HardwareAddress));
|
||||
|
||||
/// Open telnet clint and start the log-in process
|
||||
Telnet = new Telnet.TelnetClient(this, cameraCfg.Name, ClpUserName, ClpPassword, ClpPrompt);
|
||||
Telnet = new Telnet.TelnetClient(this, CameraCfg.Name, ClpUserName, ClpPassword, ClpPrompt);
|
||||
|
||||
if (cameraCfg.DisplayTerminal)
|
||||
if (CameraCfg.DisplayTerminal)
|
||||
{
|
||||
terminalDlg = new TerminalDlg(cameraCfg.Name, Telnet);
|
||||
terminalDlg = new TerminalDlg(CameraCfg.Name, Telnet);
|
||||
terminalDlg.Show();
|
||||
}
|
||||
|
||||
@@ -147,7 +158,7 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
{
|
||||
if (Telnet != null)
|
||||
{
|
||||
return new MeasurementOp(this, NetAdapter.IPAddress.ToString(), measurementUdpPortNr, string.Empty); /// TODO
|
||||
return new MeasurementOp(this, NetAdapter.IPAddress.ToString(), measurementUdpPortNr, roiParams);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -223,9 +234,9 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
}
|
||||
|
||||
string msg = string.Format("Camera {0} detected in {1} ms: HWAddress={2} IPAddress={3} {4}",
|
||||
cameraCfg.Name,
|
||||
CameraCfg.Name,
|
||||
duration_ms,
|
||||
cameraCfg.HardwareAddress,
|
||||
CameraCfg.HardwareAddress,
|
||||
ipAddress == null ? "not detected" : ipAddress.ToString(),
|
||||
response);
|
||||
log.Info(msg);
|
||||
|
||||
@@ -5,11 +5,12 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
public class MeasurementOp : IOperation
|
||||
{
|
||||
readonly CLP1611.Camera camera;
|
||||
readonly CLP1611.CameraCfg cameraCfg;
|
||||
readonly Telnet.TelnetClient telnet;
|
||||
|
||||
readonly string ipAddress;
|
||||
readonly int portNr;
|
||||
readonly string args;
|
||||
readonly string roiArgs;
|
||||
|
||||
string command;
|
||||
bool measurementCommandSent;
|
||||
@@ -19,13 +20,14 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
/// Events: Event.None or Event.Error
|
||||
/// </summary>
|
||||
/// <param name="camera">CLP1611.Camera reference</param>
|
||||
public MeasurementOp(Camera camera, string ipAddress, int portNr, string args)
|
||||
public MeasurementOp(Camera camera, string ipAddress, int portNr, string roiArgs)
|
||||
{
|
||||
this.camera = camera;
|
||||
this.cameraCfg = camera.CameraCfg;
|
||||
this.telnet = camera.Telnet;
|
||||
this.ipAddress = ipAddress;
|
||||
this.portNr = portNr;
|
||||
this.args = args;
|
||||
this.roiArgs = roiArgs;
|
||||
|
||||
measurementCommandSent = false;
|
||||
}
|
||||
@@ -45,8 +47,11 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
//
|
||||
// Prepare and send (=enqueue) command
|
||||
//
|
||||
command = string.Format("clp/Measurement -o {4}:{5} {6}", ipAddress, portNr, args);
|
||||
//command = string.Format("clp/Measurement -r {0} {1} {2} {3} -o {4}:{5} {6}", roiX, roiY, roiWid, roiHgh, ipAddress, portNr, args);
|
||||
command = string.Format("clp/Measurement -udp {0} {1}{2}{3} 1 1 0 0 0",
|
||||
ipAddress,
|
||||
portNr,
|
||||
cameraCfg.UseTestImages ? (" -l " + cameraCfg.TestImagesCount.ToString()) : string.Empty,
|
||||
roiArgs);
|
||||
telnet.Enqueue(new Telnet.Command(Telnet.CmdAction.SEND_STRING, command));
|
||||
measurementCommandSent = true;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
///
|
||||
/// Cfg
|
||||
///
|
||||
readonly RoiCfg roiCfg;
|
||||
public readonly RoiCfg RoiCfg;
|
||||
|
||||
public readonly CLP1611.Camera NetCamera;
|
||||
public readonly Roi PreviousRoi;
|
||||
@@ -32,7 +32,7 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
///
|
||||
public GenericDevices.ICamera Camera { get { return NetCamera as GenericDevices.ICamera; } }
|
||||
|
||||
public double PulsesPerLtr { get { return (double)roiCfg.ProcParams.PulsesPerLtr; } }
|
||||
public double PulsesPerLtr { get { return (double)RoiCfg.ProcParams.PulsesPerLtr; } }
|
||||
public double LtrsPerPulse { get { return (PulsesPerLtr <= float.Epsilon) ? 1.0 : (1 / PulsesPerLtr); ; } }
|
||||
|
||||
public int WMPulses { get { return wmPulses; } }
|
||||
@@ -56,6 +56,12 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
public Boxes.IntBox RoiY;
|
||||
public Boxes.IntBox RoiWid;
|
||||
public Boxes.IntBox RoiHgh;
|
||||
///
|
||||
public string RoiParams
|
||||
{
|
||||
get { return string.Format(" -roi 1 {0} {1} {2} bkgnd.bmp", RoiX.Val, RoiY.Val, RoiCfg.RoiParams); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Roi()
|
||||
@@ -66,10 +72,10 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
public Roi(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
{
|
||||
roiCfg = cfg as RoiCfg;
|
||||
RoiCfg = cfg as RoiCfg;
|
||||
NetCamera = TbfComponents.FindComponent(cfg.ParentName, components) as CLP1611.Camera;
|
||||
|
||||
PreviousRoi = TbfComponents.FindComponent(roiCfg.PreviousRoi, components) as Roi;
|
||||
PreviousRoi = TbfComponents.FindComponent(RoiCfg.PreviousRoi, components) as Roi;
|
||||
|
||||
detected = false;
|
||||
RoiX = new Boxes.IntBox();
|
||||
@@ -103,9 +109,9 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
{
|
||||
if (args.Command == CfgChangeCmd.CfgChange)
|
||||
{
|
||||
roiCfg.RoiParams = tmpcfg.RoiParams;
|
||||
roiCfg.UseTestImages = tmpcfg.UseTestImages;
|
||||
roiCfg.TestImagesCount = tmpcfg.TestImagesCount;
|
||||
RoiCfg.RoiParams = tmpcfg.RoiParams;
|
||||
RoiCfg.UseTestImages = tmpcfg.UseTestImages;
|
||||
RoiCfg.TestImagesCount = tmpcfg.TestImagesCount;
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -127,7 +133,7 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
if (NetCamera != null && NetCamera.Telnet != null)
|
||||
{
|
||||
Telnet = NetCamera.Telnet;
|
||||
return new RoiDetectionOp(this, roiCfg.RoiParams, RoiX, RoiY, RoiWid, RoiHgh);
|
||||
return new RoiDetectionOp(this, RoiX, RoiY, RoiWid, RoiHgh);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -5,9 +5,9 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
public class RoiDetectionOp : IOperation
|
||||
{
|
||||
readonly Roi roi;
|
||||
readonly RoiCfg roiCfg;
|
||||
readonly CLP1611.Camera camera;
|
||||
readonly Telnet.TelnetClient telnet;
|
||||
readonly string args;
|
||||
|
||||
string command;
|
||||
bool roiDetectionCommandSent;
|
||||
@@ -28,13 +28,13 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
/// Events: Event.None or Event.Error
|
||||
/// </summary>
|
||||
/// <param name="camera">CLP1611.Camera reference</param>
|
||||
public RoiDetectionOp(Roi roi, string args, Boxes.IntBox roiX, Boxes.IntBox roiY,
|
||||
Boxes.IntBox roiWid, Boxes.IntBox roiHgh)
|
||||
public RoiDetectionOp(Roi roi, Boxes.IntBox roiX, Boxes.IntBox roiY,
|
||||
Boxes.IntBox roiWid, Boxes.IntBox roiHgh)
|
||||
{
|
||||
this.roi = roi;
|
||||
this.roiCfg = roi.RoiCfg;
|
||||
this.camera = roi.NetCamera;
|
||||
this.telnet = roi.Telnet;
|
||||
this.args = args;
|
||||
this.roiX = roiX;
|
||||
this.roiY = roiY;
|
||||
this.roiWid = roiWid;
|
||||
@@ -90,7 +90,10 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
||||
previous.RoiWid.Val, previous.RoiHgh.Val);
|
||||
previous = previous.PreviousRoi;
|
||||
}
|
||||
command = string.Format("clp/RoiDetection{0} {1}", masks, args);
|
||||
command = string.Format("clp/RoiDetection{0}{1} {2}",
|
||||
masks,
|
||||
roiCfg.UseTestImages ? (" -l " + roiCfg.TestImagesCount.ToString()) : string.Empty,
|
||||
roiCfg.RoiParams);
|
||||
|
||||
//
|
||||
// Send (or enqueue) command
|
||||
|
||||
@@ -171,13 +171,43 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
int time = StateMachine.Time;
|
||||
double currentFlow = RefFlow.Val;
|
||||
|
||||
/// Extract cameras from the current sensors path, add operations to the detection state
|
||||
IList<IOperation> measureOperations = new List<IOperation>();
|
||||
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
|
||||
{
|
||||
GenericDevices.IRoi cameraRoi = sensPath.RegisterReaders[i] as GenericDevices.IRoi;
|
||||
if (cameraRoi != null) measureOperations.Add(cameraRoi.MeasurementOp());
|
||||
}
|
||||
|
||||
///
|
||||
/// Prepare cameras, ROI-s and measurementOperations
|
||||
///
|
||||
|
||||
/// Find ROI-s
|
||||
IList<GenericDevices.IRoi> rois = new List<GenericDevices.IRoi>();
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
if (rr is GenericDevices.IRoi) rois.Add(rr as GenericDevices.IRoi);
|
||||
}
|
||||
|
||||
/// Find cameras
|
||||
IList<GenericDevices.ICamera> cameras = new List<GenericDevices.ICamera>();
|
||||
foreach (var roi in rois)
|
||||
{
|
||||
if (!cameras.Contains(roi.Camera))
|
||||
{
|
||||
roi.Camera.ClearRoiParams();
|
||||
cameras.Add(roi.Camera);
|
||||
}
|
||||
}
|
||||
|
||||
/// Register ROI-parameters to cameras
|
||||
foreach (var roi in rois)
|
||||
{
|
||||
roi.Camera.RoiParams = roi.Camera.RoiParams + roi.RoiParams;
|
||||
}
|
||||
|
||||
/// Prepare measurementOperations
|
||||
IList<IOperation> measureOperations = new List<IOperation>();
|
||||
foreach (var camera in cameras)
|
||||
{
|
||||
measureOperations.Add(camera.MeasurementOp());
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Test_in_progress);
|
||||
|
||||
+37
-7
@@ -176,13 +176,43 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
int flowDetectTime = 0;
|
||||
float estFlowSetTime = 100.0f;
|
||||
|
||||
/// Extract cameras from the current sensors path, add operations to the detection state
|
||||
IList<IOperation> measureOperations = new List<IOperation>();
|
||||
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
|
||||
{
|
||||
GenericDevices.IRoi cameraRoi = sensPath.RegisterReaders[i] as GenericDevices.IRoi;
|
||||
if (cameraRoi != null) measureOperations.Add(cameraRoi.MeasurementOp());
|
||||
}
|
||||
|
||||
///
|
||||
/// Prepare cameras, ROI-s and measurementOperations
|
||||
///
|
||||
|
||||
/// Find ROI-s
|
||||
IList<GenericDevices.IRoi> rois = new List<GenericDevices.IRoi>();
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
if (rr is GenericDevices.IRoi) rois.Add(rr as GenericDevices.IRoi);
|
||||
}
|
||||
|
||||
/// Find cameras
|
||||
IList<GenericDevices.ICamera> cameras = new List<GenericDevices.ICamera>();
|
||||
foreach (var roi in rois)
|
||||
{
|
||||
if (!cameras.Contains(roi.Camera))
|
||||
{
|
||||
roi.Camera.ClearRoiParams();
|
||||
cameras.Add(roi.Camera);
|
||||
}
|
||||
}
|
||||
|
||||
/// Register ROI-parameters to cameras
|
||||
foreach (var roi in rois)
|
||||
{
|
||||
roi.Camera.RoiParams = roi.Camera.RoiParams + roi.RoiParams;
|
||||
}
|
||||
|
||||
/// Prepare measurementOperations
|
||||
IList<IOperation> measureOperations = new List<IOperation>();
|
||||
foreach (var camera in cameras)
|
||||
{
|
||||
measureOperations.Add(camera.MeasurementOp());
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Switching_flow_detection);
|
||||
|
||||
@@ -149,13 +149,43 @@ namespace TBF.BenchControl.TestMethods.Endurance
|
||||
/// Flying start measurement through line 1 or line 2
|
||||
///-----------------------------------------------------
|
||||
|
||||
/// Extract cameras from the current sensors path, add operations to the detection state
|
||||
IList<IOperation> measureOperations = new List<IOperation>();
|
||||
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
|
||||
{
|
||||
GenericDevices.IRoi cameraRoi = sensPath.RegisterReaders[i] as GenericDevices.IRoi;
|
||||
if (cameraRoi != null) measureOperations.Add(cameraRoi.MeasurementOp());
|
||||
}
|
||||
|
||||
///
|
||||
/// Prepare cameras, ROI-s and measurementOperations
|
||||
///
|
||||
|
||||
/// Find ROI-s
|
||||
IList<GenericDevices.IRoi> rois = new List<GenericDevices.IRoi>();
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
if (rr is GenericDevices.IRoi) rois.Add(rr as GenericDevices.IRoi);
|
||||
}
|
||||
|
||||
/// Find cameras
|
||||
IList<GenericDevices.ICamera> cameras = new List<GenericDevices.ICamera>();
|
||||
foreach (var roi in rois)
|
||||
{
|
||||
if (!cameras.Contains(roi.Camera))
|
||||
{
|
||||
roi.Camera.ClearRoiParams();
|
||||
cameras.Add(roi.Camera);
|
||||
}
|
||||
}
|
||||
|
||||
/// Register ROI-parameters to cameras
|
||||
foreach (var roi in rois)
|
||||
{
|
||||
roi.Camera.RoiParams = roi.Camera.RoiParams + roi.RoiParams;
|
||||
}
|
||||
|
||||
/// Prepare measurementOperations
|
||||
IList<IOperation> measureOperations = new List<IOperation>();
|
||||
foreach (var camera in cameras)
|
||||
{
|
||||
measureOperations.Add(camera.MeasurementOp());
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Test_in_progress);
|
||||
|
||||
+35
-7
@@ -208,13 +208,41 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
|
||||
double currentFlow = RefFlow.Val;
|
||||
|
||||
|
||||
/// Extract cameras from the current sensors path, add operations to the detection state
|
||||
IList<IOperation> measureOperations = new List<IOperation>();
|
||||
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
|
||||
{
|
||||
GenericDevices.IRoi cameraRoi = sensPath.RegisterReaders[i] as GenericDevices.IRoi;
|
||||
if (cameraRoi != null) measureOperations.Add(cameraRoi.MeasurementOp());
|
||||
}
|
||||
///
|
||||
/// Prepare cameras, ROI-s and measurementOperations
|
||||
///
|
||||
|
||||
/// Find ROI-s
|
||||
IList<GenericDevices.IRoi> rois = new List<GenericDevices.IRoi>();
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
if (rr is GenericDevices.IRoi) rois.Add(rr as GenericDevices.IRoi);
|
||||
}
|
||||
|
||||
/// Find cameras
|
||||
IList<GenericDevices.ICamera> cameras = new List<GenericDevices.ICamera>();
|
||||
foreach (var roi in rois)
|
||||
{
|
||||
if (!cameras.Contains(roi.Camera))
|
||||
{
|
||||
roi.Camera.ClearRoiParams();
|
||||
cameras.Add(roi.Camera);
|
||||
}
|
||||
}
|
||||
|
||||
/// Register ROI-parameters to cameras
|
||||
foreach (var roi in rois)
|
||||
{
|
||||
roi.Camera.RoiParams = roi.Camera.RoiParams + roi.RoiParams;
|
||||
}
|
||||
|
||||
/// Prepare measurementOperations
|
||||
IList<IOperation> measureOperations = new List<IOperation>();
|
||||
foreach (var camera in cameras)
|
||||
{
|
||||
measureOperations.Add(camera.MeasurementOp());
|
||||
}
|
||||
|
||||
|
||||
|
||||
///
|
||||
|
||||
+35
-7
@@ -283,13 +283,41 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
double currentFlow = RefFlow.Val;
|
||||
|
||||
|
||||
/// Extract cameras from the current sensors path, add operations to the detection state
|
||||
IList<IOperation> measureOperations = new List<IOperation>();
|
||||
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
|
||||
{
|
||||
GenericDevices.IRoi cameraRoi = sensPath.RegisterReaders[i] as GenericDevices.IRoi;
|
||||
if (cameraRoi != null) measureOperations.Add(cameraRoi.MeasurementOp());
|
||||
}
|
||||
///
|
||||
/// Prepare cameras, ROI-s and measurementOperations
|
||||
///
|
||||
|
||||
/// Find ROI-s
|
||||
IList<GenericDevices.IRoi> rois = new List<GenericDevices.IRoi>();
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
if (rr is GenericDevices.IRoi) rois.Add(rr as GenericDevices.IRoi);
|
||||
}
|
||||
|
||||
/// Find cameras
|
||||
IList<GenericDevices.ICamera> cameras = new List<GenericDevices.ICamera>();
|
||||
foreach (var roi in rois)
|
||||
{
|
||||
if (!cameras.Contains(roi.Camera))
|
||||
{
|
||||
roi.Camera.ClearRoiParams();
|
||||
cameras.Add(roi.Camera);
|
||||
}
|
||||
}
|
||||
|
||||
/// Register ROI-parameters to cameras
|
||||
foreach (var roi in rois)
|
||||
{
|
||||
roi.Camera.RoiParams = roi.Camera.RoiParams + roi.RoiParams;
|
||||
}
|
||||
|
||||
/// Prepare measurementOperations
|
||||
IList<IOperation> measureOperations = new List<IOperation>();
|
||||
foreach (var camera in cameras)
|
||||
{
|
||||
measureOperations.Add(camera.MeasurementOp());
|
||||
}
|
||||
|
||||
|
||||
|
||||
///
|
||||
|
||||
@@ -243,13 +243,43 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
|
||||
|
||||
temperature_set:
|
||||
|
||||
/// Extract cameras from the current sensors path, add operations to the detection state
|
||||
IList<IOperation> measureOperations = new List<IOperation>();
|
||||
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
|
||||
{
|
||||
GenericDevices.IRoi cameraRoi = sensPath.RegisterReaders[i] as GenericDevices.IRoi;
|
||||
if (cameraRoi != null) measureOperations.Add(cameraRoi.MeasurementOp());
|
||||
}
|
||||
|
||||
///
|
||||
/// Prepare cameras, ROI-s and measurementOperations
|
||||
///
|
||||
|
||||
/// Find ROI-s
|
||||
IList<GenericDevices.IRoi> rois = new List<GenericDevices.IRoi>();
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
if (rr is GenericDevices.IRoi) rois.Add(rr as GenericDevices.IRoi);
|
||||
}
|
||||
|
||||
/// Find cameras
|
||||
IList<GenericDevices.ICamera> cameras = new List<GenericDevices.ICamera>();
|
||||
foreach (var roi in rois)
|
||||
{
|
||||
if (!cameras.Contains(roi.Camera))
|
||||
{
|
||||
roi.Camera.ClearRoiParams();
|
||||
cameras.Add(roi.Camera);
|
||||
}
|
||||
}
|
||||
|
||||
/// Register ROI-parameters to cameras
|
||||
foreach (var roi in rois)
|
||||
{
|
||||
roi.Camera.RoiParams = roi.Camera.RoiParams + roi.RoiParams;
|
||||
}
|
||||
|
||||
/// Prepare measurementOperations
|
||||
IList<IOperation> measureOperations = new List<IOperation>();
|
||||
foreach (var camera in cameras)
|
||||
{
|
||||
measureOperations.Add(camera.MeasurementOp());
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Test_in_progress);
|
||||
|
||||
+38
-5
@@ -344,14 +344,43 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
|
||||
temperature_set:
|
||||
|
||||
/// Extract cameras from the current sensors path, add operations to the detection state
|
||||
IList<IOperation> measureOperations = new List<IOperation>();
|
||||
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
|
||||
|
||||
///
|
||||
/// Prepare cameras, ROI-s and measurementOperations
|
||||
///
|
||||
|
||||
/// Find ROI-s
|
||||
IList<GenericDevices.IRoi> rois = new List<GenericDevices.IRoi>();
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
if (rr is GenericDevices.IRoi) rois.Add(rr as GenericDevices.IRoi);
|
||||
}
|
||||
|
||||
/// Find cameras
|
||||
IList<GenericDevices.ICamera> cameras = new List<GenericDevices.ICamera>();
|
||||
foreach (var roi in rois)
|
||||
{
|
||||
GenericDevices.IRoi cameraRoi = sensPath.RegisterReaders[i] as GenericDevices.IRoi;
|
||||
if (cameraRoi != null) measureOperations.Add(cameraRoi.MeasurementOp());
|
||||
if (!cameras.Contains(roi.Camera))
|
||||
{
|
||||
roi.Camera.ClearRoiParams();
|
||||
cameras.Add(roi.Camera);
|
||||
}
|
||||
}
|
||||
|
||||
/// Register ROI-parameters to cameras
|
||||
foreach (var roi in rois)
|
||||
{
|
||||
roi.Camera.RoiParams = roi.Camera.RoiParams + roi.RoiParams;
|
||||
}
|
||||
|
||||
/// Prepare measurementOperations
|
||||
IList<IOperation> measureOperations = new List<IOperation>();
|
||||
foreach (var camera in cameras)
|
||||
{
|
||||
measureOperations.Add(camera.MeasurementOp());
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (emptyTheTank)
|
||||
{
|
||||
@@ -476,6 +505,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
while (!e.Contains(Event.MeasurementStarted));
|
||||
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
}
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
if (rr is WaterMeters.iPerl.WaterMeter) (rr as WaterMeters.iPerl.WaterMeter).TestName = test.Name;
|
||||
|
||||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.12.437.1")]
|
||||
[assembly: AssemblyFileVersion("2.12.437.1")]
|
||||
[assembly: AssemblyVersion("2.12.438.1")]
|
||||
[assembly: AssemblyFileVersion("2.12.438.1")]
|
||||
|
||||
Reference in New Issue
Block a user