Skip to content

Commit 3868b93

Browse files
committed
AUTO-4382: Cleanup quickstart scripts
1 parent b8b4e6f commit 3868b93

29 files changed

+92
-140
lines changed

quickstart/03-raycast.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22
#
3-
# Copyright (c) 2019 LG Electronics, Inc.
3+
# Copyright (c) 2019-2020 LG Electronics, Inc.
44
#
55
# This software contains code licensed as described in LICENSE.
66
#

quickstart/04-ego-drive-straight.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
#!/usr/bin/env python3
22
#
3-
# Copyright (c) 2019 LG Electronics, Inc.
3+
# Copyright (c) 2019-2020 LG Electronics, Inc.
44
#
55
# This software contains code licensed as described in LICENSE.
66
#
77

88
import os
99
import lgsvl
10-
import math
1110

1211
sim = lgsvl.Simulator(os.environ.get("SIMULATOR_HOST", "127.0.0.1"), 8181)
1312
if sim.current_scene == "BorregasAve":
@@ -24,10 +23,10 @@
2423

2524
# Agents can be spawned with a velocity. Default is to spawn with 0 velocity
2625
state.velocity = 20 * forward
27-
a = sim.add_agent("Lincoln2017MKZ (Apollo 5.0)", lgsvl.AgentType.EGO, state)
26+
ego = sim.add_agent("Lincoln2017MKZ (Apollo 5.0)", lgsvl.AgentType.EGO, state)
2827

2928
# The bounding box of an agent are 2 points (min and max) such that the box formed from those 2 points completely encases the agent
30-
print("Vehicle bounding box =", a.bounding_box)
29+
print("Vehicle bounding box =", ego.bounding_box)
3130

3231
print("Current time = ", sim.current_time)
3332
print("Current frame = ", sim.current_frame)

quickstart/05-ego-drive-in-circle.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22
#
3-
# Copyright (c) 2019 LG Electronics, Inc.
3+
# Copyright (c) 2019-2020 LG Electronics, Inc.
44
#
55
# This software contains code licensed as described in LICENSE.
66
#
@@ -20,7 +20,7 @@
2020
state.transform = spawns[0]
2121
forward = lgsvl.utils.transform_to_forward(spawns[0])
2222
state.transform.position += 5 * forward# 5m forwards
23-
a = sim.add_agent("Lincoln2017MKZ (Apollo 5.0)", lgsvl.AgentType.EGO, state)
23+
ego = sim.add_agent("Lincoln2017MKZ (Apollo 5.0)", lgsvl.AgentType.EGO, state)
2424

2525
print("Current time = ", sim.current_time)
2626
print("Current frame = ", sim.current_frame)
@@ -33,6 +33,6 @@
3333
c.throttle = 0.3
3434
c.steering = -1.0
3535
# a True in apply_control means the control will be continuously applied ("sticky"). False means the control will be applied for 1 frame
36-
a.apply_control(c, True)
36+
ego.apply_control(c, True)
3737

3838
sim.run()

quickstart/06-save-camera-image.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22
#
3-
# Copyright (c) 2019 LG Electronics, Inc.
3+
# Copyright (c) 2019-2020 LG Electronics, Inc.
44
#
55
# This software contains code licensed as described in LICENSE.
66
#
@@ -18,10 +18,10 @@
1818

1919
state = lgsvl.AgentState()
2020
state.transform = spawns[0]
21-
a = sim.add_agent("Lincoln2017MKZ (Apollo 5.0)", lgsvl.AgentType.EGO, state)
21+
ego = sim.add_agent("Lincoln2017MKZ (Apollo 5.0)", lgsvl.AgentType.EGO, state)
2222

2323
# get_sensors returns a list of sensors on the EGO vehicle
24-
sensors = a.get_sensors()
24+
sensors = ego.get_sensors()
2525
for s in sensors:
2626
if s.name == "Main Camera":
2727
# Camera and LIDAR sensors can save data to the specified file path

quickstart/07-save-lidar-point-cloud.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22
#
3-
# Copyright (c) 2019 LG Electronics, Inc.
3+
# Copyright (c) 2019-2020 LG Electronics, Inc.
44
#
55
# This software contains code licensed as described in LICENSE.
66
#
@@ -18,9 +18,9 @@
1818

1919
state = lgsvl.AgentState()
2020
state.transform = spawns[0]
21-
a = sim.add_agent("Lincoln2017MKZ (Apollo 5.0)", lgsvl.AgentType.EGO, state)
21+
ego = sim.add_agent("Lincoln2017MKZ (Apollo 5.0)", lgsvl.AgentType.EGO, state)
2222

23-
sensors = a.get_sensors()
23+
sensors = ego.get_sensors()
2424
for s in sensors:
2525
if s.name == "Lidar":
2626
s.save("lidar.pcd")

