Skip to content

Commit

Permalink
Updated dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
hbcarlos committed Jun 15, 2020
1 parent bd2b514 commit 2007609
Show file tree
Hide file tree
Showing 28 changed files with 76 additions and 83 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ node_modules
examples/**/*.js
build/
dist/
package-lock.json
15 changes: 6 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "amphion",
"version": "0.1.20",
"name": "@robostack/amphion",
"version": "0.1.21",
"description": "roslibjs based web visualization library",
"main": "./build/amphion.js",
"repository": {
Expand All @@ -21,22 +21,21 @@
},
"dependencies": {
"@juggle/resize-observer": "^2.2.1",
"@robostack/roslib": "^1.0.1",
"lodash.debounce": "^4.0.8",
"pcl-decoder": "^0.1.7",
"randomcolor": "^0.5.4",
"rosbag": "^2.2.1",
"roslib": "^1.0.1",
"stats-js": "^1.0.1",
"three": "^0.117.0",
"three-freeform-controls": "0.0.18",
"three-spritetext": "^1.1.1",
"urdf-js": "^0.0.14",
"xstream": "^11.11.0"
},
"peerDependencies": {
"three": "^0.109.0"
},
"scripts": {
"build": "rollup -c rollup.config.prod.js",
"clean": "rm -rf node_modules build package-lock.json",
"postbuild": "rollup -c rollup.wasmless.config.prod.js",
"examples": "webpack-dev-server --config webpack.config.js",
"lint": "tslint --fix --config tslint.json --project tsconfig.json -t codeFrame 'src/**/*'",
Expand All @@ -49,21 +48,19 @@
"@babel/preset-env": "^7.5.4",
"@types/lodash.debounce": "^4.0.6",
"@types/randomcolor": "^0.5.3",
"@types/roslib": "^1.0.0",
"babel-loader": "^8.0.6",
"html-webpack-plugin": "^3.2.0",
"husky": "^3.0.2",
"lint-staged": "^9.2.5",
"prettier": "^1.18.2",
"prettier-sort-destructure": "0.0.4",
"rollup": "^1.16.7",
"rollup": "^2.0.0",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-babel-minify": "^9.1.1",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-ignore-import": "^1.3.2",
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-typescript2": "^0.25.2",
"three": "^0.109.0",
"tslib": "^1.10.0",
"tslint": "^5.20.1",
"tslint-config-prettier": "^1.18.0",
Expand Down
2 changes: 1 addition & 1 deletion rollup.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default {
input: 'src/index.ts',
plugins: [
replace({
'process.env.NODE_ENV': JSON.stringify('production'),
'process.env.NODE_ENV': JSON.stringify('production')
}),
typescript({ useTsconfigDeclarationDir: true }),
commonjs({ extensions: ['.js', '.ts'] }),
Expand Down
2 changes: 1 addition & 1 deletion src/core/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RosTopicDataSource } from '../data/rosTopic';
import { Ros } from 'roslib';
import { Ros } from '@robostack/roslib';
import { Object3D } from 'three';
import { assertIsDefined } from '../utils/helpers';
import { DataSource } from '../data';
Expand Down
2 changes: 1 addition & 1 deletion src/core/urdf.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DefaultLoadingManager, LoadingManager, Object3D } from 'three';
import { assertIsDefined } from '../utils/helpers';
import ROSLIB, { Ros } from 'roslib';
import ROSLIB, { Ros } from '@robostack/roslib';
import { DEFAULT_OPTIONS_ROBOTMODEL } from '../utils/constants';
// @ts-ignore
import URDFLoader from 'urdf-js/umd/URDFLoader';
Expand Down
2 changes: 1 addition & 1 deletion src/data/rosBag.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DataSource } from './index';
import { Message } from 'roslib';
import { Message } from '@robostack/roslib';
import xs, { Listener, Producer, Stream } from 'xstream';
import RosbagBucket, { BagReadResult } from '../core/rosbagBucket';

Expand Down
16 changes: 8 additions & 8 deletions src/data/rosTopic.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { DataSource } from './index';
import { Message, Ros, Topic } from 'roslib';
import ROSLIB from '@robostack/roslib';
import xs, { Listener, Producer, Stream } from 'xstream';

