Skip to content

Commit 2007609

Browse files
committed
Updated dependencies
1 parent bd2b514 commit 2007609

28 files changed

+76
-83
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ node_modules
88
examples/**/*.js
99
build/
1010
dist/
11+
package-lock.json

package.json

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "amphion",
3-
"version": "0.1.20",
2+
"name": "@robostack/amphion",
3+
"version": "0.1.21",
44
"description": "roslibjs based web visualization library",
55
"main": "./build/amphion.js",
66
"repository": {
@@ -21,22 +21,21 @@
2121
},
2222
"dependencies": {
2323
"@juggle/resize-observer": "^2.2.1",
24+
"@robostack/roslib": "^1.0.1",
2425
"lodash.debounce": "^4.0.8",
2526
"pcl-decoder": "^0.1.7",
2627
"randomcolor": "^0.5.4",
2728
"rosbag": "^2.2.1",
28-
"roslib": "^1.0.1",
2929
"stats-js": "^1.0.1",
30+
"three": "^0.117.0",
3031
"three-freeform-controls": "0.0.18",
3132
"three-spritetext": "^1.1.1",
3233
"urdf-js": "^0.0.14",
3334
"xstream": "^11.11.0"
3435
},
35-
"peerDependencies": {
36-
"three": "^0.109.0"
37-
},
3836
"scripts": {
3937
"build": "rollup -c rollup.config.prod.js",
38+
"clean": "rm -rf node_modules build package-lock.json",
4039
"postbuild": "rollup -c rollup.wasmless.config.prod.js",
4140
"examples": "webpack-dev-server --config webpack.config.js",
4241
"lint": "tslint --fix --config tslint.json --project tsconfig.json -t codeFrame 'src/**/*'",
@@ -49,21 +48,19 @@
4948
"@babel/preset-env": "^7.5.4",
5049
"@types/lodash.debounce": "^4.0.6",
5150
"@types/randomcolor": "^0.5.3",
52-
"@types/roslib": "^1.0.0",
5351
"babel-loader": "^8.0.6",
5452
"html-webpack-plugin": "^3.2.0",
5553
"husky": "^3.0.2",
5654
"lint-staged": "^9.2.5",
5755
"prettier": "^1.18.2",
5856
"prettier-sort-destructure": "0.0.4",
59-
"rollup": "^1.16.7",
57+
"rollup": "^2.0.0",
6058
"rollup-plugin-babel": "^4.3.3",
6159
"rollup-plugin-babel-minify": "^9.1.1",
6260
"rollup-plugin-commonjs": "^10.1.0",
6361
"rollup-plugin-ignore-import": "^1.3.2",
6462
"rollup-plugin-replace": "^2.2.0",
6563
"rollup-plugin-typescript2": "^0.25.2",
66-
"three": "^0.109.0",
6764
"tslib": "^1.10.0",
6865
"tslint": "^5.20.1",
6966
"tslint-config-prettier": "^1.18.0",

rollup.config.prod.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default {
99
input: 'src/index.ts',
1010
plugins: [
1111
replace({
12-
'process.env.NODE_ENV': JSON.stringify('production'),
12+
'process.env.NODE_ENV': JSON.stringify('production')
1313
}),
1414
typescript({ useTsconfigDeclarationDir: true }),
1515
commonjs({ extensions: ['.js', '.ts'] }),

src/core/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { RosTopicDataSource } from '../data/rosTopic';
2-
import { Ros } from 'roslib';
2+
import { Ros } from '@robostack/roslib';
33
import { Object3D } from 'three';
44
import { assertIsDefined } from '../utils/helpers';
55
import { DataSource } from '../data';

src/core/urdf.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { DefaultLoadingManager, LoadingManager, Object3D } from 'three';
22
import { assertIsDefined } from '../utils/helpers';
3-
import ROSLIB, { Ros } from 'roslib';
3+
import ROSLIB, { Ros } from '@robostack/roslib';
44
import { DEFAULT_OPTIONS_ROBOTMODEL } from '../utils/constants';
55
// @ts-ignore
66
import URDFLoader from 'urdf-js/umd/URDFLoader';

src/data/rosBag.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { DataSource } from './index';
2-
import { Message } from 'roslib';
2+
import { Message } from '@robostack/roslib';
33
import xs, { Listener, Producer, Stream } from 'xstream';
44
import RosbagBucket, { BagReadResult } from '../core/rosbagBucket';
55

src/data/rosTopic.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { DataSource } from './index';
2-
import { Message, Ros, Topic } from 'roslib';
2+
import ROSLIB from '@robostack/roslib';
33
import xs, { Listener, Producer, Stream } from 'xstream';
44

55
interface RosTopicDataSourceOptions {
6-
ros: Ros;
6+
ros: ROSLIB.Ros;
77
topicName: string;
88
messageType: string;
99
memory?: boolean;
@@ -16,16 +16,16 @@ interface RosTopicDataSourceOptions {
1616
queueLength?: number;
1717
}
1818

19-
export class RosTopicDataSource<T extends Message> implements DataSource<T> {
19+
export class RosTopicDataSource<T extends ROSLIB.Message> implements DataSource<T> {
2020
public readonly createdAt: Date = new Date();
2121
public readonly hasMemory: boolean;
22-
private readonly ros: Ros;
23-
private readonly topic: Topic;
22+
private readonly ros: ROSLIB.Ros;
23+
private readonly topic: ROSLIB.Topic;
2424
private readonly producer: Producer<T>;
2525
private stream: Stream<T>;
2626
private isStreamLive: boolean = false;
2727
private isStreamPaused: boolean = false;
28-
private internalListener: ((message: Message) => void) | null = null;
28+
private internalListener: ((message: ROSLIB.Message) => void) | null = null;
2929
private readonly listeners = new Set<Listener<T>>();
3030
private readonly rosConnectionHook: (() => void) | null = null;
3131
private rosCloseHook: (() => void) | null = null;
@@ -49,13 +49,13 @@ export class RosTopicDataSource<T extends Message> implements DataSource<T> {
4949
if (options.queueLength) {
5050
topicOptions.queue_length = options.queueLength;
5151
}
52-
this.topic = new Topic(topicOptions);
52+
this.topic = new ROSLIB.Topic(topicOptions);
5353
this.producer = {
5454
start: listener => {
5555
if (!this.rosCloseHook && !this.rosErrorHook) {
5656
this.addRosHealthHooks();
5757
}
58-
this.internalListener = (message: Message) => {
58+
this.internalListener = (message: ROSLIB.Message) => {
5959
if (this.isStreamPaused) {
6060
return;
6161
}

src/primitives/ArrowWithCircle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Math as THREEMath, MeshStandardMaterial, TorusGeometry } from 'three';
1+
import { MathUtils as THREEMath, MeshStandardMaterial, TorusGeometry } from 'three';
22
import Arrow from './Arrow';
33
import Cone from './Cone';
44
import {

src/primitives/DepthCloudObject.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -296,16 +296,16 @@ class DepthCloudObject extends Object3D {
296296

297297
this.material = new ShaderMaterial({
298298
uniforms: {
299-
map: { type: 't', value: this.texture },
300-
width: { type: 'f', value: halfWidth },
301-
height: { type: 'f', value: halfHeight },
302-
focallength: { type: 'f', value: f },
303-
pointSize: { type: 'f', value: pointSize },
304-
zOffset: { type: 'f', value: 0 },
305-
whiteness: { type: 'f', value: whiteness },
306-
varianceThreshold: { type: 'f', value: varianceThreshold },
307-
maxDepthPerTile: { type: 'f', value: maxDepthPerTile },
308-
resolutionFactor: { type: 'f', value: resolutionFactor },
299+
map: { value: this.texture },
300+
width: { value: halfWidth },
301+
height: { value: halfHeight },
302+
focallength: { value: f },
303+
pointSize: { value: pointSize },
304+
zOffset: { value: 0 },
305+
whiteness: { value: whiteness },
306+
varianceThreshold: { value: varianceThreshold },
307+
maxDepthPerTile: { value: maxDepthPerTile },
308+
resolutionFactor: { value: resolutionFactor },
309309
},
310310
vertexShader,
311311
fragmentShader,

src/primitives/LineSegment.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ class LineSegments extends ThreeLineSegments {
1616
constructor(color = DEFAULT_COLOR_LINE, linewidth = 5) {
1717
super();
1818
this.geometry = new Geometry();
19-
this.material = new LineBasicMaterial({ linewidth });
20-
this.material.vertexColors = VertexColors;
19+
this.material = new LineBasicMaterial({ linewidth, color: VertexColors });
2120
}
2221

2322
setColor(color: string | number | RosMessage.Color) {

src/primitives/Mesh.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Math, Mesh as THREEMesh } from 'three';
1+
import { MathUtils, Mesh as THREEMesh } from 'three';
22

33
import * as TransformUtils from '../utils/transform';
44

@@ -25,10 +25,10 @@ class Mesh extends THREEMesh {
2525
setAlpha(alpha: number) {
2626
if (Array.isArray(this.material)) {
2727
this.material.forEach(material => {
28-
material.opacity = Math.clamp(alpha, 0, 1);
28+
material.opacity = MathUtils.clamp(alpha, 0, 1);
2929
});
3030
} else {
31-
this.material.opacity = Math.clamp(alpha, 0, 1);
31+
this.material.opacity = MathUtils.clamp(alpha, 0, 1);
3232
}
3333
}
3434
}

src/primitives/Points.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Points extends ThreePoints {
1717
super();
1818
this.geometry = new Geometry();
1919
this.material = new PointsMaterial({
20-
vertexColors: VertexColors,
20+
color: VertexColors,
2121
});
2222
}
2323

src/primitives/TriangleList.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class TriangleList extends Mesh {
1818
super();
1919
this.geometry = new Geometry();
2020
this.material = new MeshBasicMaterial({
21-
vertexColors: FaceColors,
21+
color: FaceColors,
2222
});
2323
this.material.side = DoubleSide;
2424
}
@@ -29,7 +29,7 @@ class TriangleList extends Mesh {
2929
options: { scale: RosMessage.Point },
3030
) {
3131
const vertices: Vector3[] = [];
32-
const faces = [];
32+
const faces: Face3[] = [];
3333
const {
3434
scale: { x, y, z },
3535
} = options;

src/utils/points.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
Points as ThreePoints,
66
PointsMaterial,
77
TextureLoader,
8-
VertexColors,
8+
DynamicDrawUsage
99
} from 'three';
1010
import { LASERSCAN_STYLES } from './constants';
1111
import { assertIsDefined } from './helpers';
@@ -54,15 +54,17 @@ class Points {
5454
}
5555

5656
this.geometry = new BufferGeometry();
57-
this.geometry.addAttribute('position', this.positions.setDynamic(true));
58-
this.geometry.addAttribute('color', this.colors.setDynamic(true));
57+
this.positions.usage = DynamicDrawUsage;
58+
this.geometry.addAttribute('position', this.positions);
59+
this.colors.usage = DynamicDrawUsage;
60+
this.geometry.addAttribute('color', this.colors);
5961

6062
this.material = new PointsMaterial({
6163
color: 0x888888,
6264
size,
6365
...options,
6466
});
65-
this.material.vertexColors = VertexColors;
67+
6668
this.material.transparent = true;
6769
this.material.opacity = alpha;
6870

src/viewers/Tf.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Group, Object3D, Quaternion, Vector3 } from 'three';
2-
import ROSLIB, { Ros } from 'roslib';
2+
import ROSLIB, { Ros } from '@robostack/roslib';
33

44
import Viewer3d from './3d';
55
import { DEFAULT_OPTIONS_TF_VIEWER } from '../utils/constants';

src/viz/CollisionObject.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
} from '../utils/constants';
88
import Group from '../primitives/Group';
99
import Box from '../primitives/Box';
10-
import { Ros } from 'roslib';
10+
import { Ros } from '@robostack/roslib';
1111
import { Object3D } from 'three';
1212

1313
class CollisionObject extends LegacyCore {

src/viz/DisplayTrajectory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
MESSAGE_TYPE_DISPLAYTRAJECTORY,
77
} from '../utils/constants';
88
import Group from '../primitives/Group';
9-
import { Ros } from 'roslib';
9+
import { Ros } from '@robostack/roslib';
1010
import { URDFJoint, URDFRobot } from 'urdf-js/src/URDFClasses';
1111

1212
class DisplayTrajectory extends LegacyCore {

src/viz/InteractiveMarkers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import debounce from 'lodash.debounce';
22
import { ControlsManager, RAYCASTER_EVENTS } from 'three-freeform-controls';
3-
import ROSLIB, { Ros, Topic } from 'roslib';
3+
import ROSLIB, { Ros, Topic } from '@robostack/roslib';
44
import LegacyCore from '../core';
55
import {
66
DEFAULT_OPTIONS_INTERACTIVE_MARKER,

src/viz/LaserScan.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ class LaserScan extends LiveCore<RosMessage.LaserScan, Group> {
154154
const { size } = this.options;
155155
const { intensities, ranges } = message;
156156
const n = ranges.length;
157-
const positions = [];
158-
const colors = [];
157+
const positions: any[] = [];
158+
const colors: any[] = [];
159159

160160
if (size < 0.001 || !size) {
161161
return;

src/viz/Map.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class Map extends LiveCore<RosMessage.OccupancyGrid, Plane> {
9898
} = message;
9999

100100
const imageData = new ImageData(width, height);
101-
let bitmapCanvas = null;
101+
let bitmapCanvas:any = null;
102102

103103
switch (colorScheme) {
104104
case MAP_COLOR_SCHEMES.MAP:

src/viz/Odometry.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Math, Object3D, Quaternion, Vector3 } from 'three';
1+
import { MathUtils, Object3D, Quaternion, Vector3 } from 'three';
22
import {
33
DEFAULT_OPTIONS_ODOMETRY,
44
ODOMETRY_OBJECT_TYPES,
@@ -34,7 +34,7 @@ class Odometry extends LiveCore<RosMessage.Odometry, Group> {
3434
}
3535

3636
setKeepSize(size: number) {
37-
let newKeepList = [];
37+
let newKeepList: Object3D[] = [];
3838

3939
if (size === 0) {
4040
this.keepSize = 0;
@@ -47,7 +47,7 @@ class Odometry extends LiveCore<RosMessage.Odometry, Group> {
4747
this.object?.remove(this.objectPool[i]);
4848
}
4949

50-
const slicedList = this.objectPool.slice(
50+
const slicedList: Object3D[] = this.objectPool.slice(
5151
this.objectPool.length - size,
5252
this.objectPool.length,
5353
);
@@ -174,7 +174,7 @@ class Odometry extends LiveCore<RosMessage.Odometry, Group> {
174174

175175
this.objectPool.push(newObject);
176176
this.currentObjectIndex += 1;
177-
this.currentObjectIndex = Math.clamp(
177+
this.currentObjectIndex = MathUtils.clamp(
178178
this.currentObjectIndex,
179179
0,
180180
this.keepSize - 1,

src/viz/PlanningScene.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
} from '../utils/constants';
77
import Group from '../primitives/Group';
88
import CollisionObject from './CollisionObject';
9-
import { Ros } from 'roslib';
9+
import { Ros } from '@robostack/roslib';
1010
import { assertIsDefined } from '../utils/helpers';
1111
import { URDFJoint } from 'urdf-js/src/URDFClasses';
1212

0 commit comments

Comments
 (0)