FEDRA emulsion software from the OPERA Collaboration
hwinit.C File Reference
This graph shows which files directly or indirectly include this file:

Functions

int hwinit ()
 

Variables

int Cluster_Threshold =400
 
float DZ =35
 
AcqMarksScannerFM
 
float FPS =150
 
int FragNx =5
 
int FragNy =5
 
char Kernel [KernelSize *KernelSize]
 
int Layers =16
 
int LDelay =200
 
int LLMAX =32767
 
int LLMIN =23000
 
int Norm =12
 int Norm=3; More...
 
AcqOdysseyo
 
AcqSerialPlateChangerPC
 
AcqStage1s
 
float Speed =1.*FPS*DZ/(Layers-1)
 
int ThrBot =30
 
int ThrTop =60
 
AcqTrackScannerTS
 
float Z0 =648
 

Function Documentation

◆ hwinit()

int hwinit ( )
73{
74 int res;
75
76// STAGE initialization and configuration
77 /*
78 For each axis:
79
80 int Axis; // Axis number (1 to 3)
81 int BoardId; // NI7344 Board number (Default is 0)
82 int StepsRev; // Step motor parameter : steps per revolution
83 int LinesRev; // Encoder parameter : lines per revolution (in case of linear encoder defines line-to-step ratio only).
84 float EncoderToMicrons; // Microns per one line of encoder
85 float MicronsToSteps; // Microns per one step of step motor
86 float Accel; // Max acceleration [mic/s2]
87 float MaxSpeed; // Max speed [mic/s]
88 int LimPol,HomePol; // Limiter switch and Home switch polarities
89 int CtlModeIsCWCCW; // Stepper control mode: Step/Direction (0) or Clockwise/Counterclockwise (1)
90 int TurnOffLightTime; //Not implemented yet!
91 int Invert; // defines axis direction inversion
92 float HomingSpeed; // Speed when perfoming home finding
93 float Reference; // user derived Reference value (usually emulsion corner position for X,Y and glass surface for Z)
94 float NominalReference; // Nominal Reference value (usually emulsion corner position for X,Y and glass surface for Z)
95
96
97 Once for the stage object:
98 float ZHomingXPos, ZHomingYPos; //Positions on X and Y where Z homing can be made safely.
99 float EmTopLayer; // user measured Thickness of top emulsion layer (by focusing procedure)
100 float EmBotLayer; // user measured Thickness of bottom emulsion layer (by focusing procedure)
101 float EmBase; // user measured Thickness of emulsion base [mic]
102 float NominalEmLayer; // nominal Thickness of emulsion layer
103 float NominalEmBase; // nominal Thickness of emulsion base [mic]
104 */
105 s=new AcqStage1();
106 s->Initialize();
107 s->X->LoadMoveCompleteCriteria(0,1,0,1,2.,0,0);
108 s->Y->LoadMoveCompleteCriteria(0,1,0,1,2.,0,0);
109// s->X->LoadMoveCompleteCriteria(0,1,0,1,1.,0,0);
110// s->Y->LoadMoveCompleteCriteria(0,1,0,1,1.,0,0);
111 s->Z->LoadMoveCompleteCriteria(0,1,0,1,1.,0,0);
112 s->X->SetFilterFrequency(0); //Max 25.6MHz
115 s->Z->Reference=200;
116 s->Z->NominalReference=200;
117 s->X->Reference=-137000;
118 s->X->NominalReference=-137000;
119 s->Y->Reference=26595;
120 s->Y->NominalReference=26595;
121 s->L->LightLevel=24567;
122 s->L->ON();
123
124// ODYSSEY init and config
125 /*
126 int SizeX, SizeY; //Image size, aquired from digitizer settings
127 bool SubtractBG; // Flag to be set by user, controls BG subtraction
128 bool ApplyFIRF; // Flag to be set by user, controls FIR filtering
129 bool ApplyGainCorr; // Flag to be set by user, controls gain correction
130 int Threshold; // Parameter to be set by user, controls threshold cut on the image
131 float PixelToMicronX;
132 float PixelToMicronY;
133 float OpticalShrinkage;
134
135 */
136 o=new AcqOdyssey();
137 o->PixelToMicronX=-0.293;
138 o->PixelToMicronY=0.293;
139 if(!o->Initialize("..\\mc1310_8channels_ASYNC_TRIG.dcf",48)) return 0;
140 o->UARTSendString(":r60B0",6); //to set camera to async pulsewidth mode
141 o->SetFIRFKernel((char*)Kernel,KernelSize,KernelSize);
143
144// Fiducial Mark scanner init and config
145 /*
146 float FPS; //Frames per second to use when scanning FM's (max ~220 presently, 200 is safe)
147 int Layers; // Layers to scan ( default 10)
148 int Threshold; // Pixel pulsehight threshold to use for clustering (0-255)
149 float MarkDiameter; // Nominal mark diameter [mic]
150 float MarkDiameterTolerance; // tolerance [mic]
151 int ViewsToScan; // Number ov views to scan when searching for FM (in spiral pattern)
152 float StepX,StepY; // steps between adjacent views in spiral pattern
153 float XYScanSpeed; // view-to-view move speed [mic/s]
154
155 */
156 FM=new AcqMarksScanner();
157 FM->SetPointers(s,o);
158 FM->FPS=FPS;
159 FM->MarkDiameter=70;
160 FM->MarkDiameterTolerance=10; //new opera marks
161// FM->SetMapext("mapext: 0 0 0 0; 3 0 0 125000 100000; 1 10000 10000 10000 10000 1 1 0; 2 115000 10000 115000 10000 1 1 0; 3 109800 90200 109800 90200 1 1 0;"); //B100235
162 FM->SetMapext("mapext: 0 0 0 0; 3 0 0 125000 100000; 0 9490.468750 10242.023438 9490.468750 10242.023438 1 1 0; 1 114791.359375 10212.367188 114791.359375 10212.367188 1 1 0; 2 109716.664063 90540.507813 109716.664063 90540.507813 1 1 0;");
163// Track scanner init and config
164/*
165 int Layers; // Number of layers to scan
166 int FPS; // Frames per second for Z scan (200 is safe so far)
167 float XYViewToViewSpeed; // [mic/s]
168 float ZBackStrokeSpeed; //[mic/s]
169 float ViewStepX, ViewStepY; // step between views in [mic]
170 int Nx,Ny; // Fragment size in views
171
172*/
173 TS=new AcqTrackScanner();
174 TS->SetPointers(s,o);
175 TS->FPS=FPS;
177 TS->Nx=FragNx; TS->Ny=FragNy;
178
179// PlateChanger init and config
180 /*
181 // COM port settings
182 int ComPort;
183 int ComBaud;
184
185 int SourceBank; // source bank (1 to NumberOfBanks)
186 int DestinationBank; // source bank (1 to NumberOfBanks
187 int PositionTimeout; // Timeout in x100ms to position the arm
188 int VacuumTimeout; // Timeout in x100ms to reach the vacuum on table or arm
189 int NumberOfBanks; // Number of banks on the table
190 bool LiftCorners; // if set - arm tries first to lift corners of the emulsion
191 // when taking it from the stage
192 int NumberOfAttempt; // max number of attempts to take emulsion from the plate
193 int SeparationAttempts; // number of up-down movements against brushes in bank
194 // to separate emulsion from separator
195
196 float XLoadPosition; //stage positions for safe emulsion load/unload
197 float YLoadPosition;
198 float ZLoadPosition;
199
200 */
202 PC->ComPort=2;
203 PC->Initialize(s);
204 PC->XLoadPosition=-76548;
205 PC->YLoadPosition=3677;
206 PC->Print();
207
208// AOB
209// inittracker();
210 return 1;
211}
void LoadMoveCompleteCriteria(bool MotorOff, bool Stop, bool Delay, bool InPosition, float DeadBand, int sdelay, int minPulse)
Definition: AcqStage1.cxx:567
float Reference
Definition: AcqStage1.h:72
float NominalReference
Definition: AcqStage1.h:73
void SetFilterFrequency(int Freq)
Definition: AcqStage1.cxx:838
int LightLevel
Definition: AcqStage1.h:117
void ON()
Definition: AcqStage1.cxx:895
Definition: AcqMarksScanner.h:22
float FPS
Definition: AcqMarksScanner.h:47
float MarkDiameter
Definition: AcqMarksScanner.h:50
float MarkDiameterTolerance
Definition: AcqMarksScanner.h:51
bool SetPointers(AcqStage1 *stg, AcqOdyssey *ody)
Definition: AcqMarksScanner.h:31
bool SetMapext(char *mapext)
Definition: AcqMarksScanner.cxx:43
Definition: AcqOdyssey.h:49
void UARTSendString(const char *s, int N)
Definition: AcqOdyssey.cxx:1217
void SetFIRFNorm(int Norm)
Definition: AcqOdyssey.cxx:237
float PixelToMicronY
Definition: AcqOdyssey.h:179
void SetFIRFKernel(char *Kern, int W, int H)
Definition: AcqOdyssey.cxx:243
float PixelToMicronX
Definition: AcqOdyssey.h:178
bool Initialize(char *DCF, int N)
Definition: AcqOdyssey.cxx:109
Definition: AcqSerialPlateChanger.h:59
float XLoadPosition
Definition: AcqSerialPlateChanger.h:119
float YLoadPosition
Definition: AcqSerialPlateChanger.h:120
int ComPort
Definition: AcqSerialPlateChanger.h:92
int Initialize(AcqStage1 *Stage=NULL)
Definition: AcqSerialPlateChanger.cxx:105
virtual void Print()
Definition: AcqSerialPlateChanger.cxx:55
Definition: AcqStage1.h:134
AcqLight * L
Definition: AcqStage1.h:148
bool Initialize()
Definition: AcqStage1.cxx:168
AcqAxis * Y
Definition: AcqStage1.h:146
AcqAxis * Z
Definition: AcqStage1.h:147
AcqAxis * X
Definition: AcqStage1.h:145
Definition: AcqTrackScanner.h:18
int Layers
Definition: AcqTrackScanner.h:30
int Ny
Definition: AcqTrackScanner.h:35
bool SetPointers(AcqStage1 *stg, AcqOdyssey *ody)
Definition: AcqTrackScanner.h:24
int Nx
Definition: AcqTrackScanner.h:35
int FPS
Definition: AcqTrackScanner.h:31
AcqMarksScanner * FM
Definition: hwinit.C:3
int Layers
Definition: hwinit.C:65
int FragNy
Definition: hwinit.C:16
AcqOdyssey * o
Definition: hwinit.C:2
float FPS
Definition: hwinit.C:10
int Norm
int Norm=3;
Definition: hwinit.C:21
char Kernel[KernelSize *KernelSize]
Definition: hwinit.C:22
AcqTrackScanner * TS
Definition: hwinit.C:4
AcqSerialPlateChanger * PC
Definition: hwinit.C:5
AcqStage1 * s
Definition: hwinit.C:1
int FragNx
Definition: hwinit.C:15

Variable Documentation

◆ Cluster_Threshold

int Cluster_Threshold =400

◆ DZ

float DZ =35

◆ FM

◆ FPS

float FPS =150

◆ FragNx

int FragNx =5

◆ FragNy

int FragNy =5

◆ Kernel

char Kernel[KernelSize *KernelSize]
Initial value:
=
{
-4, -4, -4, -4, -4, -4,
-4, 5, 5, 5, 5, -4,
-4, 5, 5, 5, 5, -4,
-4, 5, 5, 5, 5, -4,
-4, 5, 5, 5, 5, -4,
-4, -4, -4, -4, -4, -4 }

◆ Layers

int Layers =16

◆ LDelay

int LDelay =200

◆ LLMAX

int LLMAX =32767

◆ LLMIN

int LLMIN =23000

◆ Norm

int Norm =12

int Norm=3;

◆ o

◆ PC

◆ s

◆ Speed

float Speed =1.*FPS*DZ/(Layers-1)

◆ ThrBot

int ThrBot =30

◆ ThrTop

int ThrTop =60

◆ TS

◆ Z0

float Z0 =648