Skip to content

Commit e046345

Browse files
arrenglovericub@IITICUBLAP267lunagava
authored
zynqGrabber stability (#217)
* adding test checks for corruption in zynqGrabber * removed corruption based on x.y coord * fixed compile issues on ultrascale * added option to skip vision applications * zynqGrabber.ini standard from current on robot * cleaned hpeInterface corruption filter * working (temporary?) skin codec * vFramer portname using time instead of rand() * remove unused variable --------- Co-authored-by: icub@IITICUBLAP267 <icub@IITICUBLAP267> Co-authored-by: Luna <[email protected]>
1 parent 9f899b1 commit e046345

File tree

12 files changed

+186
-30
lines changed

12 files changed

+186
-30
lines changed

CMakeLists.txt

+8
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,14 @@ endif()
9090
add_subdirectory(ev2)
9191

9292
#build additional tools
93+
set(VLIB_FORCESLIM OFF CACHE BOOL "force lightweight build")
94+
if(VLIB_FORCESLIM)
95+
message(STATUS "OFF: applications using opencv and drivers not compiled")
96+
set(OpenCV_FOUND OFF)
97+
set(MetavisionSDK_FOUND OFF)
98+
set(prophesee_core_FOUND OFF)
99+
endif()
100+
93101
add_subdirectory(cpp_tools)
94102

95103
#install the package

cpp_tools/log2vid/log2vid.cpp

+2-5
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,12 @@
22
#include <string>
33
#include <fstream>
44
#include <iostream>
5-
#include <filesystem>
65
#include <vector>
76
#include <opencv2/opencv.hpp>
87
#include <event-driven/core.h>
98
#include <event-driven/algs.h>
109
#include <event-driven/vis.h>
1110

12-
//using yarp::os::ResourceFinder;
13-
namespace fs = std::filesystem;
1411
using yarp::os::Value;
1512

1613
void helpfunction()
@@ -76,7 +73,7 @@ int main(int argc, char* argv[])
7673
yInfo() << "Loading log file ... ";
7774
if(!loader.load(file_path)) {
7875
yError() << "Could not open log file";
79-
return false;
76+
return -1;
8077
} else {
8178
yInfo() << loader.getinfo();
8279
}
@@ -199,4 +196,4 @@ int main(int argc, char* argv[])
199196

200197
return 0;
201198

202-
}
199+
}

