From 5dfac1bf7392a0e54941feba4b9554540645cf5d Mon Sep 17 00:00:00 2001 From: Saikrishna Bairamoni <84093461+SaikrishnaBairamoni@users.noreply.github.com> Date: Fri, 9 Feb 2024 15:36:53 -0500 Subject: [PATCH 1/9] update config to point lavida images --- .github/workflows/ci.yml | 2 +- .github/workflows/dockerhub.yml | 1 + docker/checkout.sh | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7bd92907..df20bf47 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ on: pull_request: types: [opened, synchronize, reopened] push: - branches: [develop, master] + branches: [develop, master, release/lavida] jobs: sonar: # sonar job is to setup and run sonar scan analysis on telematic cloud messaging code runs-on: ubuntu-latest diff --git a/.github/workflows/dockerhub.yml b/.github/workflows/dockerhub.yml index 172b8064..216b51a9 100644 --- a/.github/workflows/dockerhub.yml +++ b/.github/workflows/dockerhub.yml @@ -5,6 +5,7 @@ on: - "develop" - "master" - "release/*" + - "release/lavida" jobs: dockerhub: diff --git a/docker/checkout.sh b/docker/checkout.sh index ad545521..faae6911 100755 --- a/docker/checkout.sh +++ b/docker/checkout.sh @@ -39,6 +39,6 @@ if [[ "$BRANCH" = "develop" ]]; then git clone https://github.com/usdot-fhwa-stol/carma-msgs.git ~/src/carma-msgs --branch $BRANCH --depth 1 git clone https://github.com/usdot-fhwa-stol/carma-utils.git ~/src/carma-utils --branch $BRANCH --depth 1 else - git clone https://github.com/usdot-fhwa-stol/carma-msgs.git ${dir}/src/carma-msgs --branch develop --depth 1 - git clone https://github.com/usdot-fhwa-stol/carma-utils.git ${dir}/src/carma-utils --branch develop --depth 1 + git clone https://github.com/usdot-fhwa-stol/carma-msgs.git ${dir}/src/carma-msgs --branch release/lavida --depth 1 + git clone https://github.com/usdot-fhwa-stol/carma-utils.git ${dir}/src/carma-utils --branch release/lavida --depth 1 fi From 42c7838ec2960f90bb8ee36cc218f920046fc9e1 Mon Sep 17 00:00:00 2001 From: paulbourelly999 <77466294+paulbourelly999@users.noreply.github.com> Date: Wed, 14 Feb 2024 13:07:50 -0500 Subject: [PATCH 2/9] Fix time sync message updates (#199) # PR Details ## Description This is a duplicate of PR #198 meant to include these changes in our release candidate branch ## Related GitHub Issue ## Related Jira Key CDAR-764 ## Motivation and Context Fix time sync message updates for CARMA Platform ## How Has This Been Tested? CDASim deployment ## Types of changes - [ ] 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: - [ ] 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. - [x] 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. - [x] All new and existing tests passed. --- .../carma/ambassador/CarmaMessageAmbassador.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/co-simulation/fed/mosaic-carma/src/main/java/org/eclipse/mosaic/fed/carma/ambassador/CarmaMessageAmbassador.java b/co-simulation/fed/mosaic-carma/src/main/java/org/eclipse/mosaic/fed/carma/ambassador/CarmaMessageAmbassador.java index b1f86475..eec5c94f 100644 --- a/co-simulation/fed/mosaic-carma/src/main/java/org/eclipse/mosaic/fed/carma/ambassador/CarmaMessageAmbassador.java +++ b/co-simulation/fed/mosaic-carma/src/main/java/org/eclipse/mosaic/fed/carma/ambassador/CarmaMessageAmbassador.java @@ -157,6 +157,7 @@ public synchronized void processTimeAdvanceGrant(long time) throws InternalFeder // simulation time step return; } + log.info("Carma message ambassador processing timestep to {}.", time); try { List newRegistrations = carmaRegistrationReceiver.getReceivedMessages(); @@ -164,25 +165,26 @@ public synchronized void processTimeAdvanceGrant(long time) throws InternalFeder carmaInstanceManager.onNewRegistration(reg); onDsrcRegistrationRequest(reg.getCarlaVehicleRole()); } - - + // Set current simulation time to most recent time update + currentSimulationTime = time; if (currentSimulationTime == 0) { // For the first timestep, clear the message receive queues. v2xMessageReceiver.getReceivedMessages(); // Automatically empties the queues. } else { List> newMessages = v2xMessageReceiver.getReceivedMessages(); for (Tuple msg : newMessages) { - V2xMessageTransmission msgInt = carmaInstanceManager.onV2XMessageTx(msg.getA(), msg.getB(), time); + V2xMessageTransmission msgInt = carmaInstanceManager.onV2XMessageTx(msg.getA(), msg.getB(), currentSimulationTime); SimulationKernel.SimulationKernel.getV2xMessageCache().putItem(currentSimulationTime, msgInt.getMessage()); rti.triggerInteraction(msgInt); } } - - currentSimulationTime += carmaConfiguration.updateInterval * TIME.MILLI_SECOND; - timeSyncSeq += 1; - // Timestep in nano seconds + // Time Syncmessage in nano seconds TimeSyncMessage timeSyncMessage = new TimeSyncMessage(currentSimulationTime, timeSyncSeq); carmaInstanceManager.onTimeStepUpdate(timeSyncMessage); + // Increment time + currentSimulationTime += carmaConfiguration.updateInterval * TIME.MILLI_SECOND; + timeSyncSeq += 1; + rti.requestAdvanceTime(currentSimulationTime, 0, (byte) 2); } catch (IllegalValueException e) { log.error("Error during advanceTime(" + time + ")", e); From 4c37cf473f04aa32e61c76e3db47f6f5b41f0c2e Mon Sep 17 00:00:00 2001 From: Anish_deva <51463994+adev4a@users.noreply.github.com> Date: Mon, 11 Mar 2024 08:54:57 -0400 Subject: [PATCH 3/9] Update carla resource urls (#202) # PR Details Fixes error while building docker image caused by carla resources being moved to a different location. ## Description CARLA install URL is updated to point to new location for resource. ## Related GitHub Issue https://github.com/usdot-fhwa-stol/cdasim/issues/201 ## Related Jira Key ## Motivation and Context ## How Has This Been Tested? Successful image build locally. ## Types of changes - [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: - [ ] 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. - [x] 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. --- docker/install_dependencies.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/install_dependencies.sh b/docker/install_dependencies.sh index 8f7280c4..6866bc82 100755 --- a/docker/install_dependencies.sh +++ b/docker/install_dependencies.sh @@ -61,7 +61,7 @@ CARLA_TAR="CARLA_0.9.10.tar.gz" cd /home/carma/src/ if [[ ! -f "$CARLA_TAR" ]]; then echo "!!! $CARLA_TAR not present in the installation directory, downloading automatically instead. This could take a long time, consider downloading the file manually and placing it in the installation directory. !!!" - wget -q "https://carla-releases.s3.eu-west-3.amazonaws.com/Linux/CARLA_0.9.10.tar.gz" + wget -q "https://carla-releases.s3.us-east-005.backblazeb2.com/Linux/CARLA_0.9.10.tar.gz" fi sudo mkdir -p /opt/carla From 8b719f6bcab74b38028b83fdf719edc3bef5650e Mon Sep 17 00:00:00 2001 From: paulbourelly999 <77466294+paulbourelly999@users.noreply.github.com> Date: Wed, 13 Mar 2024 03:20:36 -0400 Subject: [PATCH 4/9] CDAR-833: Set default Comm Type to DSRC (#204) # PR Details ## Description Change default communication model for Town04 ## Related GitHub Issue ## Related Jira Key CDAR-833 ## Motivation and Context CV2X-Model needs investigation due to introduced communication latency ## How Has This Been Tested? CDASim Deployment ## Types of changes - [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: - [ ] 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. - [x] 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. --- .../resources/scenarios/Town04/ns3/ns3_federate_config.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/co-simulation/bundle/src/assembly/resources/scenarios/Town04/ns3/ns3_federate_config.xml b/co-simulation/bundle/src/assembly/resources/scenarios/Town04/ns3/ns3_federate_config.xml index 20ef28e7..8df04781 100644 --- a/co-simulation/bundle/src/assembly/resources/scenarios/Town04/ns3/ns3_federate_config.xml +++ b/co-simulation/bundle/src/assembly/resources/scenarios/Town04/ns3/ns3_federate_config.xml @@ -2,7 +2,7 @@ - + From 4f25a05278137dd1c7be0ccf6937c5f45abff3c1 Mon Sep 17 00:00:00 2001 From: Misheel Bayartsengel Date: Tue, 19 Mar 2024 17:23:26 -0400 Subject: [PATCH 5/9] Revert 2 PRs related to cv2x (#207) --- .github/workflows/docker.yml | 2 +- .../resources/fed/ns3/ns3_installer.sh | 409 +++++++++--------- .../Barnim/ns3/ns3_federate_config.xml | 9 +- .../Tiergarten/ns3/ns3_federate_config.xml | 37 +- .../Town04/ns3/ns3_federate_config.xml | 43 +- .../Town04_test/ns3/ns3_federate_config.xml | 15 +- docker/install_dependencies.sh | 2 +- 7 files changed, 211 insertions(+), 306 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index c88db096..fe5ecef7 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -5,4 +5,4 @@ on: jobs: docker: - uses: usdot-fhwa-stol/actions/.github/workflows/docker.yml@main \ No newline at end of file + uses: usdot-fhwa-stol/actions/.github/workflows/docker.yml@main diff --git a/co-simulation/bundle/src/assembly/resources/fed/ns3/ns3_installer.sh b/co-simulation/bundle/src/assembly/resources/fed/ns3/ns3_installer.sh index 090664c0..bad64962 100644 --- a/co-simulation/bundle/src/assembly/resources/fed/ns3/ns3_installer.sh +++ b/co-simulation/bundle/src/assembly/resources/fed/ns3/ns3_installer.sh @@ -45,8 +45,8 @@ arg_federate_file="" arg_integration_testing=false arg_make_parallel="" -required_programs=(python3.6 gcc unzip tar) -required_libraries=("libprotobuf-dev (or equal) 3.3.0" "libxml2-dev (or equal)" "libsqlite3-dev (or equal)") +required_programs=( python3.6 gcc unzip tar ) +required_libraries=( "libprotobuf-dev (or equal) 3.3.0" "libxml2-dev (or equal)" "libsqlite3-dev (or equal)" ) ####### configurable parameters ########## ns3_version="3.28" @@ -60,18 +60,17 @@ ns3_version_affix="ns-allinone-$ns3_version" ns3_version_affix_unified="ns-allinone" #deprecated, not used momentarily ns3_short_affix="ns-$ns3_version" ns3_short_affix_unified="ns3" -ns3_deploy_folder="ns3-deployed" #name to be used when ns3 is deployed (i.e. keep only binaries) -working_directory="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +ns3_deploy_folder="ns3-deployed" #name to be used when ns3 is deployed (i.e. keep only binaries) +working_directory="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" federate_path="bin/fed/ns3" ns3_installation_path=${working_directory} -ns3_allinone_folder="${ns3_installation_path}/$ns3_version_affix" -ns3_simulator_folder="${ns3_allinone_folder}/$ns3_short_affix" #due to the ns3 tarball structure +ns3_simulator_folder="${ns3_installation_path}/$ns3_version_affix/$ns3_short_affix" #due to the ns3 tarball structure ns3_scratch="${ns3_simulator_folder}/scratch" +ns3_source="${ns3_simulator_folder}/src" ####### semi automatic parameters ######## -ns3_federate_url="https://github.com/usdot-fhwa-stol/ns3-federate.git" +ns3_federate_url="https://github.com/mosaic-addons/ns3-federate/archive/21.0.zip" ns3_url="http://www.nsnam.org/release/$ns3_version_affix.tar.bz2" -ns3_cv2x="https://github.com/usdot-fhwa-stol/ns-3_c-v2x" ###### more automatic parameters ######### ns3_federate_filename="$(basename "$ns3_federate_url")" @@ -81,66 +80,67 @@ temporary_files="" uninstall_files="license_gplv2.txt run.sh $ns3_short_affix $ns3_version_affix $ns3_short_affix_unified $ns3_version_affix_unified ${ns3_deploy_folder}" print_help() { - log "\nUsage: ns3_installer.sh [options]\n" - log "Options:\n" - log " -s --simulator \t\tThe script will not attempt to download NS3 but use the given argument." - log " -f --federate \tThe script will not attempt to download the federate archive but use the given argument." - log " -q --quiet\t\t\t\tThe script will not give any output but run silently instead." - log " -c --no-clean-on-failure\t\tDo not remove installation files when install fails." - log " -d --no-deploy\t\t\tDo not extract binary data from ns3 (useful for development)." - log " -p --regen-protobuf\ŧ\tRegenerate Protobuf c++ source, when using a different version of protobuf 3." - log " -h --help\t\t\t\tPrint this help" - log " -j --parallel \t\t\tUse n threads for compilation " - log " -u --uninstall Remove the ns-3 federate" - log "\n" + log "\nUsage: ns3_installer.sh [options]\n" + log "Options:\n" + log " -s --simulator \t\tThe script will not attempt to download NS3 but use the given argument." + log " -f --federate \tThe script will not attempt to download the federate archive but use the given argument." + log " -q --quiet\t\t\t\tThe script will not give any output but run silently instead." + log " -c --no-clean-on-failure\t\tDo not remove installation files when install fails." + log " -d --no-deploy\t\t\tDo not extract binary data from ns3 (useful for development)." + log " -p --regen-protobuf\ŧ\tRegenerate Protobuf c++ source, when using a different version of protobuf 3." + log " -h --help\t\t\t\tPrint this help" + log " -j --parallel \t\t\tUse n threads for compilation " + log " -u --uninstall Remove the ns-3 federate" + log "\n" } get_arguments() { - while [[ $# -ge 1 ]]; do + while [[ $# -ge 1 ]] + do key="$1" case $key in - -q | --quiet) - arg_quiet=true - ;; - -u | --uninstall) - arg_uninstall=true - ;; - -c | --no-clean-on-failure) - arg_fail_clean=false - ;; - -d | --no-deploy) - arg_deploy=false - ;; - -p | --gen-protobuf) - arg_regen_protobuf=true - ;; - -f | --federate) - arg_federate_file="$2" - ns3_federate_filename="$2" - shift #past argument - ;; - -s | --simulator) - arg_ns3_file="$2" - ns3_filename="$2" - shift # past argument - ;; - -it | --integration_testing) - arg_integration_testing=true - arg_quiet=true - ;; - -j | --parallel) - arg_make_parallel="-j $2" - shift # past argument - ;; - -h | --help) - arg_quiet=true - print_info - print_help - exit 1 - ;; - esac - shift - done + -q|--quiet) + arg_quiet=true + ;; + -u|--uninstall) + arg_uninstall=true + ;; + -c|--no-clean-on-failure) + arg_fail_clean=false + ;; + -d|--no-deploy) + arg_deploy=false + ;; + -p|--gen-protobuf) + arg_regen_protobuf=true + ;; + -f|--federate) + arg_federate_file="$2" + ns3_federate_filename="$2" + shift #past argument + ;; + -s|--simulator) + arg_ns3_file="$2" + ns3_filename="$2" + shift # past argument + ;; + -it|--integration_testing) + arg_integration_testing=true + arg_quiet=true + ;; + -j|--parallel) + arg_make_parallel="-j $2" + shift # past argument + ;; + -h|--help) + arg_quiet=true + print_info + print_help + exit 1 + ;; + esac + shift + done } #################### Printing functions ################## @@ -156,9 +156,9 @@ warn() { } fail() { - log "${bold}${red}\nERROR: $1\n${restore}" ${*:2} - clean_fail_files - exit 1 + log "${bold}${red}\nERROR: $1\n${restore}" ${*:2} + clean_fail_files + exit 1 } check_uninstall() { @@ -171,9 +171,9 @@ check_uninstall() { } print_usage() { - log "${bold}${cyan}[$(basename "$0")] -- A ns-3 installation script for MOSAIC${restore}" - log "\nUsage: $0 [arguments]" - fail "Argument \""$1"\" not known." + log "${bold}${cyan}[$(basename "$0")] -- A ns-3 installation script for MOSAIC${restore}" + log "\nUsage: $0 [arguments]" + fail "Argument \""$1"\" not known." } print_info() { @@ -195,7 +195,7 @@ print_success() { ################## Checking functions ################# has() { - return $(which $1 >/dev/null) + return $( which $1 >/dev/null ) } check_shell() { @@ -205,17 +205,18 @@ check_shell() { fi } -check_required_programs() { +check_required_programs() +{ for package in $1; do if ! has $package; then - fail ""$package" required, but it's not installed. Please install the package (sudo apt-get install for Ubuntu/Debian) and try again." + fail ""$package" required, but it's not installed. Please install the package (sudo apt-get install for Ubuntu/Debian) and try again."; fi done } check_directory() { cd "$working_directory" - federate_working_directory=$(echo "$working_directory" | rev | cut -c -${#federate_path} | rev) + federate_working_directory=`echo "$working_directory" | rev | cut -c -${#federate_path} | rev` if [ "$federate_working_directory" == "$federate_path" ]; then return else @@ -224,37 +225,37 @@ check_directory() { } check_nslog() { - if [[ ! $NS_LOG =~ .*level.* ]]; then - log "Logging probably not correctly initialized" - fi + if [[ ! $NS_LOG =~ .*level.* ]]; then + log "Logging probably not correctly initialized" + fi } -ask_dependencies() { +ask_dependencies() +{ if $arg_integration_testing || $arg_quiet; then return fi - while [ true ]; do + while [ true ]; do log "Are the following dependencies installed on the system? \n" log "${bold}Libraries:${restore}" for lib in "${required_libraries[@]}"; do - log "${bold}${cyan} $lib ${restore}" + log "${bold}${cyan} $lib ${restore}" done log "\n${bold}Programs:${restore}" for prog in "${required_programs[@]}"; do - log "${bold}${cyan} $prog ${restore}" + log "${bold}${cyan} $prog ${restore}" done printf "\n[y/n] " read answer case $answer in - [Yy]*) break ;; - [Nn]*) - log "\n${red}Please install the required dependencies before proceeding with the installation process${restore}\n" - exit - ;; - *) echo "Allowed choices are yes or no" ;; + [Yy]* ) break;; + [Nn]* ) + log "\n${red}Please install the required dependencies before proceeding with the installation process${restore}\n" + exit;; + * ) echo "Allowed choices are yes or no";; esac - done + done; } ################### Downloading and installing ########## @@ -263,13 +264,13 @@ download() { if [ ! -f "$(basename "$1")" ]; then basen=$(basename "$1") if has wget; then - wget --no-check-certificate -q "$1" || fail "The download URL seems to have changed. File not found: "$1"" + wget --no-check-certificate -q "$1" || fail "The download URL seems to have changed. File not found: "$1""; temporary_files="$temporary_files $basen" elif has curl; then - curl -s -O "$1" || fail "The download URL seems to have changed. File not found: "$1"" + curl -s -O "$1" || fail "The download URL seems to have changed. File not found: "$1""; temporary_files="$temporary_files $basen" else - fail "Can't download "$1"." + fail "Can't download "$1"."; fi else warn "File $(basename "$1") already exists. Skipping download." @@ -283,6 +284,7 @@ download_premake5() { download "$premake5_autoconf_url" } + download_ns3() { if [ ! -z "$arg_ns3_file" ]; then log "NS3 given as argument" @@ -301,25 +303,8 @@ download_federate() { download "$ns3_federate_url" } -clone_ns3_federate(){ - log "Cloning NS3 federate from $ns3_federate_url..." - git clone $ns3_federate_url - - mv ns3-federate federate -} - -clone_ns3_cv2x() { - - if [ ! -d "$ns3_allinone_folder" ]; then - log "Folder $ns3_allinone_folder is not existing" - return - fi - log "Cloning NS3 from $ns3_cv2x..." - git clone $ns3_cv2x - mv ns-3_c-v2x $ns3_version_affix/$ns3_short_affix -} - -extract_ns3() { +extract_ns3() +{ if [ ! -d "$2/ns3_version_affix" ]; then arg1="$1" arg2="$2" @@ -329,116 +314,122 @@ extract_ns3() { fi } -extract_ns3_federate() { - arg1="$1" +extract_ns3_federate() +{ + arg1="$1" - if [ -d "./federate" ]; then - fail "Directory federate in "." already exists." - fi + if [ -d "./federate" ]; then + fail "Directory federate in "." already exists."; + fi - temporary_files="$temporary_files federate" + temporary_files="$temporary_files federate" - unzip --qq -o "$arg1" - # The archive should have contained the folder "ns3-federate-xxx". - # Rename it to "federate": - mv ns3-federate-* federate + unzip --qq -o "$arg1" + # The archive should have contained the folder "ns3-federate-xxx". + # Rename it to "federate": + mv ns3-federate-* federate } extract_premake() { - if [ ! -d "./federate" ]; then - fail "Directory federate doesn't exists." - fi - oldpwd=$(pwd) - cd federate - tar xvf ../$premake5_tar - unzip ../$premake5_autoconf_zip - cp premake-autoconf-master/api.lua . - cp premake-autoconf-master/autoconf.lua . - cp premake-autoconf-master/clang.lua . - cp premake-autoconf-master/gcc.lua . - cp premake-autoconf-master/msc.lua . - rm -fr premake-autoconf-master - cd "$oldpwd" + if [ ! -d "./federate" ]; then + fail "Directory federate doesn't exists." + fi + oldpwd=`pwd` + cd federate + tar xvf ../$premake5_tar + unzip ../$premake5_autoconf_zip + cp premake-autoconf-master/api.lua . + cp premake-autoconf-master/autoconf.lua . + cp premake-autoconf-master/clang.lua . + cp premake-autoconf-master/gcc.lua . + cp premake-autoconf-master/msc.lua . + rm -fr premake-autoconf-master + cd "$oldpwd" } -patch_ns3() { +patch_ns3() +{ ### copy the run file cp -f "./federate/run.sh" "$ns3_installation_path/run.sh" chmod +x "$ns3_installation_path/run.sh" } -build_ns3() { - current_dir=$(pwd) - log "BUILD ns3 version ${ns3_version}" - cd "${ns3_installation_path}/ns-allinone-${ns3_version}/${ns3_short_affix}" - # use waf to configure/build Fabian Eckermann NS-3 C-V2X - python3.6 -x waf configure - python3.6 -x waf build - - sudo cp -ar build/ns3 /usr/include/ - - log "Build ns3-federate" - cd ${current_dir}/federate - mv src/ClientServerChannel.h . - mv src/ClientServerChannel.cc . - if [ -f src/ClientServerChannelMessages.pb.h ]; then - rm src/ClientServerChannelMessages.pb.h - fi - if [ -f src/ClientServerChannelMessages.pb.cc ]; then - rm src/ClientServerChannelMessages.pb.cc - fi - - # adjust build instruction to cover scrambled files - sed -i -e "s|/usr/local|.|" premake5.lua - sed -i -e "s|\"/usr/include\"|\"../ns-allinone-${ns3_version}/ns-${ns3_version}/build\"|" premake5.lua - sed -i -e "s|\"/usr/lib\"|\"../ns-allinone-${ns3_version}/ns-${ns3_version}/build/lib\"|" premake5.lua - if [ "${arg_regen_protobuf}" == "true" ]; then - ./premake5 gmake --generate-protobuf --install - else - ./premake5 gmake --install - fi - - make config=debug clean - make -j1 config=debug # make is running targets in parallel, but we have to build 'prebuild'-target, target, - # and 'postbuild'-target sequentially +build_ns3() +{ + current_dir=`pwd` + log "BUILD ns3 version ${ns3_version}" + cd "${ns3_installation_path}/ns-allinone-${ns3_version}" + + # ns-3 prior to 3.28.1 does not compile without warnings using g++ 10.2.0 + CXXFLAGS="-Wno-error" python3.6 ./build.py --disable-netanim + sudo cp -ar ns-3.28/build/ns3 /usr/include/ + + log "Build ns3-federate" + cd ${current_dir}/federate + mv src/ClientServerChannel.h . + mv src/ClientServerChannel.cc . + if [ -f src/ClientServerChannelMessages.pb.h ]; then + rm src/ClientServerChannelMessages.pb.h + fi + if [ -f src/ClientServerChannelMessages.pb.cc ]; then + rm src/ClientServerChannelMessages.pb.cc + fi + + # adjust build instruction to cover scrambled files + sed -i -e "s|/usr/local|.|" premake5.lua + sed -i -e "s|\"/usr/include\"|\"../ns-allinone-${ns3_version}/ns-${ns3_version}/build\"|" premake5.lua + sed -i -e "s|\"/usr/lib\"|\"../ns-allinone-${ns3_version}/ns-${ns3_version}/build\"|" premake5.lua + if [ "${arg_regen_protobuf}" == "true" ]; then + ./premake5 gmake --generate-protobuf --install + else + ./premake5 gmake --install + fi + make config=debug clean + make -j1 config=debug # make is running targets in parallel, but we have to build 'prebuild'-target, target, + # and 'postbuild'-target sequentially } -deploy_ns3() { - if [ "$arg_deploy" == "true" ]; then - log "Deploying ns3 binaries" - cd "${ns3_installation_path}" +deploy_ns3() +{ + if [ "$arg_deploy" == "true" ]; then + log "Deploying ns3 binaries" + cd "${ns3_installation_path}" - mkdir -p "$ns3_deploy_folder/build/scratch/" + mkdir -p "$ns3_deploy_folder/build/scratch/" - for i in $(find "${ns3_simulator_folder}/build/" -name "*.so"); do - cp "$i" "$ns3_deploy_folder/build/" - done - cp federate/bin/ns3-federate "$ns3_deploy_folder/build/scratch/mosaic_starter" + for i in $(find "${ns3_simulator_folder}/build/" -name "*.so"); do + cp "$i" "$ns3_deploy_folder/build/" + done - mkdir "${ns3_deploy_folder}/scratch" + cp federate/bin/ns3-federate "$ns3_deploy_folder/build/scratch/mosaic_starter" - rm -rf ${ns3_simulator_folder} - mv "${ns3_deploy_folder}" "${ns3_simulator_folder}" + mkdir "${ns3_deploy_folder}/scratch" - fi + rm -rf ${ns3_simulator_folder} + mv "${ns3_deploy_folder}" "${ns3_simulator_folder}" + + fi } -uninstall() { - cd "$working_directory" - warn "Uninstalling all ns-3 files" - rm -rf $uninstall_files +uninstall() +{ + cd "$working_directory" + warn "Uninstalling all ns-3 files" + rm -rf $uninstall_files } -clean_fail_files() { - if [ "$arg_fail_clean" = "true" ]; then - cd "$working_directory" - rm -rf $uninstall_files #2>/dev/null - clean_up - fi +clean_fail_files() +{ + if [ "$arg_fail_clean" = "true" ]; then + cd "$working_directory" + rm -rf $uninstall_files #2>/dev/null + clean_up + fi } -clean_up() { +clean_up() +{ cd "$working_directory" #remove temporary files if wanted @@ -446,28 +437,27 @@ clean_up() { return fi if [ "$arg_integration_testing" = false ]; then - while [ true ]; do + while [ true ]; do log "Do you want to remove the following files and folders? ${bold}${red} $temporary_files ${restore} \n[y/n] " - if $arg_quiet; then + if $arg_quiet; then answer=Y else read answer fi case $answer in - [Yy]*) - rm -rf $temporary_files 2>/dev/null - break - ;; - [Nn]*) break ;; - *) echo "Allowed choices are yes or no" ;; + [Yy]* ) rm -rf $temporary_files 2>/dev/null + break;; + [Nn]* ) break;; + * ) echo "Allowed choices are yes or no";; esac - done + done; fi } + # Workaround for integration testing set_nslog() { - export NS_LOG="'*=level_all|prefix'" + export NS_LOG="'*=level_all|prefix'" } ################## ################# @@ -487,18 +477,17 @@ log "Preparing installation..." check_required_programs "${required_programs[*]}" check_directory -# download_federate - -download_premake5 +download_ns3 -clone_ns3_federate +download_federate -mkdir "${ns3_installation_path}/ns-allinone-${ns3_version}" +download_premake5 -clone_ns3_cv2x +log "Extracting "$ns3_filename"..." +extract_ns3 "$ns3_filename" . -# log "Extracting "$ns3_federate_filename"..." -# extract_ns3_federate "$ns3_federate_filename" +log "Extracting "$ns3_federate_filename"..." +extract_ns3_federate "$ns3_federate_filename" extract_premake diff --git a/co-simulation/bundle/src/assembly/resources/scenarios/Barnim/ns3/ns3_federate_config.xml b/co-simulation/bundle/src/assembly/resources/scenarios/Barnim/ns3/ns3_federate_config.xml index 6cf70119..61332733 100644 --- a/co-simulation/bundle/src/assembly/resources/scenarios/Barnim/ns3/ns3_federate_config.xml +++ b/co-simulation/bundle/src/assembly/resources/scenarios/Barnim/ns3/ns3_federate_config.xml @@ -73,13 +73,8 @@ - - + + diff --git a/co-simulation/bundle/src/assembly/resources/scenarios/Tiergarten/ns3/ns3_federate_config.xml b/co-simulation/bundle/src/assembly/resources/scenarios/Tiergarten/ns3/ns3_federate_config.xml index 33be2e34..6ec8707e 100644 --- a/co-simulation/bundle/src/assembly/resources/scenarios/Tiergarten/ns3/ns3_federate_config.xml +++ b/co-simulation/bundle/src/assembly/resources/scenarios/Tiergarten/ns3/ns3_federate_config.xml @@ -1,11 +1,5 @@ - - - - - - @@ -79,13 +73,8 @@ - - + + @@ -101,26 +90,4 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/co-simulation/bundle/src/assembly/resources/scenarios/Town04/ns3/ns3_federate_config.xml b/co-simulation/bundle/src/assembly/resources/scenarios/Town04/ns3/ns3_federate_config.xml index 8df04781..dc9b8d1d 100644 --- a/co-simulation/bundle/src/assembly/resources/scenarios/Town04/ns3/ns3_federate_config.xml +++ b/co-simulation/bundle/src/assembly/resources/scenarios/Town04/ns3/ns3_federate_config.xml @@ -1,11 +1,5 @@ - - - - - - @@ -18,13 +12,13 @@ - + - + @@ -38,7 +32,7 @@ - + @@ -79,13 +73,8 @@ - - + + @@ -101,26 +90,4 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/co-simulation/bundle/src/assembly/resources/scenarios/Town04_test/ns3/ns3_federate_config.xml b/co-simulation/bundle/src/assembly/resources/scenarios/Town04_test/ns3/ns3_federate_config.xml index 7705603d..61332733 100644 --- a/co-simulation/bundle/src/assembly/resources/scenarios/Town04_test/ns3/ns3_federate_config.xml +++ b/co-simulation/bundle/src/assembly/resources/scenarios/Town04_test/ns3/ns3_federate_config.xml @@ -1,11 +1,5 @@ - - - - - - @@ -80,14 +74,7 @@ - - - + diff --git a/docker/install_dependencies.sh b/docker/install_dependencies.sh index 6866bc82..d48e826d 100755 --- a/docker/install_dependencies.sh +++ b/docker/install_dependencies.sh @@ -32,7 +32,7 @@ sudo apt-get install -y --allow-unauthenticated gcc-7 g++-7 python3.6 unzip tar python3.7-distutils x11-xserver-utils dconf-editor dbus-x11 libglvnd0 libgl1 \ libglx0 libegl1 libxext6 libx11-6 python3-dev \ build-essential pkg-config lbzip2 libprotobuf-dev protobuf-compiler patch rsync \ - wget vim nano xterm libprotobuf-dev git + wget vim nano xterm libprotobuf-dev sudo rm -rf /var/lib/apt/lists/* sudo apt-get clean From 233aaa8328dcca548c5484823096ee01dc9a89b7 Mon Sep 17 00:00:00 2001 From: Misheel Bayartsengel Date: Thu, 21 Mar 2024 13:16:35 -0400 Subject: [PATCH 6/9] Feature/add time sync logs (#205) # PR Details ## Description Adds logs to support https://github.com/usdot-fhwa-stol/carma-analytics-fotda/pull/43 ## Related GitHub Issue ## Related Jira Key CDAR-774 ## Motivation and Context Data Analysis ## How Has This Been Tested? ## Types of changes - [ ] 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: - [ ] 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. --- .../ambassador/AbstractSumoAmbassador.java | 17 ++++++++++ .../rti/time/SequentialTimeManagement.java | 32 +++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/co-simulation/fed/mosaic-sumo/src/main/java/org/eclipse/mosaic/fed/sumo/ambassador/AbstractSumoAmbassador.java b/co-simulation/fed/mosaic-sumo/src/main/java/org/eclipse/mosaic/fed/sumo/ambassador/AbstractSumoAmbassador.java index 56641010..b9e20b9d 100644 --- a/co-simulation/fed/mosaic-sumo/src/main/java/org/eclipse/mosaic/fed/sumo/ambassador/AbstractSumoAmbassador.java +++ b/co-simulation/fed/mosaic-sumo/src/main/java/org/eclipse/mosaic/fed/sumo/ambassador/AbstractSumoAmbassador.java @@ -206,6 +206,12 @@ public abstract class AbstractSumoAmbassador extends AbstractFederateAmbassador */ protected boolean receivedSimulationStep = false; + /** + * First time when the sumo ambassador is called to progress to the next simulation step + * + */ + protected boolean firstAttemptToAdvanceToNextStep = true; + /** * CARLA federate is enabled */ @@ -1193,6 +1199,16 @@ public synchronized void processTimeAdvanceGrant(long time) throws InternalFeder return; } + // A script to validate time synchronization of tools in CDASim currently relies on the following + // log line. TODO: This line is meant to be removed in the future upon completion of this work: + // https://github.com/usdot-fhwa-stol/carma-analytics-fotda/pull/43 + if (log.isDebugEnabled() && (!receivedSimulationStep && firstAttemptToAdvanceToNextStep)) + { + long millis = System.currentTimeMillis(); + log.info("Simulation Time: {} here current system time is: {} and nextTimeStep: {} and ambasador id: {}", (int) (time/1e6), millis, nextTimeStep, getId()); + firstAttemptToAdvanceToNextStep = false; + } + if (time > lastAdvanceTime) { // actually add vehicles in sumo, before we reach the next advance time flushNotYetAddedVehicles(lastAdvanceTime); @@ -1229,6 +1245,7 @@ public synchronized void processTimeAdvanceGrant(long time) throws InternalFeder rti.triggerInteraction(simulationStepResult.getTrafficDetectorUpdates()); this.rti.triggerInteraction(simulationStepResult.getTrafficLightUpdates()); receivedSimulationStep = false; + firstAttemptToAdvanceToNextStep = true; } // System.out.println("Sumo request time advance at time: " + nextTimeStep); diff --git a/co-simulation/rti/mosaic-rti-core/src/main/java/org/eclipse/mosaic/rti/time/SequentialTimeManagement.java b/co-simulation/rti/mosaic-rti-core/src/main/java/org/eclipse/mosaic/rti/time/SequentialTimeManagement.java index a1a4df13..b76ab207 100644 --- a/co-simulation/rti/mosaic-rti-core/src/main/java/org/eclipse/mosaic/rti/time/SequentialTimeManagement.java +++ b/co-simulation/rti/mosaic-rti-core/src/main/java/org/eclipse/mosaic/rti/time/SequentialTimeManagement.java @@ -15,6 +15,9 @@ package org.eclipse.mosaic.rti.time; +import java.util.HashMap; +import java.util.Map; + import org.eclipse.mosaic.rti.MosaicComponentParameters; import org.eclipse.mosaic.rti.api.ComponentProvider; import org.eclipse.mosaic.rti.api.FederateAmbassador; @@ -31,6 +34,26 @@ public class SequentialTimeManagement extends AbstractTimeManagement { private final int realtimeBrake; + // Debugging & Logging + HashMap loggingMap = new HashMap<>(); + + /** + * Prints log for time synchronization monitor script. Only meant to be printed for debugging purposes. + * Please see https://github.com/usdot-fhwa-stol/carma-analytics-fotda/pull/43 + * + * @param event FederateEvent requested by one of the ambassadaor + * @param startTime current system time when the event request was received + */ + + private void printTimeSyncDebugLogs(FederateEvent event, long startTime){ + if (!loggingMap.containsKey(event.getFederateId()) || + (loggingMap.containsKey(event.getFederateId()) && loggingMap.get(event.getFederateId()) != event.getRequestedTime())) + { + loggingMap.put(event.getFederateId(), event.getRequestedTime()); + this.logger.debug("Simulation Time: {} where current system time is: {} and requested from id: {}", (int) (event.getRequestedTime()/1e6), startTime, event.getFederateId()); + } + } + /** * Creates a new instance of the sequential time management. * @@ -87,6 +110,15 @@ public void runSimulation() throws InternalFederateException, IllegalValueExcept if (ambassador != null) { federation.getMonitor().onBeginActivity(event); long startTime = System.currentTimeMillis(); + + // A script to validate time synchronization of tools in CDASim currently relies on the following + // log line. TODO: This line is meant to be removed in the future upon completion of this work: + // https://github.com/usdot-fhwa-stol/carma-analytics-fotda/pull/43 + if (this.logger.isDebugEnabled()) + { + printTimeSyncDebugLogs(event, startTime); + } + ambassador.advanceTime(event.getRequestedTime()); federation.getMonitor().onEndActivity(event, System.currentTimeMillis() - startTime); From a190c2a661d86554356fe17ec7ea977909407df8 Mon Sep 17 00:00:00 2001 From: Misheel Bayartsengel Date: Wed, 27 Mar 2024 16:30:50 -0400 Subject: [PATCH 7/9] Remove debug flag requirement for time sync script log for sumo (#210) --- .../mosaic/fed/sumo/ambassador/AbstractSumoAmbassador.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/co-simulation/fed/mosaic-sumo/src/main/java/org/eclipse/mosaic/fed/sumo/ambassador/AbstractSumoAmbassador.java b/co-simulation/fed/mosaic-sumo/src/main/java/org/eclipse/mosaic/fed/sumo/ambassador/AbstractSumoAmbassador.java index b9e20b9d..040d2ab7 100644 --- a/co-simulation/fed/mosaic-sumo/src/main/java/org/eclipse/mosaic/fed/sumo/ambassador/AbstractSumoAmbassador.java +++ b/co-simulation/fed/mosaic-sumo/src/main/java/org/eclipse/mosaic/fed/sumo/ambassador/AbstractSumoAmbassador.java @@ -1202,10 +1202,10 @@ public synchronized void processTimeAdvanceGrant(long time) throws InternalFeder // A script to validate time synchronization of tools in CDASim currently relies on the following // log line. TODO: This line is meant to be removed in the future upon completion of this work: // https://github.com/usdot-fhwa-stol/carma-analytics-fotda/pull/43 - if (log.isDebugEnabled() && (!receivedSimulationStep && firstAttemptToAdvanceToNextStep)) + if (!receivedSimulationStep && firstAttemptToAdvanceToNextStep) { long millis = System.currentTimeMillis(); - log.info("Simulation Time: {} here current system time is: {} and nextTimeStep: {} and ambasador id: {}", (int) (time/1e6), millis, nextTimeStep, getId()); + log.info("Simulation Time: {} where current system time is: {} and nextTimeStep: {} and ambasador id: {}", (int) (time/1e6), millis, nextTimeStep, getId()); firstAttemptToAdvanceToNextStep = false; } From 24bc8cec2803d9683c1640309dcf3b8b75819b33 Mon Sep 17 00:00:00 2001 From: paulbourelly999 <77466294+paulbourelly999@users.noreply.github.com> Date: Wed, 10 Apr 2024 22:29:21 -0400 Subject: [PATCH 8/9] Fix CI workflows for release and remove lavida references (#214) # PR Details ## Description ## Related GitHub Issue ## Related Jira Key ## Motivation and Context ## How Has This Been Tested? ## Types of changes - [ ] 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: - [ ] 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. --- .github/workflows/ci.yml | 5 ++++- .github/workflows/dockerhub.yml | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df20bf47..a3a13c0e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,10 @@ on: pull_request: types: [opened, synchronize, reopened] push: - branches: [develop, master, release/lavida] + branches: + - develop + - master + - "release/*" jobs: sonar: # sonar job is to setup and run sonar scan analysis on telematic cloud messaging code runs-on: ubuntu-latest diff --git a/.github/workflows/dockerhub.yml b/.github/workflows/dockerhub.yml index 216b51a9..abdd8134 100644 --- a/.github/workflows/dockerhub.yml +++ b/.github/workflows/dockerhub.yml @@ -5,7 +5,8 @@ on: - "develop" - "master" - "release/*" - - "release/lavida" + tags: + - "carma-system-*" jobs: dockerhub: From 5e71278dfb28894a3b8af9fe3ff0c3d98dc00215 Mon Sep 17 00:00:00 2001 From: paulbourelly999 <77466294+paulbourelly999@users.noreply.github.com> Date: Thu, 11 Apr 2024 10:44:09 -0400 Subject: [PATCH 9/9] Fix checkout versions to 4.5.0 (#215) # PR Details ## Description ## Related GitHub Issue ## Related Jira Key ## Motivation and Context ## How Has This Been Tested? ## Types of changes - [ ] 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: - [ ] 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. --- docker/checkout.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/checkout.sh b/docker/checkout.sh index faae6911..06391349 100755 --- a/docker/checkout.sh +++ b/docker/checkout.sh @@ -39,6 +39,6 @@ if [[ "$BRANCH" = "develop" ]]; then git clone https://github.com/usdot-fhwa-stol/carma-msgs.git ~/src/carma-msgs --branch $BRANCH --depth 1 git clone https://github.com/usdot-fhwa-stol/carma-utils.git ~/src/carma-utils --branch $BRANCH --depth 1 else - git clone https://github.com/usdot-fhwa-stol/carma-msgs.git ${dir}/src/carma-msgs --branch release/lavida --depth 1 - git clone https://github.com/usdot-fhwa-stol/carma-utils.git ${dir}/src/carma-utils --branch release/lavida --depth 1 + git clone https://github.com/usdot-fhwa-stol/carma-msgs.git ${dir}/src/carma-msgs --branch carma-system-4.5.0 --depth 1 + git clone https://github.com/usdot-fhwa-stol/carma-utils.git ${dir}/src/carma-utils --branch carma-system-4.5.0 --depth 1 fi