Skip to content

Commit

Permalink
GitHub Actions: Format
Browse files Browse the repository at this point in the history
  • Loading branch information
Gamenot committed Aug 8, 2023
1 parent 60e9487 commit 73806c8
Show file tree
Hide file tree
Showing 17 changed files with 73 additions and 73 deletions.
20 changes: 10 additions & 10 deletions envision/web/src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ export default class Client {

this._lastSeek = new Promise((resolve) =>
resolve(
this._sockets[simulationId].send(JSON.stringify({ seek: seconds }))
)
this._sockets[simulationId].send(JSON.stringify({ seek: seconds })),
),
)
.then(wait(500))
.finally(() => {
Expand Down Expand Up @@ -124,7 +124,7 @@ export default class Client {
? Infinity
: value === "-Infinity"
? -Infinity
: value
: value,
);
if (
stateQueue.length > 0 &&
Expand All @@ -150,15 +150,15 @@ export default class Client {
// recent events in the simulation (when not in near-real-time
// playing mode).
stateQueue = stateQueue.filter(
(frame, ind) => ind % 2 == 0 && ind > 5
(frame, ind) => ind % 2 == 0 && ind > 5,
);
self._stateQueues[simulationId] = stateQueue;
break;
}
case frameBufferModes.PRIMACY_BIAS: {
// newer frames have a higher probability of being evicted...
let removeIndex = Math.floor(
stateQueue.length * Math.sqrt(Math.random())
stateQueue.length * Math.sqrt(Math.random()),
);
stateQueue.splice(removeIndex, 1);
break;
Expand All @@ -168,7 +168,7 @@ export default class Client {
// randomly choose a frame to remove...
// spread the degradation randomly throughout the history.
let removeIndex = Math.floor(
stateQueue.length * Math.random()
stateQueue.length * Math.random(),
);
stateQueue.splice(removeIndex, 1);
}
Expand All @@ -185,7 +185,7 @@ export default class Client {
socket.onerror = (error) => {
console.warn(
`Socket encountered error=${error.message} ` +
`trying to connect to endpoint=${url}`
`trying to connect to endpoint=${url}`,
);
reject(error);
};
Expand All @@ -194,15 +194,15 @@ export default class Client {
} catch (error) {
if (remainingRetries === 0) throw error;
console.info(
`Retrying connection, attempts remaining=${remainingRetries}`
`Retrying connection, attempts remaining=${remainingRetries}`,
);

remainingRetries -= 1;
await wait(this._delay);
return await this._obtainStream(
simulationId,
stateQueue,
remainingRetries
remainingRetries,
);
}
}
Expand Down Expand Up @@ -239,7 +239,7 @@ export default class Client {
this._sockets[simulationId] = await this._obtainStream(
simulationId,
this._stateQueues[simulationId],
this._maxRetries
this._maxRetries,
);
}

Expand Down
4 changes: 2 additions & 2 deletions envision/web/src/components/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function App({ client }) {
{
type: "canvas",
mimeType: "video/webm;codecs=h264",
}
},
);
await recorderRef.current.startRecording();
}
Expand All @@ -114,7 +114,7 @@ function App({ client }) {
let outputBlob = await transcode(blob, onMessage);
invokeSaveAsDialog(
outputBlob,
`envision-${Math.round(Date.now() / 1000)}.mp4`
`envision-${Math.round(Date.now() / 1000)}.mp4`,
);
}

Expand Down
2 changes: 1 addition & 1 deletion envision/web/src/components/bubbles.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default function Bubbles({ scene, worldState }) {
shape: points,
depth: 5,
},
scene
scene,
);
polygon.position.y = 4;
let material = new StandardMaterial(`bubble-${idx}-material`, scene);
Expand Down
6 changes: 3 additions & 3 deletions envision/web/src/components/camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function Camera({ scene, roadNetworkBbox, egoView }) {
let egoCamera = new UniversalCamera(
"ego-camera",
new Vector3(0, 5, -15), // Relative to camera root position
scene
scene,
);
egoCamera.parent = egoCamRoot;
egoCamRootRef.current = egoCamRoot;
Expand All @@ -55,7 +55,7 @@ export default function Camera({ scene, roadNetworkBbox, egoView }) {
0, // beta
200, // radius
new Vector3(0, 0, 0), // target
scene
scene,
);
thirdPersonCamera.attachControl(canvas, true);
thirdPersonCamera.panningSensibility = 50;
Expand All @@ -79,7 +79,7 @@ export default function Camera({ scene, roadNetworkBbox, egoView }) {
thirdPersonCamera.target.z = mapCenter[1];
thirdPersonCamera.radius = Math.max(
Math.abs(roadNetworkBbox[0] - roadNetworkBbox[2]),
Math.abs(roadNetworkBbox[1] - roadNetworkBbox[3])
Math.abs(roadNetworkBbox[1] - roadNetworkBbox[3]),
);
}, [JSON.stringify(roadNetworkBbox)]);

Expand Down
2 changes: 1 addition & 1 deletion envision/web/src/components/control_panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default function ControlPanel({ showControls, toggleControlModes }) {
if (checkedKeys.includes(info.node.key)) {
// remove from list
setCheckedKeys((prevKeys) =>
prevKeys.filter((key) => key != info.node.key)
prevKeys.filter((key) => key != info.node.key),
);
toggleControlModes({ [info.node.key]: false });
} else {
Expand Down
22 changes: 11 additions & 11 deletions envision/web/src/components/driven_paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ export default function DrivenPaths({
} else {
let geomPos = new Vector2(
drivenPath[i].position.x,
drivenPath[i].position.z
drivenPath[i].position.z,
);
let newGeomPos = Vector2.Center(
new Vector2(...worldState.traffic[vehicle_id].driven_path[0]),
new Vector2(...worldState.traffic[vehicle_id].driven_path[1])
new Vector2(...worldState.traffic[vehicle_id].driven_path[1]),
);
if (geomPos.equalsWithEpsilon(newGeomPos, 0.0001)) {
newDrivenPathGeometries[vehicle_id] = [];
Expand All @@ -88,19 +88,19 @@ export default function DrivenPaths({
if (egoDrivenPathModel.material == null) {
egoDrivenPathModel.material = new StandardMaterial(
"ego-driven-path-material",
scene
scene,
);
egoDrivenPathModel.material.specularColor = new Color3(0, 0, 0);
egoDrivenPathModel.material.diffuseColor = new Color4(
...SceneColors.EgoDrivenPath
...SceneColors.EgoDrivenPath,
);
egoDrivenPathModel.material.alpha = SceneColors.EgoDrivenPath[3];
}

if (socialDrivenPathModel.material == null) {
socialDrivenPathModel.material = new StandardMaterial(
"social-driven-path-material",
scene
scene,
);
socialDrivenPathModel.material.specularColor = new Color3(0, 0, 0);
let color = vehicleMeshColor(ActorTypes.SOCIAL_AGENT);
Expand All @@ -111,7 +111,7 @@ export default function DrivenPaths({
// Add in new driven path segments
let drivenPathOffsetY = 0.1;
for (const [vehicle_id, trafficActor] of Object.entries(
worldState.traffic
worldState.traffic,
)) {
if (!(vehicle_id in newDrivenPathGeometries)) {
newDrivenPathGeometries[vehicle_id] = [];
Expand All @@ -125,23 +125,23 @@ export default function DrivenPaths({
let drivenPathSegment_ = null;
if (trafficActor.actor_type == ActorTypes.SOCIAL_AGENT) {
drivenPathSegment_ = socialDrivenPathModel.createInstance(
"social-driven-path-segment"
"social-driven-path-segment",
);
} else {
drivenPathSegment_ = egoDrivenPathModel.createInstance(
"ego-driven-path-segment"
"ego-driven-path-segment",
);
}

let p0 = new Vector3(
trafficActor.driven_path[i][0],
drivenPathOffsetY,
trafficActor.driven_path[i][1]
trafficActor.driven_path[i][1],
);
let p1 = new Vector3(
trafficActor.driven_path[i + 1][0],
drivenPathOffsetY,
trafficActor.driven_path[i + 1][1]
trafficActor.driven_path[i + 1][1],
);

drivenPathSegment_.position = Vector3.Center(p0, p1);
Expand All @@ -154,7 +154,7 @@ export default function DrivenPaths({
drivenPathSegment_.rotation = Vector3.RotationFromAxis(
axis1,
axis2,
axis3
axis3,
);

newDrivenPathGeometries[vehicle_id].push(drivenPathSegment_);
Expand Down
4 changes: 2 additions & 2 deletions envision/web/src/components/mission_routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ export default function MissionRoutes({ scene, worldState }) {
let polygon = MeshBuilder.CreatePolygon(
`mission-route-shape-${vehicle_id}-${shape_id}`,
{ shape: points },
scene
scene,
);
polygon.position.y = 0.1;
polygon.material = new StandardMaterial(
`mission-route-shape-${vehicle_id}-${shape_id}-material`,
scene
scene,
);
polygon.material.diffuseColor = new Color4(...SceneColors.MissionRoute);
polygon.material.alpha = SceneColors.MissionRoute[3];
Expand Down
24 changes: 12 additions & 12 deletions envision/web/src/components/simulation.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,28 +129,28 @@ export default function Simulation({
let cylinder_ = MeshBuilder.CreateCylinder(
"waypoint",
{ diameterTop: 0.5, diameterBottom: 0.5, height: 0.01 },
scene_
scene_,
);
cylinder_.isVisible = false;

setEgoWaypointModel(cylinder_.clone("ego-waypoint").makeGeometryUnique());
setSocialWaypointModel(
cylinder_.clone("social-waypoint").makeGeometryUnique()
cylinder_.clone("social-waypoint").makeGeometryUnique(),
);

// Driven path cuboid
let cuboid_ = MeshBuilder.CreateBox(
"drivenPath",
{ height: 0.3, width: 1, depth: 0.01 },
scene_
scene_,
);
cuboid_.isVisible = false;

setEgoDrivenPathModel(
cuboid_.clone("ego-driven-path").makeGeometryUnique()
cuboid_.clone("ego-driven-path").makeGeometryUnique(),
);
setSocialDrivenPathModel(
cuboid_.clone("social-driven-path").makeGeometryUnique()
cuboid_.clone("social-driven-path").makeGeometryUnique(),
);

// Light
Expand Down Expand Up @@ -226,7 +226,7 @@ export default function Simulation({
`load_gltf_extras_${worldState.scenario_id}`,
function (loader) {
return new LoadGLTFExtras(loader, worldState.scenario_id);
}
},
);

SceneLoader.ImportMesh("", mapRootUrl, mapFilename, scene, (meshes) => {
Expand All @@ -250,7 +250,7 @@ export default function Simulation({
child.actionManager = new ActionManager(scene);
child.actionManager.registerAction(
new ExecuteCodeAction(ActionManager.OnPointerOverTrigger, function (
evt
evt,
) {
material.diffuseColor = roadColorSelected;
setMapElementSelected(true);
Expand All @@ -259,23 +259,23 @@ export default function Simulation({
lane_id: child.metadata.gltf.extras.lane_id,
lane_index: child.metadata.gltf.extras.lane_index,
});
})
}),
);
child.actionManager.registerAction(
new ExecuteCodeAction(ActionManager.OnPointerOutTrigger, function (
evt
evt,
) {
material.diffuseColor = roadColor;
setMapElementSelected(false);
setDebugInfo({});
})
}),
);
}

mapMeshesRef.current = meshes;

GLTFLoader.UnregisterExtension(
`load_gltf_extras_${worldState.scenario_id}`
`load_gltf_extras_${worldState.scenario_id}`,
);
});
}, [scene, worldState.scenario_id]);
Expand Down Expand Up @@ -370,7 +370,7 @@ export default function Simulation({
attrName="Position"
data_formattter={(position) =>
`x: ${parseFloat(position[0]).toFixed(2)} y: ${parseFloat(
position[1]
position[1],
).toFixed(2)}`
}
ego_agent_ids={worldState.ego_agent_ids}
Expand Down
4 changes: 2 additions & 2 deletions envision/web/src/components/traffic_dividers.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function TrafficDividers({
let dashLine = MeshBuilder.CreateDashedLines(
`lane-divider-${idx}`,
{ points: points, updatable: false, dashSize: 1, gapSize: 2 },
scene
scene,
);
dashLine.color = new Color4(...SceneColors.LaneDivider);
return dashLine;
Expand All @@ -77,7 +77,7 @@ export default function TrafficDividers({
let newEdgeDividers = MeshBuilder.CreateLineSystem(
"edge-dividers",
{ lines: edgeDividerPoints, updatable: false },
scene
scene,
);
newEdgeDividers.color = new Color4(...SceneColors.EdgeDivider);

Expand Down
6 changes: 3 additions & 3 deletions envision/web/src/components/traffic_signals.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default function TrafficSignals({ scene, worldState }) {
let mesh = MeshBuilder.CreateDisc(
`signal-${signalName}`,
{ radius: 0.8 },
scene
scene,
);
mesh.position = point;
let axis = new Vector3(1, 0, 0);
Expand All @@ -66,14 +66,14 @@ export default function TrafficSignals({ scene, worldState }) {
let color = signalColorMap[state];
let material = new StandardMaterial(
`signal-${signalName}-material`,
scene
scene,
);
material.diffuseColor = new Color4(...color);
material.specularColor = new Color3(0, 0, 0);
mesh.material = material;
mesh.isVisible = true;
return mesh;
}
},
);

signalGeometryRef.current = newSignalGeometry;
Expand Down
Loading

0 comments on commit 73806c8

Please sign in to comment.