From 25ea36d5c522caaf5cf6b114d884e756f63675e5 Mon Sep 17 00:00:00 2001 From: dev Date: Wed, 25 Oct 2023 01:49:43 -0400 Subject: [PATCH] PR Updates --- .../resources/scenarios/Town04/carla/carla_config.json | 4 +++- .../resources/scenarios/Town04_test/carla/carla_config.json | 3 ++- .../eclipse/mosaic/fed/carla/ambassador/CarlaAmbassador.java | 5 +---- .../mosaic/fed/carla/carlaconnect/CarlaXmlRpcClient.java | 4 ---- .../eclipse/mosaic/fed/carla/config/CarlaConfiguration.java | 5 +++++ .../mosaic/fed/carla/config/CarlaConfigurationTest.java | 1 + .../fed/mosaic-carla/src/test/resources/carla_config.json | 4 +++- .../ambassador/InfrastructureMessageAmbassadorTest.java | 1 - 8 files changed, 15 insertions(+), 12 deletions(-) diff --git a/co-simulation/bundle/src/assembly/resources/scenarios/Town04/carla/carla_config.json b/co-simulation/bundle/src/assembly/resources/scenarios/Town04/carla/carla_config.json index 1be28b9c..b65ef566 100644 --- a/co-simulation/bundle/src/assembly/resources/scenarios/Town04/carla/carla_config.json +++ b/co-simulation/bundle/src/assembly/resources/scenarios/Town04/carla/carla_config.json @@ -2,5 +2,7 @@ "updateInterval": 100, "carlaUE4Path": "/opt/carla/", "bridgePath": "/opt/carma-simulation/scenarios/Town04/carla; bridge.sh", - "carlaConnectionPort": 8913 + "carlaConnectionPort": 8913, + "carlaCDASimAdapterUrl":"http://127.0.0.1:8090/RPC2" + } diff --git a/co-simulation/bundle/src/assembly/resources/scenarios/Town04_test/carla/carla_config.json b/co-simulation/bundle/src/assembly/resources/scenarios/Town04_test/carla/carla_config.json index 51bc8ef2..aff6f191 100644 --- a/co-simulation/bundle/src/assembly/resources/scenarios/Town04_test/carla/carla_config.json +++ b/co-simulation/bundle/src/assembly/resources/scenarios/Town04_test/carla/carla_config.json @@ -2,5 +2,6 @@ "updateInterval": 100, "carlaUE4Path": "/opt/carla/", "bridgePath": "/opt/carma-simulation/scenarios/Town04_test/carla; bridge.sh", - "carlaConnectionPort": 8913 + "carlaConnectionPort": 8913, + "carlaCDASimAdapterUrl":"http://127.0.0.1:8090/RPC2" } diff --git a/co-simulation/fed/mosaic-carla/src/main/java/org/eclipse/mosaic/fed/carla/ambassador/CarlaAmbassador.java b/co-simulation/fed/mosaic-carla/src/main/java/org/eclipse/mosaic/fed/carla/ambassador/CarlaAmbassador.java index 80dc6814..5d34076c 100644 --- a/co-simulation/fed/mosaic-carla/src/main/java/org/eclipse/mosaic/fed/carla/ambassador/CarlaAmbassador.java +++ b/co-simulation/fed/mosaic-carla/src/main/java/org/eclipse/mosaic/fed/carla/ambassador/CarlaAmbassador.java @@ -17,7 +17,6 @@ import org.apache.commons.codec.binary.Hex; import org.apache.commons.lang3.StringUtils; import org.apache.xmlrpc.XmlRpcException; -import org.apache.xmlrpc.client.XmlRpcClientException; import org.eclipse.mosaic.fed.carla.carlaconnect.CarlaConnection; import org.eclipse.mosaic.fed.carla.carlaconnect.CarlaXmlRpcClient; import org.eclipse.mosaic.fed.carla.config.CarlaConfiguration; @@ -28,7 +27,6 @@ import org.eclipse.mosaic.interactions.detector.DetectedObjectInteraction; import org.eclipse.mosaic.interactions.detector.DetectorRegistration; import org.eclipse.mosaic.lib.objects.detector.DetectedObject; -import org.eclipse.mosaic.lib.objects.detector.Detector; import org.eclipse.mosaic.lib.util.ProcessLoggingThread; import org.eclipse.mosaic.lib.util.objects.ObjectInstantiation; import org.eclipse.mosaic.rti.TIME; @@ -43,7 +41,6 @@ import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; -import java.util.HashMap; import java.util.List; import java.util.concurrent.PriorityBlockingQueue; import java.util.concurrent.TimeUnit; @@ -219,7 +216,7 @@ public void initialize(long startTime, long endTime) throws InternalFederateExce //initialize CarlaXmlRpcClient //set the connected server URL try{ - URL xmlRpcServerUrl = new URL("http://127.0.0.1:8090/RPC2"); + URL xmlRpcServerUrl = new URL(carlaConfig.carlaCDASimAdapterUrl); carlaXmlRpcClient = new CarlaXmlRpcClient(xmlRpcServerUrl); } catch (MalformedURLException m) diff --git a/co-simulation/fed/mosaic-carla/src/main/java/org/eclipse/mosaic/fed/carla/carlaconnect/CarlaXmlRpcClient.java b/co-simulation/fed/mosaic-carla/src/main/java/org/eclipse/mosaic/fed/carla/carlaconnect/CarlaXmlRpcClient.java index 1f6c3a92..cd32d516 100644 --- a/co-simulation/fed/mosaic-carla/src/main/java/org/eclipse/mosaic/fed/carla/carlaconnect/CarlaXmlRpcClient.java +++ b/co-simulation/fed/mosaic-carla/src/main/java/org/eclipse/mosaic/fed/carla/carlaconnect/CarlaXmlRpcClient.java @@ -16,15 +16,12 @@ package org.eclipse.mosaic.fed.carla.carlaconnect; import java.net.URL; -import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.apache.xmlrpc.XmlRpcException; import org.apache.xmlrpc.client.XmlRpcClient; import org.apache.xmlrpc.client.XmlRpcClientConfigImpl; -import org.apache.xmlrpc.client.XmlRpcClientException; -import org.eclipse.mosaic.interactions.detector.DetectedObjectInteraction; import org.eclipse.mosaic.interactions.detector.DetectorRegistration; import org.eclipse.mosaic.lib.objects.detector.DetectedObject; import org.slf4j.Logger; @@ -39,7 +36,6 @@ public class CarlaXmlRpcClient{ boolean isConnected; private static final String CREATE_SENSOR = "create_simulated_semantic_lidar_sensor"; - private static final String GET_SENSOR = "get_simulated_sensor"; private static final String GET_DETECTED_OBJECTS = "get_detected_objects"; private XmlRpcClient client; diff --git a/co-simulation/fed/mosaic-carla/src/main/java/org/eclipse/mosaic/fed/carla/config/CarlaConfiguration.java b/co-simulation/fed/mosaic-carla/src/main/java/org/eclipse/mosaic/fed/carla/config/CarlaConfiguration.java index 6f1f5015..2e17b7a8 100644 --- a/co-simulation/fed/mosaic-carla/src/main/java/org/eclipse/mosaic/fed/carla/config/CarlaConfiguration.java +++ b/co-simulation/fed/mosaic-carla/src/main/java/org/eclipse/mosaic/fed/carla/config/CarlaConfiguration.java @@ -48,5 +48,10 @@ public class CarlaConfiguration implements Serializable { * Carla connection port */ public int carlaConnectionPort; + /** + * URL where CARLACDASimAdapter XMLRPC Server is hosted + */ + public String carlaCDASimAdapterUrl; + } diff --git a/co-simulation/fed/mosaic-carla/src/test/java/org/eclipse/mosaic/fed/carla/config/CarlaConfigurationTest.java b/co-simulation/fed/mosaic-carla/src/test/java/org/eclipse/mosaic/fed/carla/config/CarlaConfigurationTest.java index ba123715..f993d362 100644 --- a/co-simulation/fed/mosaic-carla/src/test/java/org/eclipse/mosaic/fed/carla/config/CarlaConfigurationTest.java +++ b/co-simulation/fed/mosaic-carla/src/test/java/org/eclipse/mosaic/fed/carla/config/CarlaConfigurationTest.java @@ -41,6 +41,7 @@ public void readConfig_assertProperties() throws InstantiationException { assertEquals("D:/CARLA_0.9.10/", carlaConfiguration.carlaUE4Path); assertEquals("./scenarios/Town04_10/carla; bridge.bat", carlaConfiguration.bridgePath); assertEquals(8913, carlaConfiguration.carlaConnectionPort); + assertEquals("http://127.0.0.1:8090/RPC2",carlaConfiguration.carlaCDASimAdapterUrl); } /** diff --git a/co-simulation/fed/mosaic-carla/src/test/resources/carla_config.json b/co-simulation/fed/mosaic-carla/src/test/resources/carla_config.json index d2004afe..30b91345 100644 --- a/co-simulation/fed/mosaic-carla/src/test/resources/carla_config.json +++ b/co-simulation/fed/mosaic-carla/src/test/resources/carla_config.json @@ -2,5 +2,7 @@ "updateInterval": 200, "carlaUE4Path": "D:/CARLA_0.9.10/", "bridgePath": "./scenarios/Town04_10/carla; bridge.bat", - "carlaConnectionPort": 8913 + "carlaConnectionPort": 8913, + "carlaCDASimAdapterUrl":"http://127.0.0.1:8090/RPC2" + } \ No newline at end of file diff --git a/co-simulation/fed/mosaic-infrastructure/src/test/java/org/eclipse/mosaic/fed/infrastructure/ambassador/InfrastructureMessageAmbassadorTest.java b/co-simulation/fed/mosaic-infrastructure/src/test/java/org/eclipse/mosaic/fed/infrastructure/ambassador/InfrastructureMessageAmbassadorTest.java index 9fbc4e7c..3bad18b6 100644 --- a/co-simulation/fed/mosaic-infrastructure/src/test/java/org/eclipse/mosaic/fed/infrastructure/ambassador/InfrastructureMessageAmbassadorTest.java +++ b/co-simulation/fed/mosaic-infrastructure/src/test/java/org/eclipse/mosaic/fed/infrastructure/ambassador/InfrastructureMessageAmbassadorTest.java @@ -59,7 +59,6 @@ import org.eclipse.mosaic.rti.api.parameters.AmbassadorParameter; import org.eclipse.mosaic.rti.api.parameters.FederateDescriptor; import org.eclipse.mosaic.rti.config.CLocalHost; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test;