Skip to content

Commit

Permalink
Merge release/omega (7.8.1) branch into master (#642)
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/omega branch into master branch for C1t
release with new version.
## Description

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

## Related Issue

<!--- This project only accepts pull requests related to open issues -->
<!--- 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 link to the issue here: -->

## 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** document.
[V2XHUB Contributing
Guide](https://github.com/usdot-fhwa-OPS/V2X-Hub/blob/develop/Contributing.md)
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
  • Loading branch information
SaikrishnaBairamoni authored Sep 11, 2024
2 parents b8f4392 + 1eac9d7 commit 72d48e4
Show file tree
Hide file tree
Showing 74 changed files with 2,445 additions and 15,291 deletions.
6 changes: 5 additions & 1 deletion .sonarqube/sonar-scanner.properties
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,16 @@ sonar.modules= PedestrianPlugin, \
CDASimAdapter, \
RSUHealthMonitorPlugin, \
TelematicBridgePlugin, \
MUSTSensorDriverPlugin
MUSTSensorDriverPlugin, \
Messages



TmxCore.sonar.projectBaseDir =src/tmx/TmxCore
TmxCtl.sonar.projectBaseDir =src/tmx/TmxCtl
TmxTools.sonar.projectBaseDir =src/tmx/TmxTools
TmxUtils.sonar.projectBaseDir =src/tmx/TmxUtils
Messages.sonar.projectBaseDir =src/tmx/Messages
CARMACloudPlugin.sonar.projectBaseDir =src/v2i-hub/CARMACloudPlugin
CommandPlugin.sonar.projectBaseDir =src/v2i-hub/CommandPlugin
CswPlugin.sonar.projectBaseDir =src/v2i-hub/CswPlugin
Expand Down Expand Up @@ -97,6 +99,7 @@ TmxCore.sonar.sources =src
TmxCtl.sonar.sources =src
TmxTools.sonar.sources =src
TmxUtils.sonar.sources =src
Messages.sonar.sources =include
TmxUtils.sonar.exclusions =test/**
MessageLoggerPlugin.sonar.sources =src
CswPlugin.sonar.sources =src
Expand Down Expand Up @@ -132,6 +135,7 @@ MUSTSensorDriverPlugin.sonar.sources =src
# Tests
# Note: For C++ setting this field does not cause test analysis to occur. It only allows the test source code to be evaluated.
TmxUtils.sonar.tests=test
Messages.sonar.tests=test
#TmxCore.sonar.tests=test
#TmxCtl.sonar.tests=test
#TmxTools.sonar.tests=test
Expand Down
7 changes: 7 additions & 0 deletions configuration/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ services:
volumes:
- ./mysql/localhost.sql:/docker-entrypoint-initdb.d/localhost.sql
- ./mysql/port_drayage.sql:/docker-entrypoint-initdb.d/port_drayage.sql
# The following 3 volumes are used for C1T. By default the standard "port_drayage.sql" file
# will be loaded. Comment out the "port_drayage.sql" file above and uncomment the following
# three files to enable the C1T sql files to be loaded. The container volumes MUST be reset
# to allow for this change, which can be done with "docker compose down -v"
#- ./mysql/garage_port_drayage/port_drayage.sql:/docker-entrypoint-initdb.d/port_drayage.sql
#- ./mysql/garage_port_drayage/port_drayage_lane1.sql:/docker-entrypoint-initdb.d/port_drayage_lane1.sql
#- ./mysql/garage_port_drayage/port_drayage_lane2.sql:/docker-entrypoint-initdb.d/port_drayage_lane2.sql
- mysql-datavolume:/var/lib/mysql

php:
Expand Down
9 changes: 5 additions & 4 deletions configuration/initialization.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@ latest_version=$(echo "$release_info" | grep -o '"tag_name": *"[^"]*"' | cut -d
# Fetching all tags from Git repository
tags=$(git ls-remote --tags https://github.com/usdot-fhwa-OPS/V2X-Hub.git | awk -F/ '{print $3}' | sort -V)

# Remove curly braces, Properties found, and duplicate entries
updated_tags=$(echo "$tags" | sed 's/\^{}//' | grep -v '^Properties_Found$' | awk '!seen[$0]++')
# Remove curly braces, Properties found, duplicate entries, and show only versions above 7.0
updated_tags=$(echo "$tags" | sed 's/\^{}//;s/^v//' | grep -v '^Properties_Found$' | awk '!seen[$0]++ && $1 >= "7.0"')

# Displaying all available versions
echo "Note: V2X-Hub multi architecture deployments only work for the versions 7.0 and above."
echo "Available versions:"
echo "$updated_tags"

# select a version or accept the latest version as default
read -r -p "Enter V2X-Hub Version (choose from the above, or press Enter to use latest version $latest_version): " chosen_version
read -r -p "Enter V2X-Hub Version (choose from the above, or press Enter to use the latest version $latest_version): " chosen_version
V2XHUB_VERSION=${chosen_version:-$latest_version}

# Enable Port Drayage functionality
Expand Down Expand Up @@ -149,6 +150,6 @@ fi

# Create V2X Hub user
cd "$mysqlDir" || return # return in case cd fails
./add_v2xhub_user.bash
./add_v2xhub_user.bash "$V2XHUB_VERSION"

chromium-browser --ignore-certificate-errors localhost > /dev/null 2>&1 &
17 changes: 16 additions & 1 deletion configuration/mysql/add_v2xhub_user.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
# Fail when any command fails
#set -e

# Check if V2XHUB_VERSION is passed
if [ -n "$1" ]; then
V2XHUB_VERSION="$1"
else
# Prompt user for V2XHUB_VERSION
read -r -p "Enter the deployed V2X-Hub version number: " V2XHUB_VERSION
fi

echo "Adding V2X-Hub user for version: $V2XHUB_VERSION"

# Ensure mysql-client is installed
arch=$(dpkg --print-architecture)
# TODO: Add a common mysql-client that works for ARM and AMD devices
Expand Down Expand Up @@ -34,7 +44,12 @@ if [ $PASS_LENGTH -ge 8 ] && echo $PASS | grep -q [a-z] && echo $PASS | grep -q
done
echo "VALID PASSWORD"
echo "Enter MYSQL ROOT PASSWORD: "
mysql -uroot -p --silent -h127.0.0.1 -e "INSERT INTO IVP.user (IVP.user.username, IVP.user.password, IVP.user.accessLevel) VALUES('$USER', SHA2('$PASS', 256), 3)"
# Check if V2XHUB_VERSION is >= 7.5.0
if [[ "$(echo "$V2XHUB_VERSION 7.5.0" | awk '{print ($1 >= $2)}')" -eq 1 ]]; then
mysql -uroot -p --silent -h127.0.0.1 -e "INSERT INTO IVP.user (IVP.user.username, IVP.user.password, IVP.user.accessLevel) VALUES('$USER', SHA2('$PASS', 256), 3)"
else
mysql -uroot -p --silent -h127.0.0.1 -e "INSERT INTO IVP.user (IVP.user.username, IVP.user.password, IVP.user.accessLevel) VALUES('$USER', '$PASS', 3)"
fi
echo "V2X Hub user successfully added"
else
echo "INVALID PASSWORD"
Expand Down
18 changes: 18 additions & 0 deletions configuration/mysql/garage_port_drayage/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# C1T Garage Actions
These are Port Drayage actions created the CDA1Tenth functionality and specifically tailored for the Turner Fairbank Highway Research Center's Saxton Laboratory garage demonstration.

## Instructions
Replace the port_drayage.sql file in docker-compose.yml with the files in this directory.
```
db:
image: mysql:8.0
volumes:
- ./mysql/garage_port_drayage/port_drayage.sql:/docker-entrypoint-initdb.d/port_drayage.sql
- ./mysql/garage_port_drayage/port_drayage_lane1.sql:/docker-entrypoint-initdb.d/port_drayage_lane1.sql
- ./mysql/garage_port_drayage/port_drayage_lane2.sql:/docker-entrypoint-initdb.d/port_drayage_lane2.sql
```

## Reference Layout
The following diagram displays the C1T Port Drayage layout used in the Saxton Garage. The above SQL files should be selected based on if the first (port_drayage_lane1.sql) or second (port_drayage_lane2.sql) lane will be used for the Port Pickup action.

![Alt text](docs/garage_diagram.PNG)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions configuration/mysql/garage_port_drayage/port_drayage.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
-- MySQL 8.0 for Linux amd64 (x86_64) and arm64 (aarch64)
--
-- Host: 127.0.0.1 Database: PORT_DRAYAGE
-- ------------------------------------------------------
-- Server version 7.6.0
-- Current Database: `PORT_DRAYAGE`
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `PORT_DRAYAGE` /*!40100 DEFAULT CHARACTER SET latin1 */;

USE `PORT_DRAYAGE`;

--
-- Table structure for table `first_action`
--

DROP TABLE IF EXISTS `first_action`;
CREATE TABLE `first_action` (
`cmv_id` varchar(20) NOT NULL,
`cargo_id` varchar(20) DEFAULT NULL,
`destination_lat` decimal(9,7) NOT NULL,
`destination_long` decimal(9,7) NOT NULL,
`operation` varchar(20) NOT NULL,
`action_id` varchar(36) NOT NULL,
`next_action` varchar(36) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

LOCK TABLES `first_action` WRITE;
INSERT INTO `first_action` VALUES ('C1T-1','NULL',-2.46,0.56,'ENTER_STAGING_AREA','one','two');
UNLOCK TABLES;

--
-- Table structure for table `freight`
--

DROP TABLE IF EXISTS `freight`;
CREATE TABLE `freight` (
`cmv_id` varchar(20) NOT NULL,
`cargo_id` varchar(20) DEFAULT NULL,
`destination_lat` decimal(9,7) NOT NULL,
`destination_long` decimal(9,7) NOT NULL,
`operation` varchar(20) NOT NULL,
`action_id` varchar(36) NOT NULL,
`next_action` varchar(36) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

LOCK TABLES `freight` WRITE;
INSERT INTO `freight` VALUES ('C1T-1','NULL',-0.45,-0.45,'EXIT_PORT','zero','one'),('C1T-1','NULL',-2.46,0.56,'ENTER_STAGING_AREA','one','two'),('C1T-1','CARGO_A',-3.45,-1.44,'PICKUP','two','three'),('C1T-1','CARGO_A',-3.45,-3.45,'EXIT_STAGING_AREA','three','four'),('C1T-1','CARGO_A',-3.45,-5.45,'ENTER_PORT','four','five'),('C1T-1','CARGO_A',-1.45,-6.45,'DROPOFF','five','six'),('C1T-1','CARGO_B',2.55,-4.5,'PICKUP','six','seven'),('C1T-1','CARGO_B',0.55,-3.45,'PORT_CHECKPOINT','seven','eight'),('C1T-1','CARGO_B',-0.45,-0.45,'EXIT_PORT','eight','nine');
UNLOCK TABLES;
49 changes: 49 additions & 0 deletions configuration/mysql/garage_port_drayage/port_drayage_lane1.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
-- MySQL 8.0 for Linux amd64 (x86_64) and arm64 (aarch64)
--
-- Host: 127.0.0.1 Database: PORT_DRAYAGE
-- ------------------------------------------------------
-- Server version 7.6.0
-- Current Database: `PORT_DRAYAGE`
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `PORT_DRAYAGE` /*!40100 DEFAULT CHARACTER SET latin1 */;

USE `PORT_DRAYAGE`;

--
-- Table structure for table `first_action`
--

DROP TABLE IF EXISTS `first_action`;
CREATE TABLE `first_action` (
`cmv_id` varchar(20) NOT NULL,
`cargo_id` varchar(20) DEFAULT NULL,
`destination_lat` decimal(9,7) NOT NULL,
`destination_long` decimal(9,7) NOT NULL,
`operation` varchar(20) NOT NULL,
`action_id` varchar(36) NOT NULL,
`next_action` varchar(36) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

LOCK TABLES `first_action` WRITE;
INSERT INTO `first_action` VALUES ('C1T-1','NULL',-2.46,0.56,'ENTER_STAGING_AREA','one','two');
UNLOCK TABLES;

--
-- Table structure for table `freight`
--

DROP TABLE IF EXISTS `freight`;
CREATE TABLE `freight` (
`cmv_id` varchar(20) NOT NULL,
`cargo_id` varchar(20) DEFAULT NULL,
`destination_lat` decimal(9,7) NOT NULL,
`destination_long` decimal(9,7) NOT NULL,
`operation` varchar(20) NOT NULL,
`action_id` varchar(36) NOT NULL,
`next_action` varchar(36) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

LOCK TABLES `freight` WRITE;
INSERT INTO `freight` VALUES ('C1T-1','NULL',-0.45,-0.45,'EXIT_PORT','zero','one'),('C1T-1','NULL',-2.46,0.56,'ENTER_STAGING_AREA','one','two'),('C1T-1','CARGO_A',-3.45,-1.44,'PICKUP','two','three'),('C1T-1','CARGO_A',-3.45,-3.45,'EXIT_STAGING_AREA','three','four'),('C1T-1','CARGO_A',-3.45,-5.45,'ENTER_PORT','four','five'),('C1T-1','CARGO_A',-1.45,-6.45,'DROPOFF','five','six'),('C1T-1','CARGO_B',1.55,-4.5,'PICKUP','six','seven'),('C1T-1','CARGO_B',0.55,-3.45,'PORT_CHECKPOINT','seven','eight'),('C1T-1','CARGO_B',-0.45,-0.45,'EXIT_PORT','eight','nine');
UNLOCK TABLES;
49 changes: 49 additions & 0 deletions configuration/mysql/garage_port_drayage/port_drayage_lane2.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
-- MySQL 8.0 for Linux amd64 (x86_64) and arm64 (aarch64)
--
-- Host: 127.0.0.1 Database: PORT_DRAYAGE
-- ------------------------------------------------------
-- Server version 7.6.0
-- Current Database: `PORT_DRAYAGE`
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `PORT_DRAYAGE` /*!40100 DEFAULT CHARACTER SET latin1 */;

USE `PORT_DRAYAGE`;

--
-- Table structure for table `first_action`
--

DROP TABLE IF EXISTS `first_action`;
CREATE TABLE `first_action` (
`cmv_id` varchar(20) NOT NULL,
`cargo_id` varchar(20) DEFAULT NULL,
`destination_lat` decimal(9,7) NOT NULL,
`destination_long` decimal(9,7) NOT NULL,
`operation` varchar(20) NOT NULL,
`action_id` varchar(36) NOT NULL,
`next_action` varchar(36) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

LOCK TABLES `first_action` WRITE;
INSERT INTO `first_action` VALUES ('C1T-1','NULL',-2.46,0.56,'ENTER_STAGING_AREA','one','two');
UNLOCK TABLES;

--
-- Table structure for table `freight`
--

DROP TABLE IF EXISTS `freight`;
CREATE TABLE `freight` (
`cmv_id` varchar(20) NOT NULL,
`cargo_id` varchar(20) DEFAULT NULL,
`destination_lat` decimal(9,7) NOT NULL,
`destination_long` decimal(9,7) NOT NULL,
`operation` varchar(20) NOT NULL,
`action_id` varchar(36) NOT NULL,
`next_action` varchar(36) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

LOCK TABLES `freight` WRITE;
INSERT INTO `freight` VALUES ('C1T-1','NULL',-0.45,-0.45,'EXIT_PORT','zero','one'),('C1T-1','NULL',-2.46,0.56,'ENTER_STAGING_AREA','one','two'),('C1T-1','CARGO_A',-3.45,-1.44,'PICKUP','two','three'),('C1T-1','CARGO_A',-3.45,-3.45,'EXIT_STAGING_AREA','three','four'),('C1T-1','CARGO_A',-3.45,-5.45,'ENTER_PORT','four','five'),('C1T-1','CARGO_A',-1.45,-6.45,'DROPOFF','five','six'),('C1T-1','CARGO_B',2.55,-4.5,'PICKUP','six','seven'),('C1T-1','CARGO_B',0.55,-3.45,'PORT_CHECKPOINT','seven','eight'),('C1T-1','CARGO_B',-0.45,-0.45,'EXIT_PORT','eight','nine');
UNLOCK TABLES;
11 changes: 11 additions & 0 deletions docs/Release_notes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
V2X-Hub Release Notes
---------------------------------

Version 7.8.1, released Sep 11th, 2024
--------------------------------------------------------

**Summary:**
V2X Hub release 7.8.1 includes additional SQL files which are created to store command sequences V2X Hub sends to a C1T vehicle to coordinate Port Drayage. These files contain actions and destination points configured to send the vehicle through a pre-designed mock port environment, with one instructing the vehicle to pick up cargo in Lane 1 and the other instructing the vehicle to proceed to Lane 2.

Enhancement in this release:

- V2X-Hub PR 639: Added SQL files for use with the C1T Port Drayage configuration and updated docker compose files to streamline deployment.
- V2X-Hub PR 641: Updated SQL Port Drayage action locations to improve accuracy in tracking port exits.

Version 7.8.0, released Aug 26th, 2024
--------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion examples/tmx-exampleapps/EmptyPlugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ PROJECT ( EmptyPlugin VERSION 3.0.0 LANGUAGES CXX )

BuildTmxPlugin ( )

TARGET_LINK_LIBRARIES (${PROJECT_NAME} tmxutils)
TARGET_LINK_LIBRARIES (${PROJECT_NAME} tmxutils pugixml)
2 changes: 1 addition & 1 deletion examples/tmx-exampleapps/EmptyPlugin/src/EmptyPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
#include <AppAlert.h>
#include <algorithm>
#include <tmx/messages/message_document.hpp>
#include <tmx/pugixml/pugixml.hpp>
#include <pugixml.hpp>
#include <ParsedMap.h>
#include <MapSupport.h>
#include <sstream>
Expand Down
8 changes: 8 additions & 0 deletions ext/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,11 @@ make -j${numCPU}
make install
popd

# pugixml
pushd /tmp
git clone https://github.com/zeux/pugixml.git --branch v1.14
cd pugixml
cmake .
make -j${numCPU}
make install
popd
5 changes: 4 additions & 1 deletion scripts/install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
# exit on errors
set -e

# Get ubuntu distribution code name. All STOL APT debian packages are pushed to S3 bucket based on distribution codename.
. /etc/lsb-release

# add the STOL APT repository
echo "deb [trusted=yes] http://s3.amazonaws.com/stol-apt-repository develop main" > /etc/apt/sources.list.d/stol-apt-repository.list
echo "deb [trusted=yes] http://s3.amazonaws.com/stol-apt-repository ${DISTRIB_CODENAME} main" > /etc/apt/sources.list.d/stol-apt-repository.list

apt-get update

Expand Down
15 changes: 15 additions & 0 deletions src/tmx/Messages/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,18 @@ SET (TMXMESSAGES_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include" PARENT_SCOPE)
INSTALL (DIRECTORY include
DESTINATION . COMPONENT ${PROJECT_NAME}
FILES_MATCHING PATTERN "*.h*")

#############
## Testing ##
#############
enable_testing()

set(BINARY ${PROJECT_NAME}_test)

file(GLOB_RECURSE TEST_SOURCES LIST_DIRECTORIES false test/*.h test/*.cpp)

add_executable(${BINARY} ${TEST_SOURCES})

add_test(NAME ${BINARY} COMMAND ${BINARY})
target_include_directories(${BINARY} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(${BINARY} PUBLIC ${TMXAPI_LIBRARIES} gtest)
20 changes: 20 additions & 0 deletions src/tmx/Messages/include/Covariance.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#pragma once
#include <tmx/messages/message.hpp>
namespace tmx::messages
{
struct Covariance{
double value;
Covariance()=default;
explicit Covariance(double value):value(value){};
static message_tree_type to_tree(const Covariance& cov){
message_tree_type tree;
tree.put("",cov.value);
return tree;
}
static Covariance from_tree(const message_tree_type& tree){
Covariance cov;
cov.value = tree.get<double>("");
return cov;
}
};
}
Loading

0 comments on commit 72d48e4

Please sign in to comment.