From 6a2299486758fab45dbd009de9fb63b1cb640843 Mon Sep 17 00:00:00 2001 From: Forrest Laine Date: Sun, 24 Mar 2024 20:13:16 -0500 Subject: [PATCH] External repository access now works --- src/VehicleSim.jl | 2 +- src/client.jl | 6 +++--- src/example_project.jl | 4 ++-- src/sim.jl | 7 +++++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/VehicleSim.jl b/src/VehicleSim.jl index 75165ec..075c13d 100644 --- a/src/VehicleSim.jl +++ b/src/VehicleSim.jl @@ -26,6 +26,6 @@ include("measurements.jl") include("map.jl") include("example_project.jl") -export server, shutdown!, keyboard_client, GroundTruthMeasurement, CameraMeasurement, IMUMeasurement, GPSMeasurement, VehicleCommand, training_map, load_mechanism +export server, shutdown!, keyboard_client, GroundTruthMeasurement, CameraMeasurement, IMUMeasurement, GPSMeasurement, VehicleCommand, training_map, load_mechanism, MeasurementMessage end diff --git a/src/client.jl b/src/client.jl index c63666b..3d1154e 100644 --- a/src/client.jl +++ b/src/client.jl @@ -41,7 +41,7 @@ function keyboard_client(host::IPAddr=IPv4(0), port=4444; v_step = 1.0, s_step = num_gps += 1 end end - # @info "Measurements received: $num_gt gt; $num_cam cam; $num_imu imu; $num_gps gps" + @info "Measurements received: $num_gt gt; $num_cam cam; $num_imu imu; $num_gps gps" end target_velocity = 0.0 @@ -83,7 +83,7 @@ function keyboard_client(host::IPAddr=IPv4(0), port=4444; v_step = 1.0, s_step = steering_angle -= s_step @info "Target steering angle: $steering_angle" end - cmd = VehicleCommand(steering_angle, target_velocity, controlled) + cmd = (steering_angle, target_velocity, controlled) serialize(socket, cmd) end end @@ -106,7 +106,7 @@ function example_client(host::IPAddr=IPv4(0), port=4444) shutdown = true persist = false end - cmd = VehicleCommand(0.0, 2.5, persist, shutdown) + cmd = (0.0, 2.5, persist, shutdown) serialize(socket, cmd) end diff --git a/src/example_project.jl b/src/example_project.jl index 1319b0d..1c4371e 100644 --- a/src/example_project.jl +++ b/src/example_project.jl @@ -66,7 +66,7 @@ function decision_making(localization_state_channel, # figure out what to do ... setup motion planning problem etc steering_angle = 0.0 target_vel = 0.0 - cmd = VehicleCommand(steering_angle, target_vel, true) + cmd = (steering_angle, target_vel, true) serialize(socket, cmd) end end @@ -78,7 +78,7 @@ end function my_client(host::IPAddr=IPv4(0), port=4444) socket = Sockets.connect(host, port) - map_segments = VehicleSim.training_map() + map_segments = VehicleSim.city_map() msg = deserialize(socket) # Visualization info @info msg diff --git a/src/sim.jl b/src/sim.jl index 178ae38..b80dcbe 100644 --- a/src/sim.jl +++ b/src/sim.jl @@ -168,17 +168,20 @@ function server(max_vehicles=1, break end end - car_cmd = deserialize(sock) + raw_cmd = deserialize(sock) received = true !received && continue + car_cmd = VehicleCommand(raw_cmd...) put!(cmd_channels[vehicle_id], car_cmd) if !car_cmd.controlled close(sock) end end catch e - @warn "Error receiving command for vehicle $vehicle_id. Did client fail?" + @warn e + @warn "Error receiving command for vehicle $vehicle_id. Client may have failed. Closing socket connection to client." + close(sock) end end @async begin