cpp_tools/vFramer/drawers.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ bool drawerInterface::threadInit()
8585
bool drawerInterfaceAE::initialise(const std::string &name, int height, int width, double window_size, bool yarp_publish, const std::string &remote)
8686
{
8787
this->name = name;
88-
srand (time(NULL));
8988
std::stringstream ss;
90-
ss << "/vFramer/" << rand()%10000 << "/AE:i";
89+
ss << "/vFramer/" << (int)(yarp::os::Time::now())<< "/AE:i";
90+
yarp::os::Time::delay(1);
9191
this->portName = ss.str();
9292
this->sourceName = remote;
9393
this->yarp_publish = yarp_publish;

cpp_tools/zynqGrabber/hpuInterface.h

+4
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ class hpuInterface {
118118
if(event.skin) {
119119
//SKIN
120120
packet_skin->push_back(event);
121+
} else if(event.x > params.roi_max_x || event.y > params.roi_max_y) {
122+
yWarning() << "[" << event.x << "," << event.y << "]";
121123
} else {
122124
//VISION
123125
if(params.filter > 0.0 && !refrac.check(event, toc)) {
@@ -239,6 +241,8 @@ class hpuInterface {
239241
unsigned int max_packet_size{8*7500};
240242
bool split{false};
241243
double filter{0.0};
244+
int roi_max_x{640};
245+
int roi_max_y{480};
242246

243247
} params;
244248

cpp_tools/zynqGrabber/zynqGrabber.ini

+159-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,167 @@
11
dataDevice /dev/iit-hpu0
22
hpu_read
3+
packet_size 7500 #these are in number of events
34
gtp
45
split
5-
#hpu_write
6-
packet_size 7500
76

87
i2cVision /dev/i2c-0
8+
9+
#visCtrlLeft /dev/i2c-0
10+
#visCtrlRight /dev/i2c-0
911
#skinCtrl /dev/i2c-3
1012

11-
sensitivity 60
12-
refractory 1
13+
#visLeftOn true
14+
#visRightOn false
15+
#left_off true
16+
#right_off true
17+
sensitivity 70
18+
refractory 1
19+
filter 0.0001
20+
21+
[ATIS_ROI]
22+
x 0
23+
y 0
24+
width 640
25+
height 480
26+
27+
28+
[ATIS1_BIAS_LEFT]
29+
30+
CtrlbiasLP 1800 967 620
31+
CtrlbiasLBBuff 1800 967 950
32+
CtrlbiasDelTD 1800 967 400
33+
CtrlbiasSeqDelAPS 1800 967 320
34+
CtrlbiasDelAPS 1800 967 350
35+
biasSendReqPdY 1800 967 850
36+
biasSendReqPdX 1800 967 1150
37+
CtrlbiasGB 1800 711 1150
38+
TDbiasReqPuY 1800 711 200
39+
TDbiasReqPuX 1800 711 1200
40+
APSbiasReqPuY 1800 711 1100
41+
APSbiasReqPuX 1800 711 830
42+
APSVrefL 3300 967 3000
43+
APSVrefH 3300 967 3200
44+
APSbiasOut 3300 967 660
45+
APSbiasHyst 3300 967 455
46+
APSbiasTail 3300 967 520
47+
TDbiasCas 3300 839 2000
48+
TDbiasInv 3300 967 800
49+
TDbiasDiffOff 3300 967 450
50+
TDbiasDiffOn 3300 967 625
51+
TDbiasDiff 3300 967 500
52+
TDbiasFo 3300 711 3050
53+
TDbiasRefr 3300 711 2850
54+
TDbiasPR 3300 711 2800
55+
TDbiasBulk 3300 711 2680
56+
biasBuf 3300 967 0
57+
biasAPSreset 3300 711 1000
58+
59+
[ATIS1_BIAS_RIGHT]
60+
61+
CtrlbiasLP 1800 967 620
62+
CtrlbiasLBBuff 1800 967 950
63+
CtrlbiasDelTD 1800 967 400
64+
CtrlbiasSeqDelAPS 1800 967 320
65+
CtrlbiasDelAPS 1800 967 350
66+
biasSendReqPdY 1800 967 850
67+
biasSendReqPdX 1800 967 1150
68+
CtrlbiasGB 1800 711 1150
69+
TDbiasReqPuY 1800 711 200
70+
TDbiasReqPuX 1800 711 1200
71+
APSbiasReqPuY 1800 711 1100
72+
APSbiasReqPuX 1800 711 830
73+
APSVrefL 3300 967 3000
74+
APSVrefH 3300 967 3200
75+
APSbiasOut 3300 967 660
76+
APSbiasHyst 3300 967 455
77+
APSbiasTail 3300 967 520
78+
TDbiasCas 3300 839 2000
79+
TDbiasInv 3300 967 800
80+
TDbiasDiffOff 3300 967 450
81+
TDbiasDiffOn 3300 967 625
82+
TDbiasDiff 3300 967 500
83+
TDbiasFo 3300 711 3050
84+
TDbiasRefr 3300 711 2850
85+
TDbiasPR 3300 711 2800
86+
TDbiasBulk 3300 711 2680
87+
biasBuf 3300 967 0
88+
biasAPSreset 3300 711 1000
89+
90+
[DVS_BIAS_LEFT]
91+
92+
cas 52458
93+
injg 101508
94+
reqPd 16777215
95+
pux 8053457
96+
diffoff 133
97+
req 160712
98+
refr 944
99+
puy 16777215
100+
diffon 639172
101+
diff 30108
102+
foll 20
103+
pr 5
104+
105+
[DVS_BIAS_RIGHT]
106+
107+
cas 52458
108+
injg 101508
109+
reqPd 16777215
110+
pux 8053457
111+
diffoff 133
112+
req 160712
113+
refr 944
114+
puy 16777215
115+
diffon 639172
116+
diff 30108
117+
foll 20
118+
pr 5
119+
120+
[SKIN_CNFG]
121+
samplesTxEn true
122+
eventsTxEn true
123+
124+
asrFilterType false
125+
asrFilterEn false
126+
egNthrEn true
127+
preprocSamples true
128+
preprocEg true
129+
driftCompEn false
130+
samplesTxMode true
131+
# enable 16 bits coding (true) or 8 bits coding (false)
132+
samplesRshift 0
133+
# if samples TxMode = false needs to set the shift value
134+
samplesSel false
135+
#Samples source (0: pre-proc, 1: post-preproc);
136+
resamplingTimeout 50
137+
#timebase 50ns
138+
139+
evGenSel 1
140+
141+
G1upthresh 0.1
142+
G1downthresh 0.1
143+
G1upnoise 12.0
144+
G1downnoise 12.0
145+
146+
G2upthresh 30
147+
G2downthresh 30
148+
G2upnoise 50
149+
G2downnoise 50
150+
151+
#evNeuralUseSA1
152+
SA1inhibit 524288
153+
SA1adapt 328
154+
SA1decay -328
155+
SA1rest 2621
156+
157+
#evNeuralUseRA1
158+
RA1inhibit 327680
159+
RA1adapt 3
160+
RA1decay -6552
161+
RA1rest 65536
162+
163+
evNeuralUseRA2
164+
RA2inhibit 327680
165+
RA2adapt 3
166+
RA2decay -3276
167+
RA2rest 2621

cpp_tools/zynqGrabber/zynqModule.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class zynqGrabberModule : public yarp::os::RFModule {
4040
hpuInterface hpu;
4141

4242
public:
43-
bool configure(yarp::os::ResourceFinder &rf) {
43+
bool configure(yarp::os::ResourceFinder &rf) override {
4444

4545
if(rf.check("help")) {
4646
yInfo() << "ZYNQGRABBER: DIRECT FROM PROPHESEE TO YOU!";
@@ -61,6 +61,7 @@ class zynqGrabberModule : public yarp::os::RFModule {
6161
yInfo() << "--packet_size <int>[5120]: standard events in packet (not enforced)";
6262
yInfo() << "--split <bool>[false]: split data in channels";
6363
yInfo() << "--filter <double>[0.0]: temporal filter of vision (ms) 0.0 = off";
64+
return false;
6465
}
6566

6667
setName(rf.check("name", yarp::os::Value("/zynqGrabber")).asString().c_str());

ev2/event-driven/algs/corner.h

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ class corner_detector
3939
std::thread harris_thread;
4040
std::mutex m;
4141
std::condition_variable signal;
42-
bool eros_updated;
4342

4443
double threshold{0.0};
4544
double score_mean{0.0};

ev2/event-driven/algs/flow.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class zcflowBlock
119119

120120
// cv::Mat sae;
121121
double tolerance{0.125};
122-
double refracotry_period{0.003};
122+
//double refracotry_period{0.003};
123123
double dt{0.05};
124124
size_t N{30};
125125

ev2/event-driven/core/codec.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
const std::string ev::timeStamp::tag = "TS";
2222
const std::string ev::addressEvent::tag = "AE";
2323
const std::string ev::encoded::tag="AE";
24-
const std::string ev::skinAE::tag = "SKE";
24+
const std::string ev::skinAE::tag = "AE";
2525
const std::string ev::skinSample::tag = "SKS";
2626
const std::string ev::flowEvent::tag = "FLOW";
2727
const std::string ev::gaussianEvent::tag = "GAE";

ev2/event-driven/core/codec.h

+3-11
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,9 @@ typedef struct encoded : public timeStamp {
5252
typedef struct skinAE : public timeStamp {
5353
static const std::string tag;
5454
unsigned int polarity:1;
55-
unsigned int taxel:10;
56-
unsigned int _reserved1:2;
57-
unsigned int cross_base:1;
58-
unsigned int _sample:1;
59-
unsigned int _error:1;
60-
unsigned int body_part:3;
61-
unsigned int _reserved2:3;
62-
unsigned int side:1;
63-
unsigned int type:1;
64-
unsigned int skin:1;
65-
unsigned int _fill:7;
55+
unsigned int taxel:4;
56+
unsigned int device:4;
57+
unsigned int constant:23;
6658
} skinAE;
6759

6860
typedef struct skinValue {

ev2/event-driven/core/comms.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ template <typename T> class packet : public yarp::os::Portable {
162162
return e;
163163
}
164164

165-
int fillFromMemory(char *s, int bytes)
165+
int fillFromMemory(const char *s, int bytes)
166166
{
167167
n_elements = bytes / sizeof(T);
168168
buffer.resize(n_elements);

ev2/event-driven/core/utilities.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ extern double vtsscaler;
4747
/// a flag to read if individual event timestamps are enabled
4848
extern bool ts_status;
4949

50-
static double ticksToSeconds(const unsigned int tick)
50+
static inline double ticksToSeconds(const unsigned int tick)
5151
{
5252
(void)ticksToSeconds;
5353
return tick * tsscaler;
5454
}
5555

56-
static unsigned int secondsToTicks(const double seconds)
56+
static inline unsigned int secondsToTicks(const double seconds)
5757
{
5858
(void)secondsToTicks;
5959
return seconds * vtsscaler;
@@ -71,7 +71,7 @@ static double deltaS(const int current_tick, const int prev_tick)
7171
return deltaTicks(current_tick, prev_tick) * tsscaler;
7272
}
7373

74-
static double deltaMS(const int current_tick, const int prev_tick)
74+
static inline double deltaMS(const int current_tick, const int prev_tick)
7575
{
7676
(void)deltaMS;
7777
return deltaS(current_tick, prev_tick) * 1000.0;

0 commit comments

Comments
 (0)