Skip to content

Commit

Permalink
Dreamview: update pullOver data source (ApolloAuto#10137)
Browse files Browse the repository at this point in the history
  • Loading branch information
vlin17 authored Nov 8, 2019
1 parent bdc7c38 commit 7d3decf
Show file tree
Hide file tree
Showing 10 changed files with 173 additions and 111 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -970,10 +970,9 @@ void SimulationWorldService::UpdatePlanningData(const PlanningData &data) {
}

// Update pull over status
planning_data->clear_pull_over_status();
if (data.has_pull_over_status()) {
planning_data->mutable_pull_over_status()->CopyFrom(
data.pull_over_status());
planning_data->clear_pull_over();
if (data.has_pull_over()) {
planning_data->mutable_pull_over()->CopyFrom(data.pull_over());
}

// Update planning signal
Expand Down
22 changes: 11 additions & 11 deletions modules/dreamview/frontend/dist/app.bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion modules/dreamview/frontend/dist/app.bundle.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion modules/dreamview/frontend/dist/worker.bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion modules/dreamview/frontend/dist/worker.bundle.js.map

Large diffs are not rendered by default.

171 changes: 114 additions & 57 deletions modules/dreamview/frontend/proto_bundle/sim_world_proto_bundle.json
Original file line number Diff line number Diff line change
Expand Up @@ -1242,6 +1242,10 @@
"steer": {
"type": "double",
"id": 6
},
"gaussianInfo": {
"type": "GaussianInfo",
"id": 7
}
}
},
Expand Down Expand Up @@ -1283,6 +1287,38 @@
}
}
},
"GaussianInfo": {
"fields": {
"sigmaX": {
"type": "double",
"id": 1
},
"sigmaY": {
"type": "double",
"id": 2
},
"correlation": {
"type": "double",
"id": 3
},
"areaProbability": {
"type": "double",
"id": 4
},
"ellipseA": {
"type": "double",
"id": 5
},
"ellipseB": {
"type": "double",
"id": 6
},
"thetaA": {
"type": "double",
"id": 7
}
}
},
"VehicleSignal": {
"fields": {
"turnSignal": {
Expand Down Expand Up @@ -6594,6 +6630,13 @@
"options": {
"default": 2.5
}
},
"stopDistance": {
"type": "double",
"id": 4,
"options": {
"default": 1.5
}
}
}
},
Expand Down Expand Up @@ -7103,25 +7146,6 @@
}
}
},
"EmergencyPullOverStatus": {
"fields": {
"position": {
"type": "apollo.common.PointENU",
"id": 1
},
"theta": {
"type": "double",
"id": 2
},
"isInEmergencyPullOverScenario": {
"type": "bool",
"id": 3,
"options": {
"default": false
}
}
}
},
"OpenSpaceStatus": {
"fields": {
"partitionedTrajectoriesIndexHistory": {
Expand Down Expand Up @@ -7224,46 +7248,54 @@
},
"PullOverStatus": {
"fields": {
"pullOverType": {
"type": "PullOverType",
"id": 1
},
"planPullOverPath": {
"type": "bool",
"id": 2,
"options": {
"default": false
}
},
"isFeasible": {
"type": "bool",
"id": 1,
"id": 3,
"options": {
"default": false
}
},
"position": {
"type": "apollo.common.PointENU",
"id": 2
"id": 4
},
"theta": {
"type": "double",
"id": 3
"id": 5
},
"lengthFront": {
"type": "double",
"id": 4
"id": 6
},
"lengthBack": {
"type": "double",
"id": 5
"id": 7
},
"widthLeft": {
"type": "double",
"id": 6
"id": 8
},
"widthRight": {
"type": "double",
"id": 7
},
"idx": {
"type": "int32",
"id": 8
},
"isInPullOverScenario": {
"type": "bool",
"id": 9,
"options": {
"default": false
"id": 9
}
},
"nested": {
"PullOverType": {
"values": {
"PULL_OVER": 1,
"EMERGENCY_PULL_OVER": 2
}
}
}
Expand Down Expand Up @@ -7388,65 +7420,61 @@
"type": "DestinationStatus",
"id": 4
},
"emergencyPullOver": {
"type": "EmergencyPullOverStatus",
"id": 5
},
"engageAdvice": {
"type": "apollo.common.EngageAdvice",
"id": 6
"id": 5
},
"openSpace": {
"type": "OpenSpaceStatus",
"id": 7
"id": 6
},
"pedestrian": {
"type": "PedestrianStatus",
"id": 8
"id": 7
},
"parkAndGo": {
"type": "ParkAndGoStatus",
"id": 9
"id": 8
},
"pathDecider": {
"type": "PathDeciderStatus",
"id": 10
"id": 9
},
"pathReuseDecider": {
"type": "PathReuseDeciderStatus",
"id": 11
"id": 10
},
"pullOver": {
"type": "PullOverStatus",
"id": 12
"id": 11
},
"rerouting": {
"type": "ReroutingStatus",
"id": 13
"id": 12
},
"rightOfWay": {
"type": "RightOfWayStatus",
"id": 14
"id": 13
},
"scenario": {
"type": "ScenarioStatus",
"id": 15
"id": 14
},
"sidePass": {
"type": "SidePassStatus",
"id": 16
"id": 15
},
"stopSign": {
"type": "StopSignStatus",
"id": 17
"id": 16
},
"trafficLight": {
"type": "TrafficLightStatus",
"id": 18
"id": 17
},
"yieldSign": {
"type": "YieldSignStatus",
"id": 19
"id": 18
}
}
},
Expand Down Expand Up @@ -8436,7 +8464,8 @@
"ST_BOUNDARY_TYPE_FOLLOW": 3,
"ST_BOUNDARY_TYPE_YIELD": 4,
"ST_BOUNDARY_TYPE_OVERTAKE": 5,
"ST_BOUNDARY_TYPE_KEEP_CLEAR": 6
"ST_BOUNDARY_TYPE_KEEP_CLEAR": 6,
"ST_BOUNDARY_TYPE_DRIVABLE_REGION": 7
}
}
}
Expand Down Expand Up @@ -8965,6 +8994,34 @@
}
}
},
"PullOverDebug": {
"fields": {
"position": {
"type": "apollo.common.PointENU",
"id": 1
},
"theta": {
"type": "double",
"id": 2
},
"lengthFront": {
"type": "double",
"id": 3
},
"lengthBack": {
"type": "double",
"id": 4
},
"widthLeft": {
"type": "double",
"id": 5
},
"widthRight": {
"type": "double",
"id": 6
}
}
},
"PlanningData": {
"fields": {
"adcPosition": {
Expand Down Expand Up @@ -9062,8 +9119,8 @@
"type": "apollo.planning.PullOverStatus",
"id": 29
},
"emergencyPullOverStatus": {
"type": "apollo.planning.EmergencyPullOverStatus",
"pullOver": {
"type": "PullOverDebug",
"id": 30
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ class MapNavigator {

const x = autoDrivingCar.positionX;
const y = autoDrivingCar.positionY;
const heading = autoDrivingCar.heading;

const [longitude, latitude] = this.mapAdapter.applyCoordinateOffset(UTMToWGS84(x, y));
const latLng = this.mapAdapter.createPoint({
Expand Down
59 changes: 26 additions & 33 deletions modules/dreamview/frontend/src/renderer/status.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as THREE from "three";
import STORE from "store";
import { drawSegmentsFromPoints, drawCircle, drawArrow } from "utils/draw";
import { drawSegmentsFromPoints, drawCircle, drawArrow, disposeMeshGroup } from "utils/draw";

function getPullOverStatus({ lengthFront, lengthBack, widthLeft, widthRight }) {
function drawPullOverBox({ lengthFront, lengthBack, widthLeft, widthRight }) {
const pullOverStatus = new THREE.Group();
const color = 0x006AFF;
const polygon = drawSegmentsFromPoints(
Expand Down Expand Up @@ -36,42 +36,35 @@ function getPullOverStatus({ lengthFront, lengthBack, widthLeft, widthRight }) {

export default class PlanningStatus {
constructor() {
this.pullOverStatus = null;
this.pullOverBox = null;
}

update(planningData, coordinates, scene) {
// Dispose old status
if (this.pullOverBox) {
disposeMeshGroup(this.pullOverBox);
scene.remove(this.pullOverBox);
this.pullOverBox = null;
}

if (!planningData) {
return;
}

// Draw pull over status
if (planningData) {
const { pullOverStatus } = planningData;
if (!STORE.options.customizedToggles.get('pullOverStatus')) {
if (this.pullOverStatus) {
this.pullOverStatus.traverse((child) => {
child.visible = false;
});
}
} else {
if (this.pullOverStatus) {
this.pullOverStatus.traverse((child) => {
if (child.geometry !== undefined) {
child.geometry.dispose();
child.material.dispose();
}
});
scene.remove(this.pullOverStatus);
this.pullOverStatus = null;
}
if (pullOverStatus) {
this.pullOverStatus = getPullOverStatus(pullOverStatus);
if (STORE.options.customizedToggles.get('pullOver')) {
const { pullOver } = planningData;
if (pullOver) {
this.pullOverBox = drawPullOverBox(pullOver);

const position = coordinates.applyOffset({
x: pullOverStatus.position.x,
y: pullOverStatus.position.y,
z: 0.3,
});
this.pullOverStatus.position.set(position.x, position.y, position.z);
this.pullOverStatus.rotation.set(0, 0, pullOverStatus.theta);
scene.add(this.pullOverStatus);
}
const position = coordinates.applyOffset({
x: pullOver.position.x,
y: pullOver.position.y,
z: 0.3,
});
this.pullOverBox.position.set(position.x, position.y, position.z);
this.pullOverBox.rotation.set(0, 0, pullOver.theta);
scene.add(this.pullOverBox);
}
}
}
Expand Down
Loading

0 comments on commit 7d3decf

Please sign in to comment.