diff --git a/.devcontainer/docker-compose-vscode.yml b/.devcontainer/docker-compose-vscode.yml index 8070c30d1..967c33125 100755 --- a/.devcontainer/docker-compose-vscode.yml +++ b/.devcontainer/docker-compose-vscode.yml @@ -22,7 +22,7 @@ services: - TIME_SYNC_TOPIC=time_sync - TIME_SYNC_PORT=7575 - SIM_V2X_PORT=5757 - - SIM_SENSOR_DETECTED_OBJECT_PORT=7576 + - SIM_INTERACTION_PORT=7576 - V2X_PORT=8686 - INFRASTRUCTURE_ID=1 secrets: diff --git a/configuration/amd64/docker-compose.yml b/configuration/amd64/docker-compose.yml index ffe16dcb6..d3ba706d9 100755 --- a/configuration/amd64/docker-compose.yml +++ b/configuration/amd64/docker-compose.yml @@ -45,7 +45,7 @@ services: - TIME_SYNC_TOPIC=time_sync - TIME_SYNC_PORT=7575 - SIM_V2X_PORT=5757 - - SIM_SENSOR_DETECTED_OBJECT_PORT=7576 + - SIM_INTERACTION_PORT=7576 - V2X_PORT=8686 - INFRASTRUCTURE_ID=1 - KAFKA_BROKER_ADDRESS=127.0.0.1:9092 diff --git a/src/tmx/TmxUtils/src/simulation/SimulationEnvUtils.h b/src/tmx/TmxUtils/src/simulation/SimulationEnvUtils.h index 009df41a2..e49c7f00a 100644 --- a/src/tmx/TmxUtils/src/simulation/SimulationEnvUtils.h +++ b/src/tmx/TmxUtils/src/simulation/SimulationEnvUtils.h @@ -45,7 +45,7 @@ namespace tmx::utils::sim{ * @brief Name of environment variable for storing port for forwarding v2x messages to CDASim. Only * necessary in SIMULATION MODE for CDASim message forwarding. */ - constexpr inline static const char *SIM_SENSOR_DETECTED_OBJECT_PORT = "SIM_SENSOR_DETECTED_OBJECT_PORT"; + constexpr inline static const char *SIM_INTERACTION_PORT= "SIM_INTERACTION_PORT"; /** * @brief Name of environment variable for storing port for receiving v2x messages from CDASim. Only * necessary in SIMULATION MODE for CDASim message forwarding. diff --git a/src/v2i-hub/CDASimAdapter/src/CDASimAdapter.cpp b/src/v2i-hub/CDASimAdapter/src/CDASimAdapter.cpp index 2fad976eb..7c0c6c431 100644 --- a/src/v2i-hub/CDASimAdapter/src/CDASimAdapter.cpp +++ b/src/v2i-hub/CDASimAdapter/src/CDASimAdapter.cpp @@ -91,7 +91,7 @@ namespace CDASimAdapter{ PLOG(logINFO) << "Simulation and local IP successfully initialized!"<< std::endl; uint simulation_registration_port = std::stoul(sim::get_sim_config(sim::SIMULATION_REGISTRATION_PORT)); uint time_sync_port = std::stoul(sim::get_sim_config(sim::TIME_SYNC_PORT)); - uint sensor_detected_object_detection_port = std::stoul(sim::get_sim_config(sim::SIM_SENSOR_DETECTED_OBJECT_PORT)); + uint simulated_interaction_port = std::stoul(sim::get_sim_config(sim::SIM_INTERACTION_PORT)); uint v2x_port = std::stoul(sim::get_sim_config(sim::V2X_PORT)); uint sim_v2x_port = std::stoul(sim::get_sim_config(sim::SIM_V2X_PORT)); std::string infrastructure_id = sim::get_sim_config(sim::INFRASTRUCTURE_ID); @@ -101,11 +101,11 @@ namespace CDASimAdapter{ " Time Sync Port: " << std::to_string( time_sync_port) << " and V2X Port: " << std::to_string(v2x_port) << std::endl; if ( connection ) { connection.reset(new CDASimConnection( simulation_ip, infrastructure_id, simulation_registration_port, sim_v2x_port, local_ip, - time_sync_port, sensor_detected_object_detection_port, v2x_port, location )); + time_sync_port, simulated_interaction_port, v2x_port, location )); } else { connection = std::make_unique(simulation_ip, infrastructure_id, simulation_registration_port, sim_v2x_port, local_ip, - time_sync_port, sensor_detected_object_detection_port, v2x_port, location); + time_sync_port, simulated_interaction_port, v2x_port, location); } } catch (const TmxException &e) { diff --git a/src/v2i-hub/CDASimAdapter/src/CDASimConnection.cpp b/src/v2i-hub/CDASimAdapter/src/CDASimConnection.cpp index e106fb28c..288d7839a 100644 --- a/src/v2i-hub/CDASimAdapter/src/CDASimConnection.cpp +++ b/src/v2i-hub/CDASimAdapter/src/CDASimConnection.cpp @@ -5,10 +5,10 @@ using namespace tmx::utils; namespace CDASimAdapter{ CDASimConnection::CDASimConnection(const std::string &simulation_ip, const std::string &infrastructure_id, const uint simulation_registration_port, const uint sim_v2x_port, - const std::string &local_ip, const uint time_sync_port,const uint sensor_detected_object_detection_port, const uint v2x_port, + const std::string &local_ip, const uint time_sync_port,const uint simulated_interaction_port, const uint v2x_port, const Point &location) : _simulation_ip(simulation_ip), _infrastructure_id(infrastructure_id), _simulation_registration_port(simulation_registration_port), - _simulation_v2x_port(sim_v2x_port), _local_ip(local_ip), _time_sync_port(time_sync_port), _sensor_detected_object_detection_port(sensor_detected_object_detection_port),_v2x_port(v2x_port), + _simulation_v2x_port(sim_v2x_port), _local_ip(local_ip), _time_sync_port(time_sync_port), _simulated_interaction_port(simulated_interaction_port),_v2x_port(v2x_port), _location(location) { PLOG(logDEBUG) << "CARMA-Simulation connection initialized." << std::endl; } @@ -20,11 +20,11 @@ namespace CDASimAdapter{ } bool CDASimConnection::connect() { - if (!carma_simulation_handshake(_simulation_ip, _infrastructure_id, _simulation_registration_port, _local_ip, _time_sync_port, _sensor_detected_object_detection_port, _v2x_port, _location)) { + if (!carma_simulation_handshake(_simulation_ip, _infrastructure_id, _simulation_registration_port, _local_ip, _time_sync_port, _simulated_interaction_port, _v2x_port, _location)) { _connected = false; return _connected; } - if (!setup_udp_connection(_simulation_ip, _local_ip, _time_sync_port,_sensor_detected_object_detection_port, _v2x_port, _simulation_v2x_port )) { + if (!setup_udp_connection(_simulation_ip, _local_ip, _time_sync_port,_simulated_interaction_port, _v2x_port, _simulation_v2x_port )) { _connected = false; return _connected; } @@ -34,7 +34,7 @@ namespace CDASimAdapter{ } - std::string CDASimConnection::get_handshake_json(const std::string &infrastructure_id, const std::string &local_ip, const uint time_sync_port, const uint sensor_detected_object_detection_port, const uint v2x_port, + std::string CDASimConnection::get_handshake_json(const std::string &infrastructure_id, const std::string &local_ip, const uint time_sync_port, const uint simulated_interaction_port, const uint v2x_port, const Point &location) const { @@ -45,7 +45,7 @@ namespace CDASimAdapter{ message["infrastructureId"] = infrastructure_id; message["rxMessagePort"] = v2x_port; message["timeSyncPort"] = time_sync_port; - message["simulatedInteractionPort"] = sensor_detected_object_detection_port; + message["simulatedInteractionPort"] = simulated_interaction_port; message["location"]["x"] = location.X; message["location"]["y"] = location.Y; message["location"]["z"] = location.Z; @@ -55,13 +55,13 @@ namespace CDASimAdapter{ } bool CDASimConnection::carma_simulation_handshake(const std::string &simulation_ip, const std::string &infrastructure_id, const uint simulation_registration_port, - const std::string &local_ip, const uint time_sync_port, const uint sensor_detected_object_detection_port, const uint v2x_port, + const std::string &local_ip, const uint time_sync_port, const uint simulated_interaction_port, const uint v2x_port, const Point &location) { // Create JSON message with the content std::string payload = ""; - payload = get_handshake_json(infrastructure_id, local_ip, time_sync_port, sensor_detected_object_detection_port, v2x_port, location); + payload = get_handshake_json(infrastructure_id, local_ip, time_sync_port, simulated_interaction_port, v2x_port, location); try { @@ -77,7 +77,7 @@ namespace CDASimAdapter{ return true; } - bool CDASimConnection::setup_udp_connection(const std::string &simulation_ip, const std::string &local_ip, const uint time_sync_port, const uint sensor_detected_object_detection_port, + bool CDASimConnection::setup_udp_connection(const std::string &simulation_ip, const std::string &local_ip, const uint time_sync_port, const uint simulated_interaction_port, const uint v2x_port, const uint simulation_v2x_port) { try { // Iniitialize CARMA Simulation UDP Server and Client to foward V2X messages between CARMA simulation @@ -95,13 +95,13 @@ namespace CDASimAdapter{ message_receiver_publisher = std::make_shared( local_ip, 8765); // Initialize UDP Server for listening for incoming CARMA-Simulation time synchronization. PLOG(logDEBUG) << "Creating UDPServer for Time Sync Messages: " << local_ip << ":" << std::to_string(time_sync_port) << "\n" - << "Creating UDPServer for Simulated External Object detection: " << local_ip << ":" << std::to_string(sensor_detected_object_detection_port) << "\n" + << "Creating UDPServer for Simulated External Object detection: " << local_ip << ":" << std::to_string(simulated_interaction_port) << "\n" << "Creating UDPServer for CDA V2X message forwarding: " << local_ip << ":" << std::to_string(v2x_port) << "\n" << "Creating UDPClient for CDA V2X message forwarding: " << simulation_ip << ":" << std::to_string(simulation_v2x_port) << "\n" << "Creating UDPServer for Immediate Forward " << local_ip << ":" << std::to_string(5678) << "\n" << "Creating UDPClient for Message Receiver " << local_ip << ":" << std::to_string(8765) << std::endl; time_sync_listener = std::make_shared(local_ip,time_sync_port); - sensor_detected_object_listener = std::make_shared (local_ip, sensor_detected_object_detection_port); + sensor_detected_object_listener = std::make_shared (local_ip, simulated_interaction_port); } catch (const UdpClientRuntimeError &e) { PLOG(logERROR) << "Encountered UDPClient Runtime error during UDP connection initialization : " << e.what() << std::endl; diff --git a/src/v2i-hub/CDASimAdapter/src/include/CDASimConnection.hpp b/src/v2i-hub/CDASimAdapter/src/include/CDASimConnection.hpp index 99957c6f9..951f02d76 100644 --- a/src/v2i-hub/CDASimAdapter/src/include/CDASimConnection.hpp +++ b/src/v2i-hub/CDASimAdapter/src/include/CDASimConnection.hpp @@ -33,7 +33,7 @@ namespace CDASimAdapter { * @param location Simulationed location of infrastructure. */ explicit CDASimConnection( const std::string &simulation_ip, const std::string &infrastructure_id, const uint simulation_registration_port, - const uint sim_v2x_port, const std::string &local_ip, const uint time_sync_port, const uint sensor_detected_object_detection_port, const uint v2x_port, + const uint sim_v2x_port, const std::string &local_ip, const uint time_sync_port, const uint simulated_interaction_port, const uint v2x_port, const tmx::utils::Point &location); /** * @brief Method to forward v2x message to CARMA Simulation @@ -101,7 +101,7 @@ namespace CDASimAdapter { * @return true if handshake successful and false if handshake unsuccessful. */ bool carma_simulation_handshake(const std::string &simulation_ip, const std::string &infrastructure_id, const uint simulation_registration_port, - const std::string &local_ip, const uint time_sync_port, const uint sensor_detected_object_detection_port, const uint v2x_port, + const std::string &local_ip, const uint time_sync_port, const uint simulated_interaction_port, const uint v2x_port, const tmx::utils::Point &location); /** @@ -113,7 +113,7 @@ namespace CDASimAdapter { * @param simulation_v2x_port port on which CARMA-Simulation is listening for incoming v2x messages. * @return true if setup is successful and false otherwise. */ - bool setup_udp_connection(const std::string &simulation_ip, const std::string &local_ip, const uint time_sync_port, const uint sensor_detected_object_detection_port, + bool setup_udp_connection(const std::string &simulation_ip, const std::string &local_ip, const uint time_sync_port, const uint simulated_interaction_port, const uint v2x_port, const uint simulation_v2x_port); /** * @brief Method to attempt to establish connection between CARMA-Simulation and infrastucture. Returns true if succesful @@ -136,13 +136,13 @@ namespace CDASimAdapter { * @param location simulated location of infrastructure hardware. * @return true if handshake successful and false if handshake unsuccessful. */ - std::string get_handshake_json(const std::string &infrastructure_id, const std::string &local_ip, const uint time_sync_port, const uint sensor_detected_object_detection_port, + std::string get_handshake_json(const std::string &infrastructure_id, const std::string &local_ip, const uint time_sync_port, const uint simulated_interaction_port, const uint v2x_port, const tmx::utils::Point &location) const; std::string _simulation_ip; uint _simulation_registration_port; std::string _infrastructure_id; uint _simulation_v2x_port; - uint _sensor_detected_object_detection_port; + uint _simulated_interaction_port; std::string _local_ip; uint _time_sync_port; uint _v2x_port;