提交 38e370a4 编写于 作者: V Vivian Lin 提交者: siyangy

Dreamview: display obstacle speed (#4344)

上级 aa8ebef2
......@@ -40,6 +40,7 @@ const MenuIdOptionMapping = {
perceptionVelocity: 'showObstaclesVelocity',
perceptionHeading: 'showObstaclesHeading',
perceptionId: 'showObstaclesId',
perceptionObstacleInfo: 'showObstaclesInfo',
perceptionLaneMarker: 'showPerceptionLaneMarker',
predictionMajor: 'showPredictionMajor',
predictionMinor: 'showPredictionMinor',
......
......@@ -96,12 +96,8 @@ export default class PerceptionObstacles {
arrowMesh.scale.set(1, 1, 1);
arrowMesh.visible = true;
}
if (STORE.options.showObstaclesId) {
this.updateIdAndDistance(obstacle.id,
new THREE.Vector3(position.x, position.y, obstacle.height),
adc.distanceTo(position).toFixed(1),
scene);
}
this.updateTexts(adc, obstacle, position, scene);
// get the confidence and validate its range
let confidence = obstacle.confidence;
......@@ -144,21 +140,24 @@ export default class PerceptionObstacles {
return arrowMesh;
}
updateIdAndDistance(id, position, distance, scene) {
const text = this.textRender.composeText(`${id} D:${distance}`);
if (text === null) {
return;
updateTexts(adc, obstacle, obstaclePosition, scene) {
const textPosition = {
x: obstaclePosition.x,
y: obstaclePosition.y,
z: obstacle.height || 3
};
let lineCount = 0;
if (STORE.options.showObstaclesInfo) {
const distance = adc.distanceTo(obstaclePosition).toFixed(1);
const speed = obstacle.speed.toFixed(1);
this.drawTexts(`(${distance}m, ${speed}m/s)`, textPosition, scene);
lineCount ++;
}
text.position.set(position.x, position.y + 0.5, position.z || 3);
const camera = scene.getObjectByName("camera");
if (camera !== undefined) {
text.quaternion.copy(camera.quaternion);
if (STORE.options.showObstaclesId) {
textPosition.z += (lineCount * 0.7);
this.drawTexts(obstacle.id, textPosition, scene);
}
text.children.forEach(c => c.visible = true);
text.visible = true;
text.name = "id_" + id;
this.ids.push(text);
scene.add(text);
}
updatePolygon(points, height, color, coordinates, confidence, extrusionFaceIdx, scene) {
......@@ -286,6 +285,23 @@ export default class PerceptionObstacles {
return icon;
}
drawTexts(content, position, scene) {
const text = this.textRender.composeText(content);
if (text === null) {
return;
}
text.position.set(position.x, position.y, position.z );
const camera = scene.getObjectByName("camera");
if (camera !== undefined) {
text.quaternion.copy(camera.quaternion);
}
text.children.forEach(c => c.visible = true);
text.visible = true;
this.ids.push(text);
scene.add(text);
}
updateLaneMarkers(world, coordinates, scene) {
if (!_.isEmpty(this.laneMarkers)) {
this.laneMarkers.forEach((laneMesh) => {
......
......@@ -60,7 +60,17 @@ export default class Text3D {
}
this.charMeshes[idx].push(mesh);
}
mesh.position.set((j - charIndices.length / 2) * letterOffset, 0, 0);
let additionalOffset = 0;
switch (text[j]) {
case ',':
additionalOffset = 0.35;
break;
case '/':
additionalOffset = 0.15;
break;
}
mesh.position.set((j - charIndices.length / 2) * letterOffset + additionalOffset, 0, 0);
this.charPointers[idx]++;
textMesh.add(mesh);
}
......
......@@ -27,6 +27,7 @@ export default [
perceptionVelocity: 'Velocity',
perceptionHeading: 'Heading',
perceptionId: 'Id',
perceptionObstacleInfo: 'Distance and Speed',
perceptionLaneMarker: 'Lane Marker',
},
supportInOfflineView: true,
......
......@@ -74,6 +74,7 @@ options:
showObstaclesVelocity: true
showObstaclesHeading: true
showObstaclesId: true
showObstaclesInfo: true
showPointCloud: false
showPositionGps: false
showPositionLocalization: true
......
......@@ -49,6 +49,8 @@ export default class Options {
PARAMETERS.options.defaults.showObstaclesHeading;
@observable showObstaclesId =
PARAMETERS.options.defaults.showObstaclesId;
@observable showObstaclesInfo =
PARAMETERS.options.defaults.showObstaclesInfo;
@observable showPointCloud = PARAMETERS.options.defaults.showPointCloud;
@observable showPositionGps = PARAMETERS.options.defaults.showPositionGps;
@observable showPositionLocalization = PARAMETERS.options.defaults.showPositionLocalization;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册