Traffic Cone
Description
Traffic cones are considered an “actor” in Quanser Interactive Labs Open Worlds. Traffic cones can be spawned anywhere in the Open Worlds and they only exist as dynamic actors.
See the Traffic Cone Tutorial to get a better understanding of using traffic cones in Quanser Interactive Labs.
Library
Constants
- QLabsTrafficCone.ID_TRAFFIC_CONE = 10000
Class ID
Member Variables
- QLabsTrafficCone.actorNumber = None
The current actor number of this class to be addressed. This will be set by spawn methods and cleared by destroy methods. It will not be modified by the destroy all actors. This can be manually altered at any time to use one object to address multiple actors.
Methods
- QLabsTrafficCone.spawn(location=[0, 0, 0], rotation=[0, 0, 0], scale=[1, 1, 1], configuration=0, waitForConfirmation=True)
Spawns a new actor with the next available actor number within this class.
- Parameters
location (float array[3]) – (Optional) An array of floats for x, y and z coordinates
rotation (float array[3]) – (Optional) An array of floats for the roll, pitch, and yaw in radians
scale (float array[3]) – (Optional) An array of floats for the scale in the x, y, and z directions. Scale values of 0.0 should not be used.
configuration (uint32) – (Optional) Spawn configuration. See class library for configuration options.
waitForConfirmation (boolean) – (Optional) Make this operation blocking until confirmation of the spawn has occurred. Note that if this is False, the returned actor number will be invalid.
- Returns
status - 0 if successful, 1 class not available, 3 unknown error, -1 communications error.
actorNumber - An actor number to use for future references.
- Return type
int32, int32
- QLabsTrafficCone.spawn_degrees(location=[0, 0, 0], rotation=[0, 0, 0], scale=[1, 1, 1], configuration=0, waitForConfirmation=True)
Spawns a new actor with the next available actor number within this class.
- Parameters
location (float array[3]) – (Optional) An array of floats for x, y and z coordinates
rotation (float array[3]) – (Optional) An array of floats for the roll, pitch, and yaw in degrees
scale (float array[3]) – (Optional) An array of floats for the scale in the x, y, and z directions. Scale values of 0.0 should not be used.
configuration (uint32) – (Optional) Spawn configuration. See class library for configuration options.
waitForConfirmation (boolean) – (Optional) Make this operation blocking until confirmation of the spawn has occurred. Note that if this is False, the returned actor number will be invalid.
- Returns
status - 0 if successful, 1 class not available, 3 unknown error, -1 communications error.
actorNumber - An actor number to use for future references.
- Return type
int32, int32
- QLabsTrafficCone.spawn_id(actorNumber, location=[0, 0, 0], rotation=[0, 0, 0], scale=[1, 1, 1], configuration=0, waitForConfirmation=True)
Spawns a new actor.
- Parameters
actorNumber (uint32) – User defined unique identifier for the class actor in QLabs
location (float array[3]) – (Optional) An array of floats for x, y and z coordinates
rotation (float array[3]) – (Optional) An array of floats for the roll, pitch, and yaw in radians
scale (float array[3]) – (Optional) An array of floats for the scale in the x, y, and z directions. Scale values of 0.0 should not be used.
configuration (uint32) – (Optional) Spawn configuration. See class library for configuration options.
waitForConfirmation (boolean) – (Optional) Make this operation blocking until confirmation of the spawn has occurred.
- Returns
status - 0 if successful, 1 class not available, 2 actor number not available or already in use, 3 unknown error, -1 communications error
- Return type
int32
- QLabsTrafficCone.spawn_id_degrees(actorNumber, location=[0, 0, 0], rotation=[0, 0, 0], scale=[1, 1, 1], configuration=0, waitForConfirmation=True)
Spawns a new actor.
- Parameters
actorNumber (uint32) – User defined unique identifier for the class actor in QLabs
location (float array[3]) – (Optional) An array of floats for x, y and z coordinates
rotation (float array[3]) – (Optional) An array of floats for the roll, pitch, and yaw in radians
scale (float array[3]) – (Optional) An array of floats for the scale in the x, y, and z directions. Scale values of 0.0 should not be used.
configuration (uint32) – (Optional) Spawn configuration. See class library for configuration options.
waitForConfirmation (boolean) – (Optional) Make this operation blocking until confirmation of the spawn has occurred.
- Returns
status - 0 if successful, 1 class not available, 2 actor number not available or already in use, 3 unknown error, -1 communications error
- Return type
int32
- QLabsTrafficCone.spawn_id_and_parent_with_relative_transform(actorNumber, location=[0, 0, 0], rotation=[0, 0, 0], scale=[1, 1, 1], configuration=0, parentClassID=0, parentActorNumber=0, parentComponent=0, waitForConfirmation=True)
Spawns a new actor relative to an existing actor and creates a kinematic relationship.
- Parameters
actorNumber (uint32) – User defined unique identifier for the class actor in QLabs
location (float array[3]) – (Optional) An array of floats for x, y and z coordinates
rotation (float array[3]) – (Optional) An array of floats for the roll, pitch, and yaw in radians
scale (float array[3]) – (Optional) An array of floats for the scale in the x, y, and z directions. Scale values of 0.0 should not be used.
configuration (uint32) – (Optional) Spawn configuration. See class library for configuration options.
parentClassID (uint32) – See the ID variables in the respective library classes for the class identifier
parentActorNumber (uint32) – User defined unique identifier for the class actor in QLabs
parentComponent (uint32) – 0 for the origin of the parent actor, see the parent class for additional reference frame options
waitForConfirmation (boolean) – (Optional) Make this operation blocking until confirmation of the spawn has occurred.
- Returns
status - 0 if successful, 1 class not available, 2 actor number not available or already in use, 3 cannot find the parent actor, 4 unknown error, -1 communications error
- Return type
int32
- QLabsTrafficCone.spawn_id_and_parent_with_relative_transform_degrees(actorNumber, location=[0, 0, 0], rotation=[0, 0, 0], scale=[1, 1, 1], configuration=0, parentClassID=0, parentActorNumber=0, parentComponent=0, waitForConfirmation=True)
Spawns a new actor relative to an existing actor and creates a kinematic relationship.
- Parameters
actorNumber (uint32) – User defined unique identifier for the class actor in QLabs
location (float array[3]) – (Optional) An array of floats for x, y and z coordinates
rotation (float array[3]) – (Optional) An array of floats for the roll, pitch, and yaw in degrees
scale (float array[3]) – (Optional) An array of floats for the scale in the x, y, and z directions. Scale values of 0.0 should not be used.
configuration (uint32) – (Optional) Spawn configuration. See class library for configuration options.
parentClassID (uint32) – See the ID variables in the respective library classes for the class identifier
parentActorNumber (uint32) – User defined unique identifier for the class actor in QLabs
parentComponent (uint32) – 0 for the origin of the parent actor, see the parent class for additional reference frame options
waitForConfirmation (boolean) – (Optional) Make this operation blocking until confirmation of the spawn has occurred.
- Returns
status - 0 if successful, 1 class not available, 2 actor number not available or already in use, 3 cannot find the parent actor, 4 unknown error, -1 communications error
- Return type
int32
- QLabsTrafficCone.destroy()
Find and destroy a specific actor. This is a blocking operation.
- Returns
numActorsDestroyed - The number of actors destroyed. -1 if failed.
- Return type
int32
- QLabsTrafficCone.destroy_all_actors_of_class()
Find and destroy all actors of this class. This is a blocking operation.
- Returns
numActorsDestroyed - The number of actors destroyed. -1 if failed.
- Return type
int32
- QLabsTrafficCone.ping()
Checks if the actor is still present in the environment. Note that if you did not spawn the actor with one of the spawn functions, you may need to manually set the actorNumber member variable.
- Returns
status - True if successful, False otherwise
- Return type
boolean
- QLabsTrafficCone.get_world_transform()
Get the location, rotation, and scale in world coordinates of the actor.
- Returns
status - True if successful, False otherwise
location
rotation
scale
- Return type
boolean, float array[3], float array[3], float array[3]
- QLabsTrafficCone.get_world_transform_degrees()
Get the location, rotation, and scale in world coordinates of the actor.
- Returns
status - True if successful, False otherwise
location
rotation
scale
- Return type
boolean, float array[3], float array[3], float array[3]
- QLabsTrafficCone.parent_with_relative_transform(location=[0, 0, 0], rotation=[0, 0, 0], scale=[1, 1, 1], parentClassID=0, parentActorNumber=0, parentComponent=0, waitForConfirmation=True)
Parents one existing actor to another to create a kinematic relationship.
- Parameters
location (float array[3]) – (Optional) An array of floats for x, y and z coordinates
rotation (float array[3]) – (Optional) An array of floats for the roll, pitch, and yaw in radians
scale (float array[3]) – (Optional) An array of floats for the scale in the x, y, and z directions. Scale values of 0.0 should not be used.
parentClassID (uint32) – See the ID variables in the respective library classes for the class identifier
parentActorNumber (uint32) – User defined unique identifier for the class actor in QLabs
parentComponent (uint32) – 0 for the origin of the parent actor, see the parent class for additional reference frame options
waitForConfirmation (boolean) – (Optional) Make this operation blocking until confirmation of the spawn has occurred.
- Returns
status - 0 if successful, 1 cannot find this actor, 2 cannot find the parent actor, 3 unknown error, -1 communications error
- Return type
int32
- QLabsTrafficCone.parent_with_relative_transform_degrees(location=[0, 0, 0], rotation=[0, 0, 0], scale=[1, 1, 1], parentClassID=0, parentActorNumber=0, parentComponent=0, waitForConfirmation=True)
Parents one existing actor to another to create a kinematic relationship.
- Parameters
location (float array[3]) – (Optional) An array of floats for x, y and z coordinates
rotation (float array[3]) – (Optional) An array of floats for the roll, pitch, and yaw in degrees
scale (float array[3]) – (Optional) An array of floats for the scale in the x, y, and z directions. Scale values of 0.0 should not be used.
parentClassID (uint32) – (Optional) See the ID variables in the respective library classes for the class identifier
parentActorNumber (uint32) – (Optional) User defined unique identifier for the class actor in QLabs
parentComponent (uint32) – (Optional) 0 for the origin of the parent actor, see the parent class for additional reference frame options
waitForConfirmation (boolean) – (Optional) Make this operation blocking until confirmation of the spawn has occurred.
- Returns
status - 0 if successful, 1 cannot find this actor, 2 cannot find the parent actor, 3 unknown error, -1 communications error
- Return type
int32
- QLabsTrafficCone.parent_with_current_world_transform(parentClassID=0, parentActorNumber=0, parentComponent=0, waitForConfirmation=True)
Parents one existing actor to another to create a kinematic relationship while preserving the current world transform of the child actor.
- Parameters
parentClassID (uint32) – See the ID variables in the respective library classes for the class identifier
parentActorNumber (uint32) – User defined unique identifier for the class actor in QLabs
parentComponent (uint32) – 0 for the origin of the parent actor, see the parent class for additional reference frame options
waitForConfirmation (boolean) – (Optional) Make this operation blocking until confirmation of the spawn has occurred.
- Returns
status - 0 if successful, 1 cannot find this actor, 2 cannot find the parent actor, 3 unknown error, -1 communications error
- Return type
int32
- QLabsTrafficCone.parent_break(waitForConfirmation=True)
Breaks any relationship with a parent actor (if it exists) and preserves the current world transform
- Parameters
waitForConfirmation (boolean) – (Optional) Make this operation blocking until confirmation of the spawn has occurred.
- Returns
status - 0 if successful, 1 cannot find this actor, -1 communications error
- Return type
int32
- QLabsTrafficCone.set_material_properties(materialSlot=0, color=[0, 0, 0], roughness=0.4, metallic=False, waitForConfirmation=True)[source]
Sets the visual surface properties of the cone. The default colors are orange for material slot 0, and black for slot 1.
- Parameters
materialSlot – Material index to be modified. Setting an index for an unsupported slot will be ignored.
color (float array[3]) – Red, Green, Blue components of the RGB color on a 0.0 to 1.0 scale.
roughness (float) – A value between 0.0 (completely smooth and reflective) to 1.0 (completely rough and diffuse). Note that reflections are rendered using screen space reflections. Only objects visible in the camera view will be rendered in the reflection of the object.
metallic (boolean) – Metallic (True) or non-metallic (False)
waitForConfirmation (boolean) – (Optional) Wait for confirmation of the operation before proceeding. This makes the method a blocking operation.
- Returns
True if successful, False otherwise
- Return type
boolean
Configurations
There are four configurations (0-3) for the traffic cone actor class generated
in QLabs. For the purpose of the set_material_properties
method, configuration 0
has a single material slot (0), and configurations 1-3 have two material slots (0, 1).
Connection Points
There are no connection points for this actor class.
Traffic Cone Tutorial
Example
Raw to download this tutorial: Road Signage Tutorial
.
1"""
2Road Signage Library Example
3----------------------------
4
5.. note::
6
7 Make sure you have Quanser Interactive Labs open before running this
8 example. This example is designed to best be run in QCar Cityscape
9 or Cityscape Lite.
10
11"""
12
13# imports to important libraries
14import sys
15import math
16import time
17
18from qvl.qlabs import QuanserInteractiveLabs
19from qvl.free_camera import QLabsFreeCamera
20from qvl.crosswalk import QLabsCrosswalk
21from qvl.roundabout_sign import QLabsRoundaboutSign
22from qvl.yield_sign import QLabsYieldSign
23from qvl.stop_sign import QLabsStopSign
24from qvl.traffic_cone import QLabsTrafficCone
25from qvl.traffic_light import QLabsTrafficLight
26
27# set any of these flags to False if you don't want to see the output
28CROSSWALK_FLAG = True
29ROUNDABOUT_FLAG = True
30YIELDSIGN_FLAG = True
31STOPSIGN_FLAG = True
32TRAFFICCONE_FLAG = True
33TRAFFICLIGHT_FLAG = True
34
35def crosswalk(qlabs):
36 """This method demonstrates some basic commands with the crosswalk class"""
37
38 # initialize a camera - See Camera Actor Library Reference for more information
39 cameraCrosswalk = QLabsFreeCamera(qlabs)
40 cameraCrosswalk.spawn(location=[-19.286, 43, 5.5], rotation=[-0, 0.239, -0.043])
41 cameraCrosswalk.possess()
42
43 # create a crosswalk in this qlabs instance
44 crosswalk = QLabsCrosswalk(qlabs)
45
46 # spawn crosswalk with radians in config
47 crosswalk.spawn_id(actorNumber=0, location=[-10.788, 45, 0.00], rotation=[0,0,math.pi/2], scale=[1,1,1], configuration=0, waitForConfirmation=True)
48 # waits so we can see the output
49 time.sleep(1)
50 # spawn crosswalk with degrees in config 1
51 crosswalk.spawn_id_degrees(actorNumber=1, location=[-6.788, 45, 0.00], rotation=[0,0,90], scale=[1,1,1], configuration=1, waitForConfirmation=True)
52 # waits so we can see the output
53 time.sleep(1)
54 # spawn crosswalk with degress in config 2
55 crosswalk.spawn_id_degrees(actorNumber=2, location=[-2.8, 45, 0.0], rotation=[0,0,90], scale=[1,1,1], configuration=2, waitForConfirmation=True)
56
57 # collecting the world transform coordinates of the crosswalk
58 x, loc, rot, scale = crosswalk.get_world_transform()
59 print( x, loc, rot, scale)
60
61 # pinging existing sign - this should return True if we printed it
62 crosswalk.ping()
63
64
65
66def roundabout_sign(qlabs):
67 """This method demonstrates some basic commands with the roundabout sign class"""
68
69 # create two roundabouts in this qlabs instance
70 roundabout = QLabsRoundaboutSign(qlabs)
71 roundabout2 = QLabsRoundaboutSign(qlabs)
72
73 # spawns the sign we just created using radians and specifying the actorNumber
74 roundabout.spawn_id(actorNumber=0, location=[-17, 29, 0.0], rotation=[0, 0, math.pi], scale=[1,1,1], configuration=0, waitForConfirmation=True)
75 # spawns the second sign we just created using degrees and allowing the computer to
76 # generate an actorNumber internally
77 roundabout2.spawn_id_degrees(actorNumber=2, location=[-15, 29, 0.0], rotation=[0,0,180], scale=[1,1,1], configuration=0, waitForConfirmation=True)
78
79 # collecting the world transform coordinates of the roundabout sign
80 x, loc, rot, scale = roundabout2.get_world_transform()
81 print( x, loc, rot, scale)
82
83 # pinging existing sign - this should return True if we printed it
84 roundabout2.ping()
85 # waits so we can see the output
86 time.sleep(1)
87
88 # destroying the sign we just created
89 roundabout.destroy()
90
91
92def yield_sign(qlabs):
93 """This method demonstrates some basic commands with the yield sign class"""
94
95 # create two yieldsigns in this qlabs instance
96 yieldsign = QLabsYieldSign(qlabs)
97 yieldsign2 = QLabsYieldSign(qlabs)
98
99 # spawns the sign we just created using radians and specifying the actorNumber
100 yieldsign.spawn_id(actorNumber=0, location=[-17, 31, 0.0], rotation=[0,0,math.pi], scale=[1,1,1], configuration=0, waitForConfirmation=True)
101 # spawns the second sign we just created using degrees and allowing the computer to
102 # generate an actorNumber internally
103 yieldsign2.spawn_degrees(location=[-15, 31, 0.0], rotation=[0,0,180], scale=[1,1,1], configuration=0, waitForConfirmation=True)
104
105 # collecting the world transform coordinates of the yield sign
106 x, loc, rot, scale = yieldsign2.get_world_transform()
107 print( x, loc, rot, scale)
108
109 # pinging existing sign - this should return "True" if we printed it
110 yieldsign2.ping()
111 # waits so we can see the output
112 time.sleep(1)
113
114 # destroying the sign we just created
115 yieldsign.destroy()
116
117
118def stop_sign(qlabs):
119 """This method demonstrates some basic commands with the stop sign class"""
120
121 # create two stop signs in this qlabs instance
122 stop = QLabsStopSign(qlabs)
123 stop2 = QLabsStopSign(qlabs)
124 # spawns the sign we just created using radians
125 stop.spawn_id(actorNumber=1, location=[-16, 30, 0.0], rotation=[0,0,math.pi], scale=[1,1,1], configuration=0, waitForConfirmation=True)
126 # spawns the second sign we just created using degrees and generating the actorNumber internally
127 stop2.spawn_degrees(location=[-15, 30, 0.0], rotation=[0,0,180], scale=[1,1,1], configuration=0, waitForConfirmation=True)
128
129 # collecting the world transform coordinates of the stop sign
130 x, loc, rot, scale = stop2.get_world_transform()
131 print(x, loc, rot, scale)
132
133 # pinging existing sign - this should return True if we printed it
134 stop2.ping()
135 # waits so we can see the output
136 time.sleep(1)
137
138 # destroying the sign we just created
139 stop.destroy()
140
141
142def traffic_cone(qlabs):
143 """This method demonstrates some basic commands with the traffic cone class"""
144
145 # creates 3 cones in this qlabs instance
146 cone = QLabsTrafficCone(qlabs)
147 cone1 = QLabsTrafficCone(qlabs)
148 cone2 = QLabsTrafficCone(qlabs)
149 cone3 = QLabsTrafficCone(qlabs)
150 cone4 = QLabsTrafficCone(qlabs)
151
152 # spawns a small traffic cone we just initialized using radians
153 cone.spawn(location=[-17, 28, 1.0], rotation=[0,0,math.pi], scale=[1,1,1], configuration=0, waitForConfirmation=True)
154 # waits so we can see the output
155 time.sleep (1)
156 # destroy the cone we just made
157 cone.destroy()
158 # waits so we can see the output
159 time.sleep(1)
160 # spawns another small traffic cone we just initialized using radians in the same place
161 cone1.spawn_id(actorNumber=1, location=[-17, 28, 1.0], rotation=[0,0,math.pi], scale=[1,1,1], configuration=0, waitForConfirmation=True)
162 # spawns a construction pylon using the cone we just initialized using degrees and generating
163 # the actorNumber internally
164 cone2.spawn_degrees(location=[-15, 28, 1.0], rotation=[0,0,180], scale=[1,1,1], configuration=1, waitForConfirmation=True)
165 # spawns a small cone with one color stripe initialized using actor number and a position in degrees
166 cone3.spawn_id_degrees(actorNumber=3, location=[-15, 26.5, 1.0], rotation=[0,0,90], scale=[1,1,1], configuration=2, waitForConfirmation=True)
167 # spawns a bigger cone with two color stripes using radians and generating the actorNumber internally
168 cone4.spawn(location=[-17, 26.5, 1.0], rotation=[0,0,math.pi/4], scale=[1,1,1], configuration=3, waitForConfirmation=True)
169
170 # waits so we can see the output
171 time.sleep(1.5)
172
173 # change the color of the cones (materialSlot 0 is the base color, and 1 is the stripes)
174 cone1.set_material_properties(materialSlot=0, color=[0,0,1],metallic=True)
175 # waits so we can see the output
176 time.sleep(.5)
177
178 cone2.set_material_properties(materialSlot=0, color=[1,0,0],roughness=1,metallic=False)
179 cone2.set_material_properties(materialSlot=1, color=[1,.5,0])
180 time.sleep(.5)
181
182 cone3.set_material_properties(materialSlot=0, color=[0,1,1])
183 cone3.set_material_properties(materialSlot=1, color=[0,.3,1],roughness=1,metallic=True)
184 time.sleep(.5)
185
186 cone4.set_material_properties(materialSlot=0, color=[1,0,1],roughness=0,metallic=False)
187 cone4.set_material_properties(materialSlot=1, color=[.3,0,1])
188
189 # waits so we can see the output
190 time.sleep(3)
191
192 # collecting the world transform coordinates of the traffic cone
193 x, loc, rot, scale = cone2.get_world_transform()
194 print(x, loc, rot, scale)
195
196 # pinging existing cone - this should return True if we printed it
197 cone2.ping()
198
199
200def traffic_light(qlabs):
201 """This method demonstrates some basic commands with the traffic light class"""
202
203 # initialize a camera - See Camera Actor Library Reference for more information
204 cameraTraffic = QLabsFreeCamera(qlabs)
205 cameraTraffic.spawn(location=[0.131, 2.05, 2.047], rotation=[-0, -0.068, 1.201])
206 cameraTraffic.possess()
207
208 # initialize three traffic light instances in qlabs
209 trafficLight = QLabsTrafficLight(qlabs)
210 trafficLight2 = QLabsTrafficLight(qlabs)
211 trafficLight3 = QLabsTrafficLight(qlabs)
212
213 # spawn a traffic light in config 1 - vertical using radians and specifying a specific actorNumber
214 trafficLight.spawn_id(actorNumber=0, location=[5.616, 14.131, 0.215], rotation=[0,0,0], scale=[1,1,1], configuration=0, waitForConfirmation=True)
215 # spawn a second traffic light using degrees in config 1 - vertical and specifying a specific actorNumber
216 trafficLight2.spawn_id_degrees(actorNumber=2, location=[-3.078, 14.136, 0.215], rotation=[0,0,180], scale=[1,1,1], configuration=1, waitForConfirmation=True)
217 # spawn traffic light using degrees in config 2 - horizontal and generating the actorNumber internally
218 trafficLight3.spawn_degrees(location=[6.703, 5.6, 0.215], rotation=[0,0,-90], scale=[1,1,1], configuration=2, waitForConfirmation=True)
219
220 # collecting the world transform coordinates of the traffic light
221 x, loc, rot, scale = trafficLight2.get_world_transform()
222 print(x, loc, rot, scale)
223
224 # pinging existing traffic light - this should return True if we printed it
225 trafficLight2.ping()
226
227 # changing the state of the traffic lights from green to red
228
229 time.sleep(2)
230
231 trafficLight.set_state(state=trafficLight.STATE_YELLOW, waitForConfirmation=True)
232 trafficLight2.set_state(state=trafficLight2.STATE_YELLOW, waitForConfirmation=True)
233
234 time.sleep(1)
235
236 trafficLight.set_state(state=trafficLight.STATE_RED, waitForConfirmation=True)
237 trafficLight2.set_state(state=trafficLight2.STATE_RED, waitForConfirmation=True)
238
239 time.sleep(1)
240
241 trafficLight3.set_state(state=trafficLight3.STATE_GREEN, waitForConfirmation=True)
242
243 # destroying a traffic light
244 trafficLight.destroy()
245
246
247def main():
248
249 # creates a server connection with Quanser Interactive Labs and manages the communications
250 qlabs = QuanserInteractiveLabs()
251
252 print("Connecting to QLabs...")
253 # trying to connect to QLabs and open the instance we have created - program will end if this fails
254 try:
255 qlabs.open("localhost")
256 except:
257 print("Unable to connect to QLabs")
258 return
259
260 # destroying any spawned actors in our QLabs that currently exist
261 qlabs.destroy_all_spawned_actors()
262
263 if CROSSWALK_FLAG == True:
264 crosswalk(qlabs)
265 time.sleep(2)
266
267 # switch the camera angle from whatever it was previous to be able to see where we will be
268 # spawning the rest of the objects - see Camera Actor Library Reference for more information
269 if ROUNDABOUT_FLAG or YIELDSIGN_FLAG or STOPSIGN_FLAG or TRAFFICCONE_FLAG:
270 camera0 = QLabsFreeCamera(qlabs)
271 camera0.spawn(location=[-20.14, 29.472, 2.071], rotation=[0, 0.203, -0.024])
272 camera0.possess()
273
274 if ROUNDABOUT_FLAG:
275 roundabout_sign(qlabs)
276 time.sleep(1)
277
278 if YIELDSIGN_FLAG:
279 yield_sign(qlabs)
280 time.sleep(1)
281
282 if STOPSIGN_FLAG:
283 stop_sign(qlabs)
284 time.sleep(1)
285
286 if TRAFFICCONE_FLAG:
287 traffic_cone(qlabs)
288 time.sleep(1)
289
290 if TRAFFICLIGHT_FLAG:
291 traffic_light(qlabs)
292
293
294if __name__ == "__main__":
295 main()
296
297
298
299
300
301
302
303
304