Skip to content

Commit

Permalink
Merge release/miura (4.6.0) branch into master (#221)
Browse files Browse the repository at this point in the history
<!-- Thanks for the contribution, this is awesome. -->

# PR Details
This PR is to merge release/miura branch into master branch for XIL
Cloud release with new version.
## Description

<!--- Describe your changes in detail -->

## Related GitHub Issue

<!--- This project only accepts pull requests related to open GitHub
issues or Jira Keys -->
<!--- If suggesting a new feature or change, please discuss it in an
issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps
to reproduce -->
<!--- Please DO NOT name partially fixed issues, instead open an issue
specific to this fix -->
<!--- Please link to the issue here: -->

## Related Jira Key

<!-- e.g. CAR-123 -->

## Motivation and Context

<!--- Why is this change required? What problem does it solve? -->

## How Has This Been Tested?

<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [ ] Defect fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that cause existing functionality
to change)

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [ ] I have added any new packages to the sonar-scanner.properties file
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have read the
[**CONTRIBUTING**](https://github.com/usdot-fhwa-stol/carma-platform/blob/develop/Contributing.md)
document.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
  • Loading branch information
SaikrishnaBairamoni authored Aug 15, 2024
2 parents 552256c + 1c1acbb commit b21f662
Show file tree
Hide file tree
Showing 40 changed files with 1,188 additions and 54 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: Docker build
on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
docker:
uses: usdot-fhwa-stol/actions/.github/workflows/docker.yml@main
with:
runner: ubuntu-latest-16-cores
6 changes: 4 additions & 2 deletions .github/workflows/dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Docker Hub build
on:
push:
branches:
- "develop"
- "master"
- develop
- master
- "release/*"
tags:
- "carma-system-*"
Expand All @@ -14,3 +14,5 @@ jobs:
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
with:
runner: ubuntu-latest-16-cores
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
| CI Build Status | Docker Build | Docker Hub Push | Sonar Code Quality |
| Docker Image Build (develop) | Docker Image Build (release) | Sonar Code Quality | Sonar Workflow |
|----------------------|---------------------|---------------------|---------------------|
|[![CI](https://github.com/usdot-fhwa-stol/carma-simulation/actions/workflows/ci.yml/badge.svg)](https://github.com/usdot-fhwa-stol/carma-simulation/actions/workflows/ci.yml) | [![Docker](https://github.com/usdot-fhwa-stol/carma-simulation/actions/workflows/docker.yml/badge.svg)](https://github.com/usdot-fhwa-stol/carma-simulation/actions/workflows/docker.yml) | [![Docker Hub](https://github.com/usdot-fhwa-stol/carma-simulation/actions/workflows/dockerhub.yml/badge.svg)](https://github.com/usdot-fhwa-stol/carma-simulation/actions/workflows/dockerhub.yml) | [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=usdot-fhwa-stol_carma-simulation&metric=alert_status)](https://sonarcloud.io/dashboard?id=usdot-fhwa-stol_carma-simulation)|
|[![Docker Hub build](https://github.com/usdot-fhwa-stol/cdasim/actions/workflows/dockerhub.yml/badge.svg?branch=develop)](https://github.com/usdot-fhwa-stol/cdasim/actions/workflows/dockerhub.yml) | [![Docker Hub build](https://github.com/usdot-fhwa-stol/cdasim/actions/workflows/dockerhub.yml/badge.svg?branch=master)](https://github.com/usdot-fhwa-stol/cdasim/actions/workflows/dockerhub.yml) | [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=usdot-fhwa-stol_carma-simulation&metric=alert_status)](https://sonarcloud.io/dashboard?id=usdot-fhwa-stol_carma-simulation)| [![CI: Run tests](https://github.com/usdot-fhwa-stol/cdasim/actions/workflows/ci.yml/badge.svg)](https://github.com/usdot-fhwa-stol/cdasim/actions/workflows/ci.yml)|
# CARMASimulation
This repository will host the CARMA Everything-in-the-Loop Co-Simulation tool. This XiL simulation platform will support CARLA and SUMO simulation environments as a co-simulation using the MOSAIC framework to facilitate coordination and data exchange. This co-simulation environment will also utilize NS-3 to simulate the communications used by the C-ADS systems.

Expand Down
7 changes: 6 additions & 1 deletion co-simulation/bundle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@
<artifactId>mosaic-infrastructure</artifactId>
<version>${mosaic.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.mosaic</groupId>
<artifactId>mosaic-carma-cloud</artifactId>
<version>${mosaic.version}</version>
</dependency>
<!-- Tutorial Applications -->

<dependency>
Expand Down Expand Up @@ -262,4 +267,4 @@
</build>
</profile>
</profiles>
</project>
</project>
11 changes: 11 additions & 0 deletions co-simulation/bundle/src/assembly/resources/etc/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@
<pattern>%date %-5level %C{0}:%line - %msg%n</pattern>
</encoder>
</appender>
<appender name="CarmaCloudLog" class="ch.qos.logback.core.FileAppender">
<charset>UTF-8</charset>
<file>${logDirectory}/CarmaCloud.log</file>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%date %-5level %C{0}:%line - %msg%n</pattern>
</encoder>
</appender>
<appender name="EnvironmentLog" class="ch.qos.logback.core.FileAppender">
<charset>UTF-8</charset>
<file>${logDirectory}/Environment.log</file>
Expand Down Expand Up @@ -209,6 +216,10 @@
<appender-ref ref="InfrastructureLog"/>
</logger>

<logger name="org.eclipse.mosaic.fed.carmacloud" additivity="false" level="TRACE">
<appender-ref ref="CarmaCloudLog"/>
</logger>

<logger name="org.eclipse.mosaic.fed.output" additivity="false" level="INFO">
<appender-ref ref="MosaicLog"/>
</logger>
Expand Down
14 changes: 14 additions & 0 deletions co-simulation/bundle/src/assembly/resources/etc/runtime.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,20 @@
],
"javaClasspathEntries": []
},
{
"id": "carma-cloud",
"classname": "org.eclipse.mosaic.fed.carmacloud.ambassador.CarmaCloudMessageAmbassador",
"configuration": "carma-cloud_config.json",
"priority": 50,
"host": "local",
"port": 0,
"deploy": false,
"start": false,
"subscriptions": [
"V2xMessageReception"
],
"javaClasspathEntries": []
},

{
"id": "mapping",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"sumo": true,
"carla": true,
"carma": true,
"infrastructure": true
"infrastructure": true,
"carma-cloud": true

}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"updateInterval": 100,
"carlaUE4Path": "/opt/carla/",
"bridgePath": "/opt/carma-simulation/scenarios/Town04_test/carla; bridge.sh",
"bridgePath": "/opt/carma-simulation/scenarios/Town04_carma_cloud/carla; bridge.sh",
"carlaConnectionPort": 8913,
"carlaCDASimAdapterUrl":"http://127.0.0.1:8090/RPC2"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"updateInterval": 100
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"updateInterval": 100
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"sumo": true,
"carla": true,
"carma": true,
"infrastructure": true
"infrastructure": true,
"carma-cloud": true

}
}
105 changes: 105 additions & 0 deletions co-simulation/fed/mosaic-carma-cloud/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.eclipse.mosaic</groupId>
<artifactId>mosaic-parent</artifactId>
<version>22.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

<artifactId>mosaic-carma-cloud</artifactId>
<name>CARMA Cloud Ambassador</name>

<dependencies>
<dependency>
<groupId>org.eclipse.mosaic</groupId>
<artifactId>mosaic-rti-api</artifactId>
<version>${mosaic.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.mosaic</groupId>
<artifactId>mosaic-objects</artifactId>
<version>${mosaic.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.mosaic</groupId>
<artifactId>mosaic-objects</artifactId>
<version>${mosaic.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>gov.dot.fhwa.saxton</groupId>
<artifactId>mosaic-carma-utils</artifactId>
<version>${mosaic.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.mosaic</groupId>
<artifactId>mosaic-interactions</artifactId>
<version>${mosaic.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.mosaic</groupId>
<artifactId>mosaic-utils</artifactId>
<version>${mosaic.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.mosaic</groupId>
<artifactId>mosaic-geomath</artifactId>
<version>${mosaic.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.mosaic</groupId>
<artifactId>mosaic-application</artifactId>
<version>22.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.2</version>
</dependency>
</dependencies>

<profiles>
<profile>
<id>skip-carma-cloud-tests</id>

<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/*
* Copyright (C) 2023 LEIDOS.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.eclipse.mosaic.fed.carmacloud.ambassador;

import java.io.DataOutputStream;
import java.io.IOException;
import java.net.URL;
import java.net.HttpURLConnection;
import com.google.gson.Gson;
import gov.dot.fhwa.saxton.TimeSyncMessage;


/**
* CarmaCloudInstance class represents a physical instance of an
* CARMA Cloud in the simulated environment.
* It contains information about the instance such as its id and target address
*/
public class CarmaCloudInstance
{
// unique simulation identifier for the CARMA Cloud instance
private final String carmaCloudId;
// URL endpoint where to send simulation time sync messages
private final String carmaCloudUrl;


/**
* Constructor for CarmaCloudInstance
*
* @param sId the ID of the CARMA Cloud instance.
* @param sUrl the receive time synchronization message port of the infrastructure.
*/
public CarmaCloudInstance(String sId, String sUrl)
{
carmaCloudId = sId;
carmaCloudUrl = sUrl;
}


/**
* Returns the URL endpoint of the CARMA Cloud instance
*
* @return String URL endpoint of the CARMA Cloud instance
*/
public String getCarmaCloudUrl()
{
return carmaCloudUrl;
}


/**
* Returns the ID of the CARMA Cloud instance
*
* @return String the ID of the CARMA Cloud instance
*/
public String getCarmaCloudId()
{
return carmaCloudId;
}


/**
* Sends time sync data to the CARMA Cloud Instance
*
* @param oMsg the JSON time sync state to transmit
* @throws IOException if there is an issue with the underlying URL connection
*/
public void sendTimeSyncMsg(TimeSyncMessage oMsg)
throws IOException
{
HttpURLConnection oHttp = (HttpURLConnection)new URL(carmaCloudUrl).openConnection();
oHttp.setRequestMethod("POST");
oHttp.setDoOutput(true);
try (DataOutputStream oOut = new DataOutputStream(oHttp.getOutputStream()))
{
oOut.write(new Gson().toJson(oMsg).getBytes());
}
if (oHttp.getResponseCode() != 200)
throw new IOException(String.format("CARMA Cloud failure %d %s", oHttp.getResponseCode(), oHttp.getResponseMessage()));
}
}
Loading

0 comments on commit b21f662

Please sign in to comment.