提交 67e20b55 编写于 作者: V Vivian Lin 提交者: GitHub

Dreamview: removing hardcoded vehicle values and utm zone id (#3368)

* Dreamview: fix typos

* Dreamview: remove hardcoded vehicle values

* Dreamview: remove hardcoded utm zone id
上级 8bc3aedf
......@@ -213,7 +213,6 @@ SimulationWorldService::SimulationWorldService(const MapService *map_service,
auto_driving_car->set_height(vehicle_param.height());
auto_driving_car->set_width(vehicle_param.width());
auto_driving_car->set_length(vehicle_param.length());
auto_driving_car->set_steering_ratio(vehicle_param.steer_ratio());
}
void SimulationWorldService::Update() {
......
......@@ -43,7 +43,6 @@ class MapNavigator {
reset() {
this.routingPaths.forEach(path => {
console.log(path);
this.mapAdapter.removePolyline(path);
});
this.routingPaths = [];
......
......@@ -33,7 +33,7 @@ export default class Others extends React.Component {
<CheckboxItem id={"toggleSimControl"}
title={"SimControl"}
isChecked={options.simControlEnabled}
disabled={false}
disabled={options.tasksPanelLocked}
onClick={() => {
WS.toggleSimControl(!options.simControlEnabled);
this.props.store.handleOptionToggle('simControlEnabled');
......
......@@ -9,7 +9,7 @@ const CAR_PROPERTIES = {
menuOptionName: 'showPositionLocalization',
carMaterial: carMaterial,
},
'plannigAdc': {
'planningAdc': {
menuOptionName: 'showPlanningCar',
carMaterial: null,
},
......
......@@ -24,12 +24,13 @@ export default class GNSS {
}
if (!this.base) {
const config = STORE.hmi.vehicleParam;
this.base = drawSegmentsFromPoints(
[ new THREE.Vector3(3.89, -1.05, 0),
new THREE.Vector3(3.89, 1.06, 0),
new THREE.Vector3(-1.04, 1.06, 0),
new THREE.Vector3(-1.04, -1.05, 0),
new THREE.Vector3(3.89, -1.05, 0)],
[ new THREE.Vector3(config.frontEdgeToCenter, -config.leftEdgeToCenter, 0),
new THREE.Vector3(config.frontEdgeToCenter, config.rightEdgeToCenter, 0),
new THREE.Vector3(-config.backEdgeToCenter, config.rightEdgeToCenter, 0),
new THREE.Vector3(-config.backEdgeToCenter, -config.leftEdgeToCenter, 0),
new THREE.Vector3(config.frontEdgeToCenter, -config.leftEdgeToCenter, 0)],
0x006aff,
2,
5
......
......@@ -48,9 +48,9 @@ class Renderer {
this.adc = new AutoDrivingCar('adc', this.scene);
// The car that projects the starting point of the planning trajectory
this.planningAdc = OFFLINE_PLAYBACK ? null : new AutoDrivingCar('plannigAdc', this.scene);
this.planningAdc = OFFLINE_PLAYBACK ? null : new AutoDrivingCar('planningAdc', this.scene);
// The planning tranjectory.
// The planning trajectory.
this.planningTrajectory = new PlanningTrajectory();
// The perception obstacles.
......
......@@ -29,7 +29,7 @@ export default class PerceptionObstacles {
}
update(world, coordinates, scene) {
// Id meshes need to be recreated everytime.
// Id meshes need to be recreated every time.
// Each text mesh needs to be removed from the scene,
// and its char meshes need to be hidden for reuse purpose.
if (!_.isEmpty(this.ids)) {
......@@ -143,7 +143,7 @@ export default class PerceptionObstacles {
const solidFaceMesh = this.getFace(extrusionFaceIdx + i, scene, true);
const dashedFaceMesh = this.getFace(extrusionFaceIdx + i, scene, false);
// Get the adjecent point.
// Get the adjacent point.
const next = (i === points.length - 1) ? 0 : i + 1;
const v = new THREE.Vector3(points[i].x, points[i].y, points[i].z);
const vNext = new THREE.Vector3(points[next].x, points[next].y, points[next].z);
......
......@@ -72,11 +72,11 @@ export default class ControlData {
}
}
updateSteerCurve(graph, adc) {
const steeringAngle = adc.steeringAngle / adc.steeringRatio;
updateSteerCurve(graph, adc, vehicleParam) {
const steeringAngle = adc.steeringAngle / vehicleParam.steerRatio;
let R = null;
if (Math.abs(Math.tan(steeringAngle)) > 0.0001) {
R = adc.length / Math.tan(steeringAngle);
R = vehicleParam.length / Math.tan(steeringAngle);
} else {
R = 100000;
}
......@@ -177,7 +177,7 @@ export default class ControlData {
}
}
update(world) {
update(world, vehicleParam) {
const trajectory = world.planningTrajectory;
const adc = world.autoDrivingCar;
if (trajectory && adc) {
......@@ -190,7 +190,7 @@ export default class ControlData {
this.updateGraph(this.data.trajectoryGraph,
trajectory, adc, 'positionX', 'positionY');
this.updateSteerCurve(this.data.trajectoryGraph, adc);
this.updateSteerCurve(this.data.trajectoryGraph, adc, vehicleParam);
this.data.trajectoryGraph.pose[0].x = adc.positionX;
this.data.trajectoryGraph.pose[0].y = adc.positionY;
this.data.trajectoryGraph.pose[0].rotation = adc.heading;
......
......@@ -9,6 +9,16 @@ export default class HMI {
vehicles = [];
@observable currentVehicle = 'none';
vehicleParam = {
frontEdgeToCenter: 3.89,
backEdgeToCenter: 1.04,
leftEdgeToCenter: 1.055,
rightEdgeToCenter: 1.055,
height: 1.48,
width: 2.11,
length: 4.933,
steerRatio: 16,
};
maps = [];
@observable currentMap = 'none';
......@@ -18,6 +28,7 @@ export default class HMI {
@observable enableStartAuto = false;
displayName = {};
utmZoneId = 10;
@observable dockerImage = ''
......@@ -28,6 +39,9 @@ export default class HMI {
if (config.modes) {
this.modes = config.modes;
}
if (config.utmZoneId) {
this.utmZoneId = config.utmZoneId;
}
this.vehicles = Object.keys(config.availableVehicles).sort()
.map(name => {
return name;
......@@ -76,6 +90,10 @@ export default class HMI {
this.enableStartAuto = world.engageAdvice === "READY_TO_ENGAGE";
}
updateVehicleParam(vehicleParam) {
this.vehicleParam = vehicleParam;
}
@action toggleModule(id) {
this.moduleStatus.set(id, !this.moduleStatus.get(id));
const command = this.moduleStatus.get(id) ? "start" : "stop";
......
......@@ -44,6 +44,9 @@ export default class RosWebSocketEndpoint {
STORE.hmi.updateStatus(message.data);
RENDERER.updateGroundImage(STORE.hmi.currentMap);
break;
case "VehicleParam":
STORE.hmi.updateVehicleParam(message.data);
break;
case "SimControlStatus":
STORE.setOptionStatus('simControlEnabled', message.enabled);
break;
......@@ -84,7 +87,7 @@ export default class RosWebSocketEndpoint {
this.updateMapIndex(message);
if (STORE.options.showPNCMonitor) {
STORE.planningData.update(message);
STORE.controlData.update(message);
STORE.controlData.update(message, STORE.hmi.vehicleParam);
}
if (this.routingTime !== message.routingTime) {
// A new routing needs to be fetched from backend.
......
import Proj4 from "proj4";
import STORE from "store";
const WGS84_TEXT = "+proj=longlat +ellps=WGS84";
const UTM_TARGET =
"+proj=utm +zone=10 +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs ";
const UTM_TARGET_TEMPLATE = (utmZoneId) =>
`+proj=utm +zone=${utmZoneId} +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs `;
export function WGS84ToUTM(latitude, longitude) {
const UTM_TARGET = UTM_TARGET_TEMPLATE(STORE.hmi.utmZoneId);
return Proj4(WGS84_TEXT, UTM_TARGET, [longitude, latitude]);
}
export function UTMToWGS84(x, y) {
export function UTMToWGS84(x, y, utmZoneId) {
const UTM_TARGET = UTM_TARGET_TEMPLATE(STORE.hmi.utmZoneId);
return Proj4(UTM_TARGET, WGS84_TEXT, [x, y]);
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册