pubo-web 1.0.13 → 1.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,50 +0,0 @@
1
- "use strict";
2
-
3
- var __values = this && this.__values || function (o) {
4
- var s = typeof Symbol === "function" && Symbol.iterator,
5
- m = s && o[s],
6
- i = 0;
7
- if (m) return m.call(o);
8
- if (o && typeof o.length === "number") return {
9
- next: function next() {
10
- if (o && i >= o.length) o = void 0;
11
- return {
12
- value: o && o[i++],
13
- done: !o
14
- };
15
- }
16
- };
17
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
18
- };
19
-
20
- Object.defineProperty(exports, "__esModule", {
21
- value: true
22
- });
23
- exports.superFactory = void 0;
24
-
25
- exports.superFactory = function (factory) {
26
- return function (options) {
27
- var e_1, _a;
28
-
29
- var product = {};
30
-
31
- try {
32
- for (var _b = __values(Object.keys(options)), _c = _b.next(); !_c.done; _c = _b.next()) {
33
- var key = _c.value;
34
- product[key] = factory(options[key]);
35
- }
36
- } catch (e_1_1) {
37
- e_1 = {
38
- error: e_1_1
39
- };
40
- } finally {
41
- try {
42
- if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
43
- } finally {
44
- if (e_1) throw e_1.error;
45
- }
46
- }
47
-
48
- return product;
49
- };
50
- };
@@ -1,7 +0,0 @@
1
- import { RosUtils } from './factory';
2
- import type { RosConfigure } from './factory/configure';
3
- import { RosViewer } from './ros3d/viewer';
4
- export declare const createConfigureRos: (rosConfigure: RosConfigure) => {
5
- rosUtils: RosUtils;
6
- createRosViewer(): RosViewer;
7
- };
package/lib/ros/index.js DELETED
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createConfigureRos = void 0;
7
-
8
- var factory_1 = require("./factory");
9
-
10
- var viewer_1 = require("./ros3d/viewer");
11
-
12
- exports.createConfigureRos = function (rosConfigure) {
13
- return {
14
- rosUtils: new factory_1.RosUtils(rosConfigure),
15
- createRosViewer: function createRosViewer() {
16
- return new viewer_1.RosViewer(rosConfigure);
17
- }
18
- };
19
- };
@@ -1,6 +0,0 @@
1
- export declare class InjectUtil {
2
- state: any;
3
- inject(obj: any, options: any): any;
4
- install(key: string, value: any): void;
5
- remove(key: string): void;
6
- }
@@ -1,46 +0,0 @@
1
- "use strict";
2
-
3
- var __assign = this && this.__assign || function () {
4
- __assign = Object.assign || function (t) {
5
- for (var s, i = 1, n = arguments.length; i < n; i++) {
6
- s = arguments[i];
7
-
8
- for (var p in s) {
9
- if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
10
- }
11
- }
12
-
13
- return t;
14
- };
15
-
16
- return __assign.apply(this, arguments);
17
- };
18
-
19
- Object.defineProperty(exports, "__esModule", {
20
- value: true
21
- });
22
- exports.InjectUtil = void 0;
23
-
24
- var InjectUtil =
25
- /** @class */
26
- function () {
27
- function InjectUtil() {
28
- this.state = {};
29
- }
30
-
31
- InjectUtil.prototype.inject = function (obj, options) {
32
- return new obj(__assign(__assign({}, this.state), options));
33
- };
34
-
35
- InjectUtil.prototype.install = function (key, value) {
36
- this.state[key] = value;
37
- };
38
-
39
- InjectUtil.prototype.remove = function (key) {
40
- delete this.state[key];
41
- };
42
-
43
- return InjectUtil;
44
- }();
45
-
46
- exports.InjectUtil = InjectUtil;
@@ -1,11 +0,0 @@
1
- export declare function getRainbowColor(pct: number): any;
2
- export declare function colormap(x: number): any;
3
- export declare function loadLib(url: string): Promise<any>;
4
- export declare const basePointCloudOptions: {
5
- colorsrc: string;
6
- material: {
7
- size: number;
8
- };
9
- max_pts: number;
10
- colormap: typeof colormap;
11
- };
@@ -1,272 +0,0 @@
1
- "use strict";
2
-
3
- var __assign = this && this.__assign || function () {
4
- __assign = Object.assign || function (t) {
5
- for (var s, i = 1, n = arguments.length; i < n; i++) {
6
- s = arguments[i];
7
-
8
- for (var p in s) {
9
- if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
10
- }
11
- }
12
-
13
- return t;
14
- };
15
-
16
- return __assign.apply(this, arguments);
17
- };
18
-
19
- var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
20
- function adopt(value) {
21
- return value instanceof P ? value : new P(function (resolve) {
22
- resolve(value);
23
- });
24
- }
25
-
26
- return new (P || (P = Promise))(function (resolve, reject) {
27
- function fulfilled(value) {
28
- try {
29
- step(generator.next(value));
30
- } catch (e) {
31
- reject(e);
32
- }
33
- }
34
-
35
- function rejected(value) {
36
- try {
37
- step(generator["throw"](value));
38
- } catch (e) {
39
- reject(e);
40
- }
41
- }
42
-
43
- function step(result) {
44
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
45
- }
46
-
47
- step((generator = generator.apply(thisArg, _arguments || [])).next());
48
- });
49
- };
50
-
51
- var __generator = this && this.__generator || function (thisArg, body) {
52
- var _ = {
53
- label: 0,
54
- sent: function sent() {
55
- if (t[0] & 1) throw t[1];
56
- return t[1];
57
- },
58
- trys: [],
59
- ops: []
60
- },
61
- f,
62
- y,
63
- t,
64
- g;
65
- return g = {
66
- next: verb(0),
67
- "throw": verb(1),
68
- "return": verb(2)
69
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
70
- return this;
71
- }), g;
72
-
73
- function verb(n) {
74
- return function (v) {
75
- return step([n, v]);
76
- };
77
- }
78
-
79
- function step(op) {
80
- if (f) throw new TypeError("Generator is already executing.");
81
-
82
- while (_) {
83
- try {
84
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
85
- if (y = 0, t) op = [op[0] & 2, t.value];
86
-
87
- switch (op[0]) {
88
- case 0:
89
- case 1:
90
- t = op;
91
- break;
92
-
93
- case 4:
94
- _.label++;
95
- return {
96
- value: op[1],
97
- done: false
98
- };
99
-
100
- case 5:
101
- _.label++;
102
- y = op[1];
103
- op = [0];
104
- continue;
105
-
106
- case 7:
107
- op = _.ops.pop();
108
-
109
- _.trys.pop();
110
-
111
- continue;
112
-
113
- default:
114
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
115
- _ = 0;
116
- continue;
117
- }
118
-
119
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
120
- _.label = op[1];
121
- break;
122
- }
123
-
124
- if (op[0] === 6 && _.label < t[1]) {
125
- _.label = t[1];
126
- t = op;
127
- break;
128
- }
129
-
130
- if (t && _.label < t[2]) {
131
- _.label = t[2];
132
-
133
- _.ops.push(op);
134
-
135
- break;
136
- }
137
-
138
- if (t[2]) _.ops.pop();
139
-
140
- _.trys.pop();
141
-
142
- continue;
143
- }
144
-
145
- op = body.call(thisArg, _);
146
- } catch (e) {
147
- op = [6, e];
148
- y = 0;
149
- } finally {
150
- f = t = 0;
151
- }
152
- }
153
-
154
- if (op[0] & 5) throw op[1];
155
- return {
156
- value: op[0] ? op[1] : void 0,
157
- done: true
158
- };
159
- }
160
- };
161
-
162
- var __importDefault = this && this.__importDefault || function (mod) {
163
- return mod && mod.__esModule ? mod : {
164
- "default": mod
165
- };
166
- };
167
-
168
- Object.defineProperty(exports, "__esModule", {
169
- value: true
170
- });
171
- exports.basePointCloudOptions = exports.loadLib = exports.colormap = exports.getRainbowColor = void 0;
172
-
173
- var roslib_1 = __importDefault(require("roslib"));
174
-
175
- var load_script_1 = require("../../load-script");
176
-
177
- function getRainbowColor(pct) {
178
- var h = (1 - pct) * 5.0 + 1.0;
179
- var i = Math.floor(h);
180
- var f = h % 1.0;
181
-
182
- if ((i & 1) === 0) {
183
- f = 1 - f;
184
- }
185
-
186
- var n = 1 - f;
187
- var dic = [{
188
- r: n,
189
- g: 0,
190
- b: 1
191
- }, {
192
- r: 0,
193
- g: n,
194
- b: 1
195
- }, {
196
- r: 0,
197
- g: 1,
198
- b: n
199
- }, {
200
- r: n,
201
- g: 1,
202
- b: 0
203
- }, {
204
- r: 1,
205
- g: n,
206
- b: 0
207
- }];
208
-
209
- if (i < 1) {
210
- i = 1;
211
- }
212
-
213
- var temp = dic[i - 1] || dic[4];
214
- Object.keys(temp).forEach(function (key) {
215
- return temp[key] = temp[key] * 255;
216
- });
217
- return __assign(__assign({}, temp), {
218
- a: 1
219
- });
220
- }
221
-
222
- exports.getRainbowColor = getRainbowColor;
223
-
224
- function colormap(x) {
225
- var minColorValue = 0;
226
- var maxColorValue = 512 * 512 * 512;
227
- var colorFieldRange = maxColorValue - minColorValue || Infinity;
228
- var pct = Math.max(0, Math.min((Math.pow(x, 4) - minColorValue) / colorFieldRange, 1));
229
- return getRainbowColor(pct);
230
- }
231
-
232
- exports.colormap = colormap;
233
-
234
- function loadLib(url) {
235
- return __awaiter(this, void 0, void 0, function () {
236
- return __generator(this, function (_a) {
237
- switch (_a.label) {
238
- case 0:
239
- if (!window.ROSLIB) {
240
- window.ROSLIB = roslib_1["default"];
241
- }
242
-
243
- if (window.ROS3D) {
244
- return [2
245
- /*return*/
246
- , window.ROS3D];
247
- }
248
-
249
- return [4
250
- /*yield*/
251
- , load_script_1.loadScript(url)];
252
-
253
- case 1:
254
- _a.sent();
255
-
256
- return [2
257
- /*return*/
258
- , window.ROS3D];
259
- }
260
- });
261
- });
262
- }
263
-
264
- exports.loadLib = loadLib;
265
- exports.basePointCloudOptions = {
266
- colorsrc: 'intensity',
267
- material: {
268
- size: 0.1
269
- },
270
- max_pts: 10000000,
271
- colormap: colormap
272
- };
@@ -1,19 +0,0 @@
1
- import type { RosConfigure } from '../factory/configure';
2
- import { InjectUtil } from './inject';
3
- interface InitProps {
4
- elem: any;
5
- view?: any;
6
- tf?: any;
7
- }
8
- export declare class RosViewer {
9
- private readonly configure;
10
- private elem;
11
- ROS3D: any;
12
- viewer: any;
13
- iu: InjectUtil;
14
- constructor(configure: RosConfigure);
15
- init({ elem, view, tf }: InitProps): Promise<void>;
16
- destroy(): void;
17
- initPointClouds(optList: any[]): any[];
18
- }
19
- export {};
@@ -1,259 +0,0 @@
1
- "use strict";
2
-
3
- var __assign = this && this.__assign || function () {
4
- __assign = Object.assign || function (t) {
5
- for (var s, i = 1, n = arguments.length; i < n; i++) {
6
- s = arguments[i];
7
-
8
- for (var p in s) {
9
- if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
10
- }
11
- }
12
-
13
- return t;
14
- };
15
-
16
- return __assign.apply(this, arguments);
17
- };
18
-
19
- var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
20
- function adopt(value) {
21
- return value instanceof P ? value : new P(function (resolve) {
22
- resolve(value);
23
- });
24
- }
25
-
26
- return new (P || (P = Promise))(function (resolve, reject) {
27
- function fulfilled(value) {
28
- try {
29
- step(generator.next(value));
30
- } catch (e) {
31
- reject(e);
32
- }
33
- }
34
-
35
- function rejected(value) {
36
- try {
37
- step(generator["throw"](value));
38
- } catch (e) {
39
- reject(e);
40
- }
41
- }
42
-
43
- function step(result) {
44
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
45
- }
46
-
47
- step((generator = generator.apply(thisArg, _arguments || [])).next());
48
- });
49
- };
50
-
51
- var __generator = this && this.__generator || function (thisArg, body) {
52
- var _ = {
53
- label: 0,
54
- sent: function sent() {
55
- if (t[0] & 1) throw t[1];
56
- return t[1];
57
- },
58
- trys: [],
59
- ops: []
60
- },
61
- f,
62
- y,
63
- t,
64
- g;
65
- return g = {
66
- next: verb(0),
67
- "throw": verb(1),
68
- "return": verb(2)
69
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
70
- return this;
71
- }), g;
72
-
73
- function verb(n) {
74
- return function (v) {
75
- return step([n, v]);
76
- };
77
- }
78
-
79
- function step(op) {
80
- if (f) throw new TypeError("Generator is already executing.");
81
-
82
- while (_) {
83
- try {
84
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
85
- if (y = 0, t) op = [op[0] & 2, t.value];
86
-
87
- switch (op[0]) {
88
- case 0:
89
- case 1:
90
- t = op;
91
- break;
92
-
93
- case 4:
94
- _.label++;
95
- return {
96
- value: op[1],
97
- done: false
98
- };
99
-
100
- case 5:
101
- _.label++;
102
- y = op[1];
103
- op = [0];
104
- continue;
105
-
106
- case 7:
107
- op = _.ops.pop();
108
-
109
- _.trys.pop();
110
-
111
- continue;
112
-
113
- default:
114
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
115
- _ = 0;
116
- continue;
117
- }
118
-
119
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
120
- _.label = op[1];
121
- break;
122
- }
123
-
124
- if (op[0] === 6 && _.label < t[1]) {
125
- _.label = t[1];
126
- t = op;
127
- break;
128
- }
129
-
130
- if (t && _.label < t[2]) {
131
- _.label = t[2];
132
-
133
- _.ops.push(op);
134
-
135
- break;
136
- }
137
-
138
- if (t[2]) _.ops.pop();
139
-
140
- _.trys.pop();
141
-
142
- continue;
143
- }
144
-
145
- op = body.call(thisArg, _);
146
- } catch (e) {
147
- op = [6, e];
148
- y = 0;
149
- } finally {
150
- f = t = 0;
151
- }
152
- }
153
-
154
- if (op[0] & 5) throw op[1];
155
- return {
156
- value: op[0] ? op[1] : void 0,
157
- done: true
158
- };
159
- }
160
- };
161
-
162
- var __importDefault = this && this.__importDefault || function (mod) {
163
- return mod && mod.__esModule ? mod : {
164
- "default": mod
165
- };
166
- };
167
-
168
- Object.defineProperty(exports, "__esModule", {
169
- value: true
170
- });
171
- exports.RosViewer = void 0;
172
-
173
- var roslib_1 = __importDefault(require("roslib"));
174
-
175
- var inject_1 = require("./inject");
176
-
177
- var utils_1 = require("./utils");
178
-
179
- var RosViewer =
180
- /** @class */
181
- function () {
182
- function RosViewer(configure) {
183
- this.iu = new inject_1.InjectUtil();
184
- this.configure = configure;
185
- }
186
-
187
- RosViewer.prototype.init = function (_a) {
188
- var elem = _a.elem,
189
- _b = _a.view,
190
- view = _b === void 0 ? {} : _b,
191
- _c = _a.tf,
192
- tf = _c === void 0 ? {} : _c;
193
- return __awaiter(this, void 0, void 0, function () {
194
- var _d, tfClient;
195
-
196
- return __generator(this, function (_e) {
197
- switch (_e.label) {
198
- case 0:
199
- if (!this.configure.conf.ros3d_lib_url) {
200
- throw new Error('ros3djs lib not found');
201
- }
202
-
203
- _d = this;
204
- return [4
205
- /*yield*/
206
- , utils_1.loadLib(this.configure.conf.ros3d_lib_url)];
207
-
208
- case 1:
209
- _d.ROS3D = _e.sent();
210
- this.elem = elem;
211
- this.iu.install('ros', this.configure.ros);
212
- this.viewer = new this.ROS3D.Viewer(__assign({
213
- elem: elem,
214
- width: elem.clientWidth,
215
- height: elem.clientHeight,
216
- antialias: true,
217
- cameraPose: {
218
- x: 100,
219
- y: 100,
220
- z: 100
221
- },
222
- displayPanAndZoomFrame: false,
223
- background: '#000000'
224
- }, view));
225
- this.iu.install('rootObject', this.viewer.scene);
226
- tfClient = this.iu.inject(roslib_1["default"].TFClient, __assign({
227
- angularThres: 0.01,
228
- transThres: 0.01,
229
- fixedFrame: '/base_link'
230
- }, tf));
231
- this.iu.install('tfClient', tfClient);
232
- return [2
233
- /*return*/
234
- ];
235
- }
236
- });
237
- });
238
- };
239
-
240
- RosViewer.prototype.destroy = function () {
241
- if (this.viewer && typeof this.viewer.stop === 'function') {
242
- this.viewer.stop();
243
- }
244
-
245
- this.elem.innerHTML = '';
246
- };
247
-
248
- RosViewer.prototype.initPointClouds = function (optList) {
249
- var _this = this;
250
-
251
- return optList.map(function (opt) {
252
- return _this.iu.inject(_this.ROS3D.PointCloud2, __assign(__assign({}, utils_1.basePointCloudOptions), opt));
253
- });
254
- };
255
-
256
- return RosViewer;
257
- }();
258
-
259
- exports.RosViewer = RosViewer;