quickstart/08-create-npc.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
#!/usr/bin/env python3
22
#
3-
# Copyright (c) 2019 LG Electronics, Inc.
3+
# Copyright (c) 2019-2020 LG Electronics, Inc.
44
#
55
# This software contains code licensed as described in LICENSE.
66
#
77

88
import os
99
import lgsvl
10-
import random
1110

1211
sim = lgsvl.Simulator(os.environ.get("SIMULATOR_HOST", "127.0.0.1"), 8181)
1312
if sim.current_scene == "BorregasAve":
@@ -19,7 +18,7 @@
1918

2019
state = lgsvl.AgentState()
2120
state.transform = spawns[0]
22-
a = sim.add_agent("Lincoln2017MKZ (Apollo 5.0)", lgsvl.AgentType.EGO, state)
21+
ego = sim.add_agent("Lincoln2017MKZ (Apollo 5.0)", lgsvl.AgentType.EGO, state)
2322

2423
forward = lgsvl.utils.transform_to_forward(spawns[0])
2524
right = lgsvl.utils.transform_to_right(spawns[0])

quickstart/09-reset-scene.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
#!/usr/bin/env python3
22
#
3-
# Copyright (c) 2019 LG Electronics, Inc.
3+
# Copyright (c) 2019-2020 LG Electronics, Inc.
44
#
55
# This software contains code licensed as described in LICENSE.
66
#
77

88
import os
99
import lgsvl
1010
import random
11-
import time
12-
import math
1311

1412
random.seed(0)
1513

@@ -23,7 +21,7 @@
2321

2422
state = lgsvl.AgentState()
2523
state.transform = spawns[0]
26-
a = sim.add_agent("Lincoln2017MKZ (Apollo 5.0)", lgsvl.AgentType.EGO, state)
24+
ego = sim.add_agent("Lincoln2017MKZ (Apollo 5.0)", lgsvl.AgentType.EGO, state)
2725

2826
forward = lgsvl.utils.transform_to_forward(spawns[0])
2927
right = lgsvl.utils.transform_to_right(spawns[0])

quickstart/10-npc-follow-the-lane.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22
#
3-
# Copyright (c) 2019 LG Electronics, Inc.
3+
# Copyright (c) 2019-2020 LG Electronics, Inc.
44
#
55
# This software contains code licensed as described in LICENSE.
66
#
@@ -18,7 +18,7 @@
1818

1919
state = lgsvl.AgentState()
2020
state.transform = spawns[0]
21-
a = sim.add_agent("Lincoln2017MKZ (Apollo 5.0)", lgsvl.AgentType.EGO, state)
21+
ego = sim.add_agent("Lincoln2017MKZ (Apollo 5.0)", lgsvl.AgentType.EGO, state)
2222

2323
state = lgsvl.AgentState()
2424

quickstart/11-collision-callbacks.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22
#
3-
# Copyright (c) 2019 LG Electronics, Inc.
3+
# Copyright (c) 2019-2020 LG Electronics, Inc.
44
#
55
# This software contains code licensed as described in LICENSE.
66
#
@@ -16,12 +16,7 @@
1616

1717
spawns = sim.get_spawn()
1818

19-
sx = spawns[0].position.x
20-
sz = spawns[0].position.z
21-
ry = spawns[0].rotation.y
22-
2319
# ego vehicle
24-
2520
state = lgsvl.AgentState()
2621
state.transform = spawns[0]
2722
ego = sim.add_agent("Lincoln2017MKZ (Apollo 5.0)", lgsvl.AgentType.EGO, state)
@@ -30,7 +25,6 @@
3025
right = lgsvl.utils.transform_to_right(spawns[0])
3126

3227
# school bus, 20m ahead, perpendicular to road, stopped
33-
3428
state = lgsvl.AgentState()
3529
state.transform.position = spawns[0].position + 20.0 * forward
3630
state.transform.rotation.y = spawns[0].rotation.y + 90.0

quickstart/12-create-npc-on-lane.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22
#
3-
# Copyright (c) 2019 LG Electronics, Inc.
3+
# Copyright (c) 2019-2020 LG Electronics, Inc.
44
#
55
# This software contains code licensed as described in LICENSE.
66
#
@@ -20,7 +20,7 @@
2020

2121
state = lgsvl.AgentState()
2222
state.transform = spawns[0]
23-
a = sim.add_agent("Lincoln2017MKZ (Apollo 5.0)", lgsvl.AgentType.EGO, state)
23+
ego = sim.add_agent("Lincoln2017MKZ (Apollo 5.0)", lgsvl.AgentType.EGO, state)
2424

2525
sx = spawns[0].position.x
2626
sy = spawns[0].position.y

0 commit comments

Comments
 (0)