質問編集履歴
2
変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -17,6 +17,18 @@
|
|
17
17
|
これで大丈夫でしょうか。
|
18
18
|
|
19
19
|
また、他にファイルを開くことができない原因はあるのでしょうか。
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
### エラー
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
```
|
28
|
+
|
29
|
+
ファイルの読み込みに失敗
|
30
|
+
|
31
|
+
```
|
20
32
|
|
21
33
|
|
22
34
|
|
1
変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,4 +28,102 @@
|
|
28
28
|
|
29
29
|
|
30
30
|
|
31
|
-
|
31
|
+
```
|
32
|
+
|
33
|
+
void* User_Func(HPS3D_HandleTypeDef *handle,AsyncIObserver_t *event)
|
34
|
+
|
35
|
+
{
|
36
|
+
|
37
|
+
FILE *fp;
|
38
|
+
|
39
|
+
fp=fopen("mesure.csv", "w");
|
40
|
+
|
41
|
+
if( fp != 0){
|
42
|
+
|
43
|
+
printf("ファイルの読み込みに失敗\n");
|
44
|
+
|
45
|
+
return 0;
|
46
|
+
|
47
|
+
}
|
48
|
+
|
49
|
+
fprintf(fp, "Hello!");
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
int indx = 0;
|
54
|
+
|
55
|
+
if(event->AsyncEvent == ISubject_Event_DataRecvd)
|
56
|
+
|
57
|
+
{
|
58
|
+
|
59
|
+
switch(event->RetPacketType)
|
60
|
+
|
61
|
+
{
|
62
|
+
|
63
|
+
case SIMPLE_ROI_PACKET:
|
64
|
+
|
65
|
+
printf("distance average:%d\n",event->MeasureData.simple_roi_data[0].distance_average);
|
66
|
+
|
67
|
+
break;
|
68
|
+
|
69
|
+
case FULL_ROI_PACKET:
|
70
|
+
|
71
|
+
printf("distance average:%d\n",event->MeasureData.full_roi_data[0].distance_average);
|
72
|
+
|
73
|
+
break;
|
74
|
+
|
75
|
+
case FULL_DEPTH_PACKET:
|
76
|
+
|
77
|
+
printf("distance average:%d\n",event->MeasureData.full_depth_data->distance_average);
|
78
|
+
|
79
|
+
//printf("x:%d, y:%d, z:%d\n", event->MeasureData.point_cloud_data->point_data->x, event->MeasureData.point_cloud_data->point_data->y, event->MeasureData.point_cloud_data->point_data->z);
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
for(int i=0; i<event->MeasureData.point_cloud_data->points; i++){
|
84
|
+
|
85
|
+
printf("x:%f, y:%f, z:%f\n", (event->MeasureData.point_cloud_data->point_data+i)->x, (event->MeasureData.point_cloud_data->point_data+i)->y, (event->MeasureData.point_cloud_data->point_data+i)->z);
|
86
|
+
|
87
|
+
fprintf(fp, "%f,%f,%f\n", (event->MeasureData.point_cloud_data->point_data+i)->x, (event->MeasureData.point_cloud_data->point_data+i)->y, (event->MeasureData.point_cloud_data->point_data+i)->z);
|
88
|
+
|
89
|
+
}
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
break;
|
94
|
+
|
95
|
+
case SIMPLE_DEPTH_PACKET:
|
96
|
+
|
97
|
+
printf("distance average:%d\n",event->MeasureData.simple_depth_data->distance_average);
|
98
|
+
|
99
|
+
break;
|
100
|
+
|
101
|
+
case OBSTACLE_PACKET:
|
102
|
+
|
103
|
+
break;
|
104
|
+
|
105
|
+
case NULL_PACKET:
|
106
|
+
|
107
|
+
break;
|
108
|
+
|
109
|
+
default:
|
110
|
+
|
111
|
+
printf("system error\n");
|
112
|
+
|
113
|
+
break;
|
114
|
+
|
115
|
+
}
|
116
|
+
|
117
|
+
}
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
fclose(fp);
|
122
|
+
|
123
|
+
// 1回計測して終了
|
124
|
+
|
125
|
+
exit(0);
|
126
|
+
|
127
|
+
}
|
128
|
+
|
129
|
+
```
|