interface RosTopicDataSourceOptions {
ros: Ros;
ros: ROSLIB.Ros;
topicName: string;
messageType: string;
memory?: boolean;
Expand All @@ -16,16 +16,16 @@ interface RosTopicDataSourceOptions {
queueLength?: number;
}

export class RosTopicDataSource<T extends Message> implements DataSource<T> {
export class RosTopicDataSource<T extends ROSLIB.Message> implements DataSource<T> {
public readonly createdAt: Date = new Date();
public readonly hasMemory: boolean;
private readonly ros: Ros;
private readonly topic: Topic;
private readonly ros: ROSLIB.Ros;
private readonly topic: ROSLIB.Topic;
private readonly producer: Producer<T>;
private stream: Stream<T>;
private isStreamLive: boolean = false;
private isStreamPaused: boolean = false;
private internalListener: ((message: Message) => void) | null = null;
private internalListener: ((message: ROSLIB.Message) => void) | null = null;
private readonly listeners = new Set<Listener<T>>();
private readonly rosConnectionHook: (() => void) | null = null;
private rosCloseHook: (() => void) | null = null;
Expand All @@ -49,13 +49,13 @@ export class RosTopicDataSource<T extends Message> implements DataSource<T> {
if (options.queueLength) {
topicOptions.queue_length = options.queueLength;
}
this.topic = new Topic(topicOptions);
this.topic = new ROSLIB.Topic(topicOptions);
this.producer = {
start: listener => {
if (!this.rosCloseHook && !this.rosErrorHook) {
this.addRosHealthHooks();
}
this.internalListener = (message: Message) => {
this.internalListener = (message: ROSLIB.Message) => {
if (this.isStreamPaused) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/primitives/ArrowWithCircle.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Math as THREEMath, MeshStandardMaterial, TorusGeometry } from 'three';
import { MathUtils as THREEMath, MeshStandardMaterial, TorusGeometry } from 'three';
import Arrow from './Arrow';
import Cone from './Cone';
import {
Expand Down
20 changes: 10 additions & 10 deletions src/primitives/DepthCloudObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,16 +296,16 @@ class DepthCloudObject extends Object3D {

this.material = new ShaderMaterial({
uniforms: {
map: { type: 't', value: this.texture },
width: { type: 'f', value: halfWidth },
height: { type: 'f', value: halfHeight },
focallength: { type: 'f', value: f },
pointSize: { type: 'f', value: pointSize },
zOffset: { type: 'f', value: 0 },
whiteness: { type: 'f', value: whiteness },
varianceThreshold: { type: 'f', value: varianceThreshold },
maxDepthPerTile: { type: 'f', value: maxDepthPerTile },
resolutionFactor: { type: 'f', value: resolutionFactor },
map: { value: this.texture },
width: { value: halfWidth },
height: { value: halfHeight },
focallength: { value: f },
pointSize: { value: pointSize },
zOffset: { value: 0 },
whiteness: { value: whiteness },
varianceThreshold: { value: varianceThreshold },
maxDepthPerTile: { value: maxDepthPerTile },
resolutionFactor: { value: resolutionFactor },
},
vertexShader,
fragmentShader,
Expand Down
3 changes: 1 addition & 2 deletions src/primitives/LineSegment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ class LineSegments extends ThreeLineSegments {
constructor(color = DEFAULT_COLOR_LINE, linewidth = 5) {
super();
this.geometry = new Geometry();
this.material = new LineBasicMaterial({ linewidth });
this.material.vertexColors = VertexColors;
this.material = new LineBasicMaterial({ linewidth, color: VertexColors });
}

setColor(color: string | number | RosMessage.Color) {
Expand Down
6 changes: 3 additions & 3 deletions src/primitives/Mesh.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Math, Mesh as THREEMesh } from 'three';
import { MathUtils, Mesh as THREEMesh } from 'three';

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

Expand All @@ -25,10 +25,10 @@ class Mesh extends THREEMesh {
setAlpha(alpha: number) {
if (Array.isArray(this.material)) {
this.material.forEach(material => {
material.opacity = Math.clamp(alpha, 0, 1);
material.opacity = MathUtils.clamp(alpha, 0, 1);
});
} else {
this.material.opacity = Math.clamp(alpha, 0, 1);
this.material.opacity = MathUtils.clamp(alpha, 0, 1);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/primitives/Points.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Points extends ThreePoints {
super();
this.geometry = new Geometry();
this.material = new PointsMaterial({
vertexColors: VertexColors,
color: VertexColors,
});
}

Expand Down
4 changes: 2 additions & 2 deletions src/primitives/TriangleList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class TriangleList extends Mesh {
super();
this.geometry = new Geometry();
this.material = new MeshBasicMaterial({
vertexColors: FaceColors,
color: FaceColors,
});
this.material.side = DoubleSide;
}
Expand All @@ -29,7 +29,7 @@ class TriangleList extends Mesh {
options: { scale: RosMessage.Point },
) {
const vertices: Vector3[] = [];
const faces = [];
const faces: Face3[] = [];
const {
scale: { x, y, z },
} = options;
Expand Down
10 changes: 6 additions & 4 deletions src/utils/points.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
Points as ThreePoints,
PointsMaterial,
TextureLoader,
VertexColors,
DynamicDrawUsage
} from 'three';
import { LASERSCAN_STYLES } from './constants';
import { assertIsDefined } from './helpers';
Expand Down Expand Up @@ -54,15 +54,17 @@ class Points {
}

this.geometry = new BufferGeometry();
this.geometry.addAttribute('position', this.positions.setDynamic(true));
this.geometry.addAttribute('color', this.colors.setDynamic(true));
this.positions.usage = DynamicDrawUsage;
this.geometry.addAttribute('position', this.positions);
this.colors.usage = DynamicDrawUsage;
this.geometry.addAttribute('color', this.colors);

this.material = new PointsMaterial({
color: 0x888888,
size,
...options,
});
this.material.vertexColors = VertexColors;

this.material.transparent = true;
this.material.opacity = alpha;

Expand Down
2 changes: 1 addition & 1 deletion src/viewers/Tf.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Group, Object3D, Quaternion, Vector3 } from 'three';
import ROSLIB, { Ros } from 'roslib';
import ROSLIB, { Ros } from '@robostack/roslib';

import Viewer3d from './3d';
import { DEFAULT_OPTIONS_TF_VIEWER } from '../utils/constants';
Expand Down
2 changes: 1 addition & 1 deletion src/viz/CollisionObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from '../utils/constants';
import Group from '../primitives/Group';
import Box from '../primitives/Box';
import { Ros } from 'roslib';
import { Ros } from '@robostack/roslib';
import { Object3D } from 'three';

class CollisionObject extends LegacyCore {
Expand Down
2 changes: 1 addition & 1 deletion src/viz/DisplayTrajectory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
MESSAGE_TYPE_DISPLAYTRAJECTORY,
} from '../utils/constants';
import Group from '../primitives/Group';
import { Ros } from 'roslib';
import { Ros } from '@robostack/roslib';
import { URDFJoint, URDFRobot } from 'urdf-js/src/URDFClasses';

class DisplayTrajectory extends LegacyCore {
Expand Down
2 changes: 1 addition & 1 deletion src/viz/InteractiveMarkers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import debounce from 'lodash.debounce';
import { ControlsManager, RAYCASTER_EVENTS } from 'three-freeform-controls';
import ROSLIB, { Ros, Topic } from 'roslib';
import ROSLIB, { Ros, Topic } from '@robostack/roslib';
import LegacyCore from '../core';
import {
DEFAULT_OPTIONS_INTERACTIVE_MARKER,
Expand Down
4 changes: 2 additions & 2 deletions src/viz/LaserScan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ class LaserScan extends LiveCore<RosMessage.LaserScan, Group> {
const { size } = this.options;
const { intensities, ranges } = message;
const n = ranges.length;
const positions = [];
const colors = [];
const positions: any[] = [];
const colors: any[] = [];

if (size < 0.001 || !size) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/viz/Map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class Map extends LiveCore<RosMessage.OccupancyGrid, Plane> {
} = message;

const imageData = new ImageData(width, height);
let bitmapCanvas = null;
let bitmapCanvas:any = null;

switch (colorScheme) {
case MAP_COLOR_SCHEMES.MAP:
Expand Down
8 changes: 4 additions & 4 deletions src/viz/Odometry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Math, Object3D, Quaternion, Vector3 } from 'three';
import { MathUtils, Object3D, Quaternion, Vector3 } from 'three';
import {
DEFAULT_OPTIONS_ODOMETRY,
ODOMETRY_OBJECT_TYPES,
Expand Down Expand Up @@ -34,7 +34,7 @@ class Odometry extends LiveCore<RosMessage.Odometry, Group> {
}

setKeepSize(size: number) {
let newKeepList = [];
let newKeepList: Object3D[] = [];

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

const slicedList = this.objectPool.slice(
const slicedList: Object3D[] = this.objectPool.slice(
this.objectPool.length - size,
this.objectPool.length,
);
Expand Down Expand Up @@ -174,7 +174,7 @@ class Odometry extends LiveCore<RosMessage.Odometry, Group> {

this.objectPool.push(newObject);
this.currentObjectIndex += 1;
this.currentObjectIndex = Math.clamp(
this.currentObjectIndex = MathUtils.clamp(
this.currentObjectIndex,
0,
this.keepSize - 1,
Expand Down
2 changes: 1 addition & 1 deletion src/viz/PlanningScene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from '../utils/constants';
import Group from '../primitives/Group';
import CollisionObject from './CollisionObject';
import { Ros } from 'roslib';
import { Ros } from '@robostack/roslib';
import { assertIsDefined } from '../utils/helpers';
import { URDFJoint } from 'urdf-js/src/URDFClasses';

Expand Down
Loading

0 comments on commit 2007609

Please sign in to comment.