Skip to content

Commit

Permalink
Merge pull request #154 from usdot-fhwa-stol/release/zephyr
Browse files Browse the repository at this point in the history
Release/zephyr
  • Loading branch information
msmcconnell authored Jun 28, 2021
2 parents a48a49d + 953853c commit bbf23fe
Show file tree
Hide file tree
Showing 64 changed files with 552 additions and 76 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
# Pull docker image from docker hub
# XTERM used for better catkin_make output
docker:
- image: usdotfhwastol/carma-base:carma-system-3.5.0
- image: usdotfhwastol/carma-base:carma-system-3.6.0
user: carma
environment:
TERM: xterm
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM usdotfhwastol/carma-base:carma-system-3.5.0 as build
FROM usdotfhwastol/carma-base:carma-system-3.6.0 as build

COPY --chown=carma . /home/carma/autoware.ai
RUN /home/carma/autoware.ai/docker/checkout.bash
RUN ./home/carma/autoware.ai/docker/install.sh

FROM usdotfhwastol/carma-base:carma-system-3.5.0
FROM usdotfhwastol/carma-base:carma-system-3.6.0

ARG BUILD_DATE="NULL"
ARG VCS_REF="NULL"
Expand All @@ -20,4 +20,4 @@ LABEL org.label-schema.vcs-url="https://github.com/usdot-fhwa-stol/autoware.ai"
LABEL org.label-schema.vcs-ref=${VCS_REF}
LABEL org.label-schema.build-date=${BUILD_DATE}

COPY --chown=carma --from=build /home/carma/autoware.ai/ros/install /opt/autoware.ai/ros/install
COPY --chown=carma --from=build /home/carma/autoware.ai/ros/install /opt/autoware.ai/ros/install
5 changes: 3 additions & 2 deletions autoware/ros/carma_autoware_build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (C) 2018-2019 LEIDOS.
# Copyright (C) 2018-2021 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
Expand Down Expand Up @@ -75,7 +75,8 @@ else
catkin_make_isolated --source . --install --install-space ./ros/install -j1 --only-pkg-with-deps "${AUTOWARE_PACKAGE_SELECTION}" --cmake-args "${autoware_build_args}"
else
echo "Building with CMake args: ${autoware_build_args}"
colcon build --cmake-args "${autoware_build_args}" --executor sequential --install-base ./ros/install --packages-up-to ${AUTOWARE_PACKAGE_SELECTION}
echo "Build with CUDA"
AUTOWARE_COMPILE_WITH_CUDA=1 colcon build --cmake-args "${autoware_build_args}" --executor sequential --install-base ./ros/install --packages-up-to ${AUTOWARE_PACKAGE_SELECTION}
fi
fi

Expand Down
3 changes: 2 additions & 1 deletion autoware/ros/colcon_release
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ fi
COLCON_OPTS="--cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_LIBRARY_PATH=/usr/local/cuda/lib64/stubs -DCMAKE_CXX_FLAGS=-Wall -DCMAKE_C_FLAGS=-Wall"

export LIBRARY_PATH=/usr/lib/OpenNI2/Drivers:$LIBRARY_PATH
colcon build $COLCON_OPTS $@
echo "build with CUDA"
AUTOWARE_COMPILE_WITH_CUDA=1 colcon build $COLCON_OPTS $@
15 changes: 15 additions & 0 deletions common/hardcoded_params/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@

# Copyright (C) 2020-2021 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.

cmake_minimum_required(VERSION 2.8.3)
project(hardcoded_params)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

