Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/time source #60

Closed
wants to merge 71 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
22f8275
Created CARMA Cloud time source and simulation federate
kruegersp Feb 15, 2024
160e8d5
Added SimFederal servlet configuration
kruegersp Feb 15, 2024
aa24677
Updated SimFederate to test ambassador address.
kruegersp Feb 15, 2024
870f189
Update SimFederate import InetAdress.
kruegersp Feb 15, 2024
711109a
Fixed SimFederate registration JSON message.
kruegersp Feb 15, 2024
4a01acf
Update Dockerfile with simulation configuration.
kruegersp Feb 16, 2024
b1eccdd
Update rsu.js
kruegersp Feb 29, 2024
ce6e7ee
Update map.js
kruegersp Feb 29, 2024
02370bc
Update Dockerfile
kruegersp Feb 29, 2024
fb35e0d
Update ihp.js
kruegersp Feb 29, 2024
d90013a
SimFederate separated registration retry from socket close
kruegersp Mar 1, 2024
3d1b9dc
Update web.xml
kruegersp Mar 1, 2024
6eb30bb
Update Dockerfile
kruegersp Mar 11, 2024
7417127
Update Dockerfile
kruegersp Mar 11, 2024
d0d763d
Update SimFederate.java
kruegersp Mar 26, 2024
9d5cbff
Update RoadMark.java
kruegersp Mar 27, 2024
9fb6b5a
Update satellite-streets-v11.json
kruegersp Mar 28, 2024
6f4a1f7
Update sourcelayers.json
kruegersp Mar 28, 2024
f62d820
Update validatexodr_sourcelayers.json
kruegersp Mar 28, 2024
d500a6d
Removed commented-out RSM Servlet.
kruegersp Apr 2, 2024
c4b8f06
Default traffic control update and start time to 0L.
kruegersp Apr 2, 2024
e92f7f5
Added port and list attribute parsing to old TCR format.
kruegersp Apr 2, 2024
f9f5697
Updated TcmReqServlet to preserve request host address.
kruegersp Apr 3, 2024
d2579c8
Added error log to TCM response connection.
kruegersp Apr 8, 2024
7b1f836
Add docker and dockerhub workflows
paulbourelly999 May 7, 2024
ced9ff0
Build and push image for testing
paulbourelly999 May 7, 2024
2937c05
Update web.xml init TimeSource singleton first and added CARMA Cloud …
kruegersp May 15, 2024
0170b5d
Delete lib/libcs2cswrapper.so
kruegersp May 15, 2024
60633c8
Added CARMA Cloud simulation id configuration item and handle excepti…
kruegersp May 15, 2024
de2170a
Use TimeSource to handle simulation and real world time, remove extra…
kruegersp May 15, 2024
79c3315
Update TcmReqServlet to use TimeSource
kruegersp May 15, 2024
de7fd12
Update web.xml to add explicit simulation mode logical flag
kruegersp May 15, 2024
6616549
Update SimFederate to check for explicit simulation mode configuration
kruegersp May 15, 2024
8d2d5e3
Update SimFederate to use JSON libary for building ambassador registr…
kruegersp May 15, 2024
a2c1965
Update SimFederate fixed sid typo
kruegersp May 15, 2024
3e09834
Update dockerfile and move instructions to scripts
paulbourelly999 May 16, 2024
4778fe4
Install GIT for checkout
paulbourelly999 May 16, 2024
8a65604
Fix build/install scripts issues
paulbourelly999 May 16, 2024
5103d16
Figure out CI VM path
paulbourelly999 May 16, 2024
c788b25
Fix path error
paulbourelly999 May 16, 2024
74148ef
Remove rm calls in build script
paulbourelly999 May 16, 2024
4f464dc
Update to build scripts
paulbourelly999 May 16, 2024
1f8235d
Print commands in scripts and their arguments as exexuted
paulbourelly999 May 16, 2024
1acae3c
Update
paulbourelly999 May 16, 2024
713fe56
Updates to fix carma-cloud path to absolute /home/carma-cloud inside …
paulbourelly999 May 16, 2024
340fee9
Update path for workflow
paulbourelly999 May 16, 2024
8e28d16
Fix issues
paulbourelly999 May 16, 2024
32b442a
Updates
paulbourelly999 May 16, 2024
d9a47fa
Updates
paulbourelly999 May 16, 2024
b91b142
Updates
paulbourelly999 May 16, 2024
b48a1c4
Update
paulbourelly999 May 16, 2024
2759f50
Updates
paulbourelly999 May 17, 2024
6de48c0
Removing circle ci workflow that was replaced with github action
paulbourelly999 May 17, 2024
792f9f5
Update with docker-compose file, testing script and volume directory
paulbourelly999 May 17, 2024
311cf83
add carma-cloud-config work folder
EricChen-Lei May 20, 2024
81cf059
Update install_dependencies.sh
kruegersp May 21, 2024
c350996
Update build.sh
kruegersp May 21, 2024
9c09200
Update deployment_test.yml
kruegersp May 21, 2024
6a4dd17
Update map.js
kruegersp May 21, 2024
f5024cc
Update ihp.js
kruegersp May 21, 2024
953d2f5
Update rsu.js
kruegersp May 21, 2024
fb53afe
Revert "add carma-cloud-config work folder"
EricChen-Lei May 22, 2024
599eb98
Update build.sh to modify default host path
kruegersp May 22, 2024
c56b8e1
Delete carma-cloud-config/server.xml
kruegersp May 22, 2024
e03b854
Create web.xml for simulation
kruegersp May 22, 2024
2750614
Update web.xml to adjust SimFederate load on startup order
kruegersp May 22, 2024
0b1edd1
Remove trigger for building feature/time-source docker image
paulbourelly999 May 28, 2024
a482812
Add FilterControls utility that reduces traffic control count for tes…
kruegersp Jun 13, 2024
365b522
Update README with FilterControls utility usage.
kruegersp Jun 13, 2024
a806795
Update README FilterControls code formatting
kruegersp Jun 13, 2024
c6eae55
Update README.md
kruegersp Jun 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 0 additions & 70 deletions .circleci/config.yml

This file was deleted.

59 changes: 59 additions & 0 deletions .github/workflows/deployment_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
on:
push:
branches:
- develop
- master
- "release/*"
pull_request:
types: [opened, synchronize, reopened]
name: Deployment Test
jobs:
deployment_test:
runs-on: ubuntu-latest
container:
image: ubuntu:22.04
defaults:
run:
shell: bash
steps:
- name: Install git
# Installing git for checkout action
run: |
apt update
export DEBIAN_FRONTEND=noninteractive
apt-get install -y git
- name: Checkout
uses: actions/checkout@v4
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
path: ${{ github.event.repository.name }}
submodules: recursive
- name: Move source code
run: mv $GITHUB_WORKSPACE/${{ github.event.repository.name }} /home/carma-cloud
- name: Install dependencies
run: |
cd /home/carma-cloud/scripts
./install_dependencies.sh
- name: Build
run: |
cd /home/carma-cloud/scripts
./build.sh
- name: Configure network and set privileges
run: |
echo -e '127.0.0.1\tcarmacloud' | tee -a /etc/hosts
groupadd tomcat
useradd -g tomcat -m tomcat
chmod g+r /opt/tomcat/conf/*
chmod -R o-rwx /opt/tomcat/webapps/*
chown -R root:tomcat /opt/tomcat
chown -R tomcat:tomcat /opt/tomcat/logs
chown -R tomcat:tomcat /opt/tomcat/temp
chown -R tomcat:tomcat /opt/tomcat/work
- name: Start Tomcat and verify deployment
run: |
/opt/tomcat/bin/catalina.sh start
sleep 10
if [[ `grep "startup in" /opt/tomcat/logs/catalina.out | wc -l` -ne "1" ]]; then exit 1; fi
if [[ `wget -O - http://carmacloud:8080 | grep "CARMAcloud Login" | wc -l` -ne "1" ]]; then exit 2; fi
if [[ `wget -O - --post-data="uname=ccadmin&pword=admin_testpw" http://carmacloud:8080/api/auth/login | grep "token" | wc -l` -ne "1" ]]; then exit 3; fi
9 changes: 9 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
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
17 changes: 17 additions & 0 deletions .github/workflows/dockerhub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Docker Hub build
on:
push:
branches:
- develop
- master
- "release/*"
tags:
- "carma-system-*"
jobs:
dockerhub:
uses: usdot-fhwa-stol/actions/.github/workflows/dockerhub.yml@main
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
with:
runner: ubuntu-latest
60 changes: 12 additions & 48 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,51 +1,15 @@
FROM ubuntu:22.04
# update package manager and install prerequisites
RUN apt-get update -y && \
apt-get install -y build-essential cmake git wget pkg-config sqlite3 libcurl4-openssl-dev libsqlite3-dev libtiff5-dev
# download geodesy projection library source
WORKDIR /tmp
RUN wget -q https://download.osgeo.org/proj/proj-9.3.0.tar.gz && \
tar -xzf proj-9.3.0.tar.gz && \
rm proj-9.3.0.tar.gz && \
mv proj-9.3.0 proj && \
mkdir -p proj/build
# download openjdk
RUN wget -q https://download.java.net/java/GA/jdk21.0.1/415e3f918a1f4062a0074a2794853d0d/12/GPL/openjdk-21.0.1_linux-x64_bin.tar.gz && \
tar -xzf openjdk-21.0.1_linux-x64_bin.tar.gz && \
rm openjdk-21.0.1_linux-x64_bin.tar.gz && \
mv jdk-21.0.1 /opt/jdk
# download apache tomcat
RUN wget -q https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.83/bin/apache-tomcat-9.0.83.tar.gz && \
tar -xzf apache-tomcat-9.0.83.tar.gz && \
rm apache-tomcat-9.0.83.tar.gz && \
mv apache-tomcat-9.0.83 tomcat && \
sed -i 's/appBase="webapps"/appBase="webapps\/carmacloud"/g' tomcat/conf/server.xml && \
rm -r tomcat/webapps/*
COPY scripts/install_dependencies.sh /home/carma-cloud/scripts/install_dependencies.sh
RUN /home/carma-cloud/scripts/install_dependencies.sh
COPY src /home/carma-cloud/src
COPY lib /home/carma-cloud/lib
COPY web /home/carma-cloud/web
COPY osmbin /home/carma-cloud/osmbin
COPY *.sh /home/carma-cloud/
COPY scripts/build.sh /home/carma-cloud/scripts/build.sh

# download carma-cloud source
RUN git clone https://github.com/usdot-fhwa-stol/carma-cloud.git cc && \
rm cc/lib/libcs2cswrapper.so && \
mkdir -p tomcat/webapps/carmacloud/ROOT && \
mv cc/web/* tomcat/webapps/carmacloud/ROOT
# compile geodesy projection library
WORKDIR /tmp/proj/build
RUN cmake .. && \
cmake --build . && \
cmake --build . --target install
# compile jni projection library
WORKDIR /tmp/cc/src/cc/geosrv
RUN gcc -c -std=c11 -fPIC -Wall -I /opt/jdk/include/ -I /opt/jdk/include/linux/ -I /tmp/proj/src/ cs2cswrapper.c && \
gcc -shared -lproj cs2cswrapper.o -o libcs2cswrapper.so && \
mv *.so /usr/lib
# compile carma-cloud java source and cleanup
WORKDIR /tmp
RUN find ./cc/src -name "*.java" > sources.txt && \
mkdir -p tomcat/webapps/carmacloud/ROOT/WEB-INF/classes && \
/opt/jdk/bin/javac -cp tomcat/lib/servlet-api.jar:cc/lib/commons-compress-1.18.jar:cc/lib/javax.json.jar:cc/lib/json-20210307.jar:cc/lib/keccakj.jar:cc/lib/log4j-api-2.16.0.jar:cc/lib/vector_tile.jar -d tomcat/webapps/carmacloud$
rm sources.txt && \
/opt/jdk/bin/java -cp tomcat/webapps/carmacloud/ROOT/WEB-INF/classes/:tomcat/lib/servlet-api.jar cc.ws.UserMgr ccadmin admin_testpw > tomcat/webapps/carmacloud/user.csv && \
echo "JAVA_HOME=/opt/jdk" > tomcat/bin/setenv.sh && \
mv tomcat /opt && \
rm -r proj && \
rm -r cc
# start carma-cloud
CMD /opt/tomcat/bin/catalina.sh start
RUN /home/carma-cloud/scripts/build.sh
ENTRYPOINT [ "/opt/tomcat/bin/catalina.sh", "run" ]

16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,22 @@ Example:
> x<sub>(n-2)</sub><sub>0</sub>,y<sub>(n-2)</sub><sub>0</sub>,x<sub>(n-2)</sub><sub>1</sub>,y<sub>(n-2)</sub><sub>1</sub>,x<sub>(n-2)</sub><sub>2</sub>,y<sub>(n-2)</sub><sub>2</sub>,x<sub>(n-2)</sub><sub>3</sub>,y<sub>(n-2)</sub><sub>3</sub>
> x<sub>(n-1)</sub><sub>0</sub>,y<sub>(n-1)</sub><sub>0</sub>,x<sub>(n-1)</sub><sub>1</sub>,y<sub>(n-1)</sub><sub>1</sub>,x<sub>(n-1)</sub><sub>2</sub>,y<sub>(n-1)</sub><sub>2</sub>,x<sub>(n-1)</sub><sub>3</sub>,y<sub>(n-1)</sub><sub>3</sub>

## Testing Considerations

Upon startup, CARMA Cloud automatically creates traffic controls for later sending to CARMA platform by reading XML OpenDrive files placed in its XODR work folder, e.g. <tomcat_home>/work/xodr. This can result in thousands of traffic controls that are mostly uninteresting for testing purposes. The cc.util.FilterControls command-line application accepts a list of traffic control identifiers, and creates a much smaller and more manageable subset of traffic controls that can be saved along with their respective teting scenarios.

After CARMA Cloud has been started for the first time in a testing scenario, XODR files will have been processed, and the tester can login to CARMA Cloud to add traffic controls for his testing needs. Executing an ls -lrt in the traffic controls folder, typically <tomcat_home>/work/carmacloud/traf_ctrls, will put the newly created traffic controls at the bottom of the list. The hexadecimal encoded text for the 16-byte traffic control ids to be kept can then be derived from three levels of folder paths and the traffic control filename.

The FilterControls application takes the source work folder name, the destination work folder name, and a space-separated list of at least one 16-byte hexadecimal encoded text traffic control id.
```
<java_home>/bin/java -cp <path_to_carmacloud_classes>:<path_to_carmacloud_lib>/keccakj.jar cc.util.FilterControls <source_path> <destination_path> <id1> <id2> ... <idN>
```
For example:
```
<java_home>/bin/java -cp <path_to_carmacloud_classes>:<path_to_carmacloud_lib>/keccakj.jar cc.util.FilterControls <tomcat_home>/work/carmacloud <tomcat_home>/work/filtered 00109ab6d542f12ca8942b436c9c9d8d
```
FilterControls creates the destination folder structure containing geolanes, linearcs, td, and traf_ctrls subfolders. The filtered traffic control files can then be saved with the appropriate testing scenarios. Both the td and traf_ctrls folders should always contain at least one file, and it is also normal under some circumstances that the geolanes and linearcs folders may contain no files.

## Contribution
Welcome to the CARMA contributing guide. Please read this guide to learn about our development process, how to propose pull requests and improvements, and how to build and test your changes to this project. [CARMA Contributing Guide](Contributing.md)

Expand Down
18 changes: 18 additions & 0 deletions SendTimeSyncMessage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import http.client
import json
import requests

connection = http.client.HTTPConnection("localhost:8080")
# headers = {'Content-type': 'application/json'}
foo = {'timestep': 100, 'seq': 1}

connection.request("POST", "/carmacloud/simulation/dumb", json.dumps(foo))
x = requests.post("http://127.0.0.1:8080/carmacloud/simulation/dumb", json.dumps(foo))
print(x)

response = connection.getresponse()
print(response.read().decode())

connection.request("GET", '/api/rop/details')
response = connection.getresponse()
print(response.read().decode())
18 changes: 18 additions & 0 deletions carma-cloud-config/log4j2.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
status = warn
monitorInterval = 300

appender.rolling.type = RollingFile
appender.rolling.name = LogToRollingFile
appender.rolling.fileName = /opt/tomcat/logs/carmacloud.log
appender.rolling.filePattern = /opt/tomcat/logs/carmacloud-%d{yyyyMMdd}.log.gz
appender.rolling.layout.type = PatternLayout
appender.rolling.layout.pattern = [%-5level %d{HH:mm:ss.SSS} [%c{1}] - %msg%n
appender.rolling.policies.type = Policies
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling.policies.time.interval = 1
appender.rolling.policies.time.modulate = false
appender.rolling.strategy.type = DefaultRolloverStrategy
appender.rolling.strategy.max = 366

rootLogger.level = debug
rootLogger.appenderRef.stdout.ref = LogToRollingFile
Loading