"""Example of launching world and spawning vehicles."""
import carla
-client = carla.Client("localhost", 2000)
-client.set_timeout(9999)
-world = client.get_world()
-settings = world.get_settings()
+CARLA_SERVER_IP = "10.35.95.3"
+MAX_SIM_TIME = 4.0 # seconds
+
+client = None
+world = None
+settings = None
+
+
+def set_client():
+ global client
+ global world
+ global settings
+ client = carla.Client(CARLA_SERVER_IP, 2000)
+ client.set_timeout(99)
+ world = client.get_world()
+ settings = world.get_settings()
def set_world(new_world="Town04"):
c.throttle = 1
i = 0
- while i * settings.fixed_delta_seconds < 4:
+ while i * settings.fixed_delta_seconds < MAX_SIM_TIME:
print("step {} time {} ego speed {} m/s".format(
i, i * 0.02, e.get_velocity().length()))
if i == 10:
destroy(e, t)
+def main_remote_simulation_collision():
+ """The default directory to store recordings is::
+
+ ~/.config/Epic/CarlaUE4/Saved/
+
+ """
+ set_world()
+ set_simulation()
+ t = spawn_target()
+ world.tick()
+ e = spawn_ego(t)
+ world.tick()
+ t.set_target_velocity(carla.Vector3D(10, 0, 0))
+
+ c = carla.VehicleControl()
+ c.throttle = 1
+
+ i = 0
+ while i * settings.fixed_delta_seconds < MAX_SIM_TIME:
+ i += 1
+ world.tick()
+
+ destroy(e, t)
+
+
if __name__ == "__main__":
+ set_client()
try:
- main_collision()
+ client.start_recorder("remote-simulation-collision", True)
+ main_remote_simulation_collision()
+ client.stop_recorder()
except KeyboardInterrupt:
pass