/*
* Copyright (C) 2020 LEIDOS.
* Copyright (C) 2020-2021 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
Expand Down
2 changes: 1 addition & 1 deletion common/hardcoded_params/package.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!--
Copyright (C) 2019-2020 LEIDOS.
Copyright (C) 2019-2021 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
Expand Down
2 changes: 2 additions & 0 deletions common/lanelet2_extension/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ add_library( lanelet2_extension_lib
lib/PassingControlLine.cpp
lib/StopRule.cpp
lib/DigitalSpeedLimit.cpp
lib/DigitalMinimumGap.cpp
lib/RegionAccessRule.cpp
lib/DirectionOfTravel.cpp
)
Expand Down Expand Up @@ -139,6 +140,7 @@ if(CATKIN_ENABLE_TESTING)
test/src/StopRuleTest.cpp
test/src/DirectionOfTravelTest.cpp
test/src/DigitalSpeedLimitTest.cpp
test/src/DigitalMinimumGapTest.cpp
test/src/CarmaUSTrafficRulesTest.cpp
test/src/MapLoadingTest.cpp
test/src/test_local_projector.cpp
Expand Down
47 changes: 47 additions & 0 deletions common/lanelet2_extension/docs/RegulatoryElements.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,53 @@

To better support dynamic updates and complex situations, CARMA expands on the standard Lanelet2 regulatory element set. The new regulatory element class definitions can be found [here](../include/lanelet2_extension/regulatory_elements) along with a new TrafficRules object which interprets them in place of the Lanelet2 tagging specification.

## Digital Minimum Gap

Minimum Gap can be set dynamically either through a V2V or V2X communications service. It helps to keep a safety following distance between ADS vehicles within an active geofence.

### Parameters
| **Role** | **Possible Type** | **description** |
|-------------|--------------|----------------------------------|
| **refers** | **Lanelet, Area** | The region of the roadway this minimum gap applies to |

### Custom Attributes

| **Key** | **Value Type** | **description** |
|-------------|--------------|----------------------------------|
| **subtype** | **digital_minimum_gap** | Subtype name |
| **mingap** | **double** | The minimum gap to set. In an osm file units must be meters |
| **participant:XXX** | **yes/no** | The participant type this applies to |

#### Note on participant tags

To support multiple types of participants a new attribute should be added for each desired type and the value field set to "yes". So a minimum gap which applied to vehicles will have participant:vehicle set to yes. There is no need to explicitally mark participants as no, this will be implied. The lanelet2 participant heirarchy found [here](https://github.com/fzi-forschungszentrum-informatik/Lanelet2/blob/master/lanelet2_core/doc/LaneletAndAreaTagging.md#overriding) is supported.

### OSM XML Example

```(xml)
<!-- Lanelet -->
<relation id="1349" visible="true" version="1">
<member type="way" ref="1347" role="left" />
<member type="way" ref="1348" role="right" />
<tag k="location" v="urban" />
<tag k="subtype" v="road" />
<tag k="type" v="lanelet" />
<!-- Minimum gap -->
<member type='relation' ref='45217' role='regulatory_element' />
</relation>
<!-- Regulatory Minimum gap -->
<relation id='45217' visible='true' version='1'>
<member type='lanelet' ref='1349' role='refers' />
<tag k='mingap' v='13' /> <!-- Minimum gap value is of unit meter-->
<tag k='subtype' v='digital_minimum_gap' />
<tag k='type' v='regulatory_element' />
<tag k='participant:vehicle' v='yes' />
</relation>
```

## Digital Speed Limit

Represents a speed limit which can be set dynamically either through a V2X communications service or other mechanism. In a standard use case a digital speed limit would be expected to have precedence over a speed limit from a traffic sign which is still a supported speed limit mechanism.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#pragma once
/*
* Copyright (C) 2021 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.
*/
#include <lanelet2_core/primitives/RegulatoryElement.h>
#include <boost/algorithm/string.hpp>
#include <lanelet2_core/utility/Units.h>
#include <unordered_set>

namespace lanelet
{
/**
* @brief Represents a minimum gap which can be set dynamically either through a V2X communications service or other mechanism..
* In a standard use case a digital minimum gap would be expected to have precedence over a minimum gap from a
* sign
*
* A digital minimum gap is dynamic and is normally provided through a communications service. This means the minimum gap
* is stored directly in the regulatory element rather than a TrafficSign element. A minimum gap is applied
* uniformly accross all affected lanelets.
*
* @ingroup RegulatoryElementPrimitives
* @ingroup Primitives
*/
class DigitalMinimumGap : public RegulatoryElement
{
public:
static constexpr char RuleName[] = "digital_minimum_gap";
static constexpr char MinGap[] = "mingap";
double min_gap_ = 0;
std::unordered_set<std::string> participants_;

/**
* @brief Returns the lanelets this rule applies to
*
* @return Lanelets affected by this access rule
*/
ConstLanelets getLanelets() const;

/**
* @brief Returns the areas this rule applies to
*
* @return The areas affected by this rule
*/
ConstAreas getAreas() const;

/**
* @brief Returns the minimum gap defined by this regulation
*
* @return The minimum gap as a double object
*/
double getMinimumGap() const;

/**
* @brief Returns true if the given participant must follow this minimum gap
*
* @return True if this minimum gap should apply to the given participant
*/
bool appliesTo(const std::string& participant) const;

/**
* @brief Static helper function that creates a minimum gap based on the provided double, start, end lines, and the
* affected participants
*
* @param id The lanelet::Id of this object
* @param min_gap The double which will be treated as the minimum gap (unit of meters) in this region
* @param lanelets The lanelets this minimum gap applies to
* @param areas The areas this minimum gap applies to
* @param participants The set of participants which this minimum gap will apply to
*
* @return RegulatoryElementData containing all the necessary information to construct a minimum gap element
*/
static std::unique_ptr<lanelet::RegulatoryElementData> buildData(Id id, double min_gap, Lanelets lanelets, Areas areas,
std::vector<std::string> participants);

/**
* @brief Constructor required for compatability with lanlet2 loading
*
* @param data The data to initialize this regulation with
*/
explicit DigitalMinimumGap(const lanelet::RegulatoryElementDataPtr& data);

protected:
// the following lines are required so that lanelet2 can create this object when loading a map with this regulatory
// element
friend class RegisterRegulatoryElement<DigitalMinimumGap>;
};

// Convenience Ptr Declarations
using DigitalMinimumGapPtr = std::shared_ptr<DigitalMinimumGap>;
using DigitalMinimumGapConstPtr = std::shared_ptr<const DigitalMinimumGap>;

} // namespace lanelet
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
/*
* Copyright (C) 2020 LEIDOS.
* Copyright (C) 2020-2021 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
/*
* Copyright (C) 2020 LEIDOS.
* Copyright (C) 2020-2021 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
/*
* Copyright (C) 2020 LEIDOS.
* Copyright (C) 2020-2021 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
/*
* Copyright (C) 2020 LEIDOS.
* Copyright (C) 2020-2021 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
Expand Down Expand Up @@ -35,8 +35,9 @@ class RegionAccessRule : public RegulatoryElement
{
public:
static constexpr char RuleName[] = "region_access_rule";
static constexpr char Reason[] = "reason";
std::unordered_set<std::string> participants_;

std::string reason_ = "NA";
/**
* @brief Returns the lanelets this rule applies to
*
Expand All @@ -51,6 +52,13 @@ class RegionAccessRule : public RegulatoryElement
*/
ConstAreas getAreas() const;

/**
* @brief Returns the reason for this rule
*
* @return The reason for this rule
*/
std::string getReason();

/**
* @brief Returns true if the provided participant can access lanelets or areas affected by this regulation
*
Expand All @@ -76,7 +84,7 @@ class RegionAccessRule : public RegulatoryElement
* @return RegulatoryElementData containing all the necessary information to construct a region access rule object
*/
static std::unique_ptr<lanelet::RegulatoryElementData> buildData(Id id, Lanelets lanelets, Areas areas,
std::vector<std::string> participants);
std::vector<std::string> participants, const std::string& reason="NA");

protected:
// the following lines are required so that lanelet2 can create this object when loading a map with this regulatory
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
/*
* Copyright (C) 2020 LEIDOS.
* Copyright (C) 2020-2021 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
/*
* Copyright (C) 2020 LEIDOS.
* Copyright (C) 2020-2021 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 LEIDOS.
* Copyright (C) 2020-2021 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
Expand Down
2 changes: 1 addition & 1 deletion common/lanelet2_extension/lib/CarmaUSTrafficRules.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 LEIDOS.
* Copyright (C) 2020-2021 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
Expand Down
Loading

0 comments on commit bbf23fe

Please sign in to comment.