-
Notifications
You must be signed in to change notification settings - Fork 35
/
share.py
121 lines (101 loc) · 3.28 KB
/
share.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
from multiprocessing.managers import BaseManager, NamespaceProxy
from copy import deepcopy
import torch.multiprocessing as mp
from time import sleep
import sys
class ShareDataProxy(NamespaceProxy):
_exposed_ = ('__getattribute__', '__setattr__')
class ShareData:
global lock
lock = mp.RLock()
def __init__(self):
self.__stop_mapping = False
self.__stop_tracking = False
self.__decoder = None
self.__voxels = None
self.__octree = None
self.__states = None
self.__tracking_trajectory = []
@property
def decoder(self):
with lock:
return deepcopy(self.__decoder)
print("========== decoder get ==========")
sys.stdout.flush()
@decoder.setter
def decoder(self, decoder):
with lock:
self.__decoder = deepcopy(decoder)
# print("========== decoder set ==========")
sys.stdout.flush()
@property
def voxels(self):
with lock:
return deepcopy(self.__voxels)
print("========== voxels get ==========")
sys.stdout.flush()
@voxels.setter
def voxels(self, voxels):
with lock:
self.__voxels = deepcopy(voxels)
print("========== voxels set ==========")
sys.stdout.flush()
@property
def octree(self):
with lock:
return deepcopy(self.__octree)
print("========== octree get ==========")
sys.stdout.flush()
@octree.setter
def octree(self, octree):
with lock:
self.__octree = deepcopy(octree)
print("========== octree set ==========")
sys.stdout.flush()
@property
def states(self):
with lock:
return self.__states
print("========== states get ==========")
sys.stdout.flush()
@states.setter
def states(self, states):
with lock:
self.__states = states
# print("========== states set ==========")
sys.stdout.flush()
@property
def stop_mapping(self):
with lock:
return self.__stop_mapping
print("========== stop_mapping get ==========")
sys.stdout.flush()
@stop_mapping.setter
def stop_mapping(self, stop_mapping):
with lock:
self.__stop_mapping = stop_mapping
print("========== stop_mapping set ==========")
sys.stdout.flush()
@property
def stop_tracking(self):
with lock:
return self.__stop_tracking
print("========== stop_tracking get ==========")
sys.stdout.flush()
@stop_tracking.setter
def stop_tracking(self, stop_tracking):
with lock:
self.__stop_tracking = stop_tracking
print("========== stop_tracking set ==========")
sys.stdout.flush()
@property
def tracking_trajectory(self):
with lock:
return deepcopy(self.__tracking_trajectory)
print("========== tracking_trajectory get ==========")
sys.stdout.flush()
def push_pose(self, pose):
with lock:
self.__tracking_trajectory.append(deepcopy(pose))
# print("========== push_pose ==========")
sys.stdout.flush()