M2i-LAN Laser-Scanner manual
HB-M2-iLAN-UDP-E.doc
page 36 of 44
MEL Mikroelektronik GmbH, Breslauer Str. 2, 85386 Eching / Germany
www.MELSensor.de
// M2DHardwareInfo
// get some information about sensor hardware
// fills out the M2DHWInfo struct
int
M2DHardwareInfo (M2DInfo *inf, M2DHWInfo *hw)
{
int
i, res;
long
tmp;
do
{
res = M2DStatusInt (inf,32,2,&hw->ccdh);
if
(res<0)
break
;
res = M2DStatusInt (inf,34,2,&hw->ccdh);
if
(res<0)
break
;
res = M2DStatusInt (inf,36,4,&hw->ccdh);
if
(res<0)
break
;
res = M2DStatusInt (inf,32,2,&hw->ccdh);
if
(res<0)
break
;
res = M2DStatusInt (inf,40,2,&tmp); if(res<0) break;
hw->amb=tmp;
res = M2DStatusInt (inf,42,2,&tmp); if(res<0)
break
;
hw->mb=tmp;
res = M2DStatusInt (inf,44,2,&tmp); if(res<0)
break
;
hw->sbAmb=tmp;
res = M2DStatusInt (inf,46,2,&tmp); if(res<0)
break
;
hw->sbEmb=tmp;
res = M2DStatusInt (inf,30,1,&hw->opt1); if(res<0)
break
;
if
(hw->opt1 & 8 == 0) {
hw->amb /=10.f;
hw->mb /= 10.f;
hw->sbAmb /=10.f;
hw->abEmb /=10.f;
}
res = MwDStatusInt(inf,48,2,&hw->maxZ);
if
(res<0)
break
;
res = MwDStatusInt(inf,50,2,&hw->maxX);
if
(res<0)
break
;
res = MwDStatusInt(inf,2,1,&hw->controllerVersion); if (res<0)
break
;
res = MwDStatusInt(inf,3,1,&hw->cameraVersion);
if
(res<0)
break
;
res = MwDStatusInt(inf,0,1,&hw->temperature);
if
(res<0)
break
;
if
(hw->temperature>127){
hw->temperature -= 128;
}else{
hw->temperature = ~hw->tempe 1;
}
} while
(0);
return
res;
}
// M2DFilter
// minimalistic filter, removes all definitive invalid values and
// converts to float
void
M2DFilter (
int
anz,
int
*x,
int
*z,
int
*intens,
int
minIntens,
int
*fanz,
float
*xf,
float
*zf)
{
int
i, cnt;
cnt = 0;
for
(i=0;i<anz;i++){
if
(x[i]>0
&&
x[i]<4095
&&
z[i]>0
&&
z[i]<4095
&&
intens[i]>=minIntens){
Xf[cnt] = x[i];
Zf[cnt] = z[i];
cnt++;
}
}
*fanz = cnt;
}
e
e
x
x
a
a
m
m
p
p
l
l
e
e
:
:
/
/
/
/
r
r
e
e
a
a
d
d
o
o
u
u
t
t
F
F
i
i
F
F
o
o
s
s
t
t
a
a
t
t
u
u
s
s
a
a
n
n
d
d
s
s
e
e
n
n
s
s
o
o
r
r
t
t
e
e
m
m
p
p
e
e
r
r
a
a
t
t
u
u
r
r
e
e
*scanner = 0x18;
*scanner = 1 | 0x80;
For (y = 0; y < 31 ; y++)
{
*scanner = y |0x80 ;