Skip to content

Commit

Permalink
CDAR-756: Carla Ambassador correct detection timestamp (#197)
Browse files Browse the repository at this point in the history
<!-- Thanks for the contribution, this is awesome. -->

# PR Details
## Description
This PR updates incoming CARLA detections, which have Carla time stamps,
to have cdasim time stamps since all components in this system use
cdasim time. This fix is necessary because prior to establishing
connection to cdasim, carla spins for some time, creating a random
static time offset between carla game-time and cda sim simulation time.

**NOTE**: This PR also includes necessary fixes to use java 17 for sonar
scanner CI process
<!--- 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
CDAR-756
<!-- e.g. CAR-123 -->

## Motivation and Context
Gives detection data a simulation time step that should be accurate to
sim time.
<!--- Why is this change required? What problem does it solve? -->

## How Has This Been Tested?
CDASim deployment
<!--- 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: -->

- [x] 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
paulbourelly999 authored Feb 6, 2024
1 parent 6b91fc4 commit 8d50ef9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
- name: Set up JDK 11 (Default) and 17 (Sonar)
uses: actions/setup-java@v3 # The setup-java action provides the functionality for GitHub Actions runners for Downloading and setting up a requested version of Java
with:
java-version: 11
# Last java version is default and set for JAVA_HOME
java-version: |
17
11
distribution: "temurin"
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# TODO Update pom.xml to use java 17 and sonar-maven-plugin
# Build and package application using Java 8
# Run sonar plugin using Java 17
run: |
cd co-simulation
mvn -e -X clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar -Dlicense.skip -Dmaven.test.failure.ignore=false -Pcoverage jacoco:report -Dsonar.projectKey=usdot-fhwa-stol_carma-simulation -Dsonar.projectName=carma-simulation -Dsonar.organization=usdot-fhwa-stol -Dsonar.host.url=https://sonarcloud.io -Dsonar.scanner.force-deprecated-java-version=true
export JAVA_HOME=$JAVA_HOME_11_X64
mvn -e -X clean org.jacoco:jacoco-maven-plugin:prepare-agent package -Dlicense.skip -Dmaven.test.failure.ignore=false -Pcoverage jacoco:report
export JAVA_HOME=$JAVA_HOME_17_X64
mvn sonar:sonar -Dsonar.java.jdkHome=${JAVA_17_X64} -Dsonar.projectKey=usdot-fhwa-stol_carma-simulation -Dsonar.projectName=carma-simulation -Dsonar.organization=usdot-fhwa-stol -Dsonar.host.url=https://sonarcloud.io
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,10 @@ public synchronized void processTimeAdvanceGrant(long time) throws InternalFeder
for (DetectorRegistration registration: registeredDetectors ) {
DetectedObject[] detections = carlaXmlRpcClient.getDetectedObjects( registration.getInfrastructureId() , registration.getDetector().getSensorId());
for (DetectedObject detected: detections) {
detectedObjectInteractions.add(new DetectedObjectInteraction(time, detected));
DetectedObjectInteraction interaction = new DetectedObjectInteraction(time, detected);
// Convert nanosecond timestamp to millisecond timestamp
interaction.getDetectedObject().setTimestamp((int)(time/1e6));
detectedObjectInteractions.add(interaction);
}
}
// trigger all detection interactions
Expand Down
10 changes: 6 additions & 4 deletions co-simulation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,17 @@

<properties>
<java.version>11</java.version>
<!-- Sonar Properties Properties -->

<sonar.organization>usdot-fhwa-stol</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>

<!-- JaCoCo Properties -->
<jacoco.version>0.8.8</jacoco.version>
<sonar.java.jdkHome>${env.JAVA_HOME_17_X64}</sonar.java.jdkHome>
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.coverage.jacoco.xmlReportPaths>${project.basedir}/target/site/jacoco/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
<sonar.language>java</sonar.language>
<sonar.language>java</sonar.language>
<!-- JaCoCo Properties -->
<jacoco.version>0.8.8</jacoco.version>
<mosaic.version>22.1-SNAPSHOT</mosaic.version>
<parent.dir>.</parent.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down

0 comments on commit 8d50ef9

Please sign in to comment.