Skip to content

Commit

Permalink
Merge pull request #1328 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 30, 2021
2 parents cf612fe + 007d9e0 commit 7f01d00
Show file tree
Hide file tree
Showing 222 changed files with 70,382 additions and 1,690 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/autoware.ai:carma-system-3.5.0
- image: usdotfhwastol/autoware.ai:carma-system-3.6.0
user: carma
environment:
TERM: xterm
Expand Down
29 changes: 26 additions & 3 deletions .sonarqube/sonar-scanner.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# the License.

# Configuration file for Sonar Scanner used for CI

sonar.scanner.force-deprecated-java-version-grace-period=true
sonar.projectKey=usdot-fhwa-stol_CARMAPlatform
sonar.organization=usdot-fhwa-stol
sonar.cfamily.build-wrapper-output=/opt/carma/bw-output
Expand Down Expand Up @@ -57,7 +57,12 @@ sonar.modules= bsm_generator, \
stop_and_wait_plugin, \
carma_record, \
traffic_incident_parser, \
pure_pursuit_jerk_wrapper
pure_pursuit_jerk_wrapper, \
motion_computation, \
unobstructed_lanechange, \
yield_plugin, \
cooperative_lanechange,\
mobilitypath_visualizer

guidance.sonar.projectBaseDir = /opt/carma/src/CARMAPlatform/guidance
bsm_generator.sonar.projectBaseDir = /opt/carma/src/CARMAPlatform/bsm_generator
Expand Down Expand Up @@ -89,6 +94,12 @@ stop_and_wait_plugin.sonar.projectBaseDir = /opt/carma/src/CARMAPlatform/stop_an
carma_record.sonar.projectBaseDir = /opt/carma/src/CARMAPlatform/carma_record
traffic_incident_parser.sonar.projectBaseDir = /opt/carma/src/CARMAPlatform/traffic_incident_parser
pure_pursuit_jerk_wrapper.sonar.projectBaseDir = /opt/carma/src/CARMAPlatform/pure_pursuit_jerk_wrapper
motion_computation.sonar.projectBaseDir = /opt/carma/src/CARMAPlatform/motion_computation
unobstructed_lanechange.sonar.projectBaseDir = /opt/carma/src/CARMAPlatform/unobstructed_lanechange
cooperative_lanechange.sonar.projectBaseDir = /opt/carma/src/CARMAPlatform/cooperative_lanechange
yield_plugin.sonar.projectBaseDir = /opt/carma/src/CARMAPlatform/yield_plugin
mobilitypath_visualizer.sonar.projectBaseDir = /opt/carma/src/CARMAPlatform/mobilitypath_visualizer


# C++ Package differences
# Sources
Expand Down Expand Up @@ -122,6 +133,12 @@ stop_and_wait_plugin.sonar.sources = src
carma_record.sonar.sources = src
traffic_incident_parser.sonar.sources = src
pure_pursuit_jerk_wrapper.sonar.sources = src
motion_computation.sonar.sources = src
unobstructed_lanechange.sonar.sources = src
cooperative_lanechange.sonar.sources = src
yield_plugin.sonar.sources = src
mobilitypath_visualizer.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.
Expand Down Expand Up @@ -150,4 +167,10 @@ lightbar_manager.sonar.tests = test
inlanecruising_plugin.sonar.tests = test
stop_and_wait_plugin.sonar.tests = test
traffic_incident_parser.sonar.tests = test
pure_pursuit_jerk_wrapper.tests = test
pure_pursuit_jerk_wrapper.tests = test
motion_computation.sonar.tests = test
unobstructed_lanechange.sonar.tests = test
cooperative_lanechange.sonar.tests = test
yield_plugin.sonar.tests = test
mobilitypath_visualizer.sonar.tests = test

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
# Stage 1 - Acquire the CARMA source as well as any extra packages
# /////////////////////////////////////////////////////////////////////////////

FROM usdotfhwastol/autoware.ai:carma-system-3.5.0 AS base-image
FROM usdotfhwastol/autoware.ai:carma-system-3.6.0 AS base-image

FROM base-image AS source-code

Expand Down
6 changes: 0 additions & 6 deletions arbitrator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,6 @@ add_library(arbitrator_library
src/tree_planner.cpp)


## Rename C++ executable without prefix
## The above recommended prefix causes long target names, the following renames the
## target back to the shorter version for ease of user use
## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node"
set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "")

## Add cmake target dependencies of the executable
## same as for the library above
add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
Expand Down
2 changes: 1 addition & 1 deletion arbitrator/launch/arbitrator.launch
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
This file is used to launch the CARMA3 Arbitrator node
-->
<launch>
<node name="arbitrator" pkg="arbitrator" type="node">
<node name="arbitrator" pkg="arbitrator" type="arbitrator_node">
<rosparam command="load" file="$(find arbitrator)/config/arbitrator_params.yaml"/>
</node>
</launch>
Expand Down
7 changes: 7 additions & 0 deletions arbitrator/src/arbitrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ namespace arbitrator
ROS_INFO("Aribtrator spinning in PAUSED state.");
paused_state();
break;
case SHUTDOWN:
ROS_INFO("Arbitrator shutting down after being commanded to shutdown!");
ros::shutdown();
exit(0);
break;
default:
throw std::invalid_argument("State machine attempting to process an illegal state value");
}
Expand Down Expand Up @@ -102,6 +107,8 @@ namespace arbitrator
initialized_ = true;
// TODO: load plan duration from parameters file
}

ros::Duration(0.1).sleep();
}

void Arbitrator::planning_state()
Expand Down
92 changes: 92 additions & 0 deletions basic_autonomy/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#
# 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.
#

cmake_minimum_required(VERSION 2.8.3)
project(basic_autonomy)

## Compile as C++11, supported in ROS Kinetic and newer
add_compile_options(-std=c++14)
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")

set( CATKIN_DEPS
roscpp
std_msgs
cav_msgs
carma_wm
)

## Find catkin macros and libraries
find_package(catkin REQUIRED COMPONENTS
${CATKIN_DEPS}
)

## System dependencies are found with CMake's conventions
find_package(Boost)
find_package(Eigen3 REQUIRED)

###################################
## catkin specific configuration ##
###################################

catkin_package(
INCLUDE_DIRS include
CATKIN_DEPENDS ${CATKIN_DEPS}
LIBRARIES basic_autonomy
DEPENDS Boost EIGEN3
)

###########
## Build ##
###########

include_directories(
include
${catkin_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIRS}
)

add_library(basic_autonomy
src/helper_functions.cpp
)

add_dependencies(basic_autonomy ${catkin_EXPORTED_TARGETS})
target_link_libraries(basic_autonomy ${catkin_LIBRARIES})

#target_link_libraries(basic_autonomy ${catkin_LIBRARIES} ${Boost_LIBRARIES})
#add_dependencies(basic_autonomy ${catkin_EXPORTED_TARGETS} ${${PROJECT_NAME}_EXPORTED_TARGETS})


#############
## Install ##
#############

install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)

## Install C++
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

#############
## Testing ##
#############

37 changes: 37 additions & 0 deletions basic_autonomy/include/basic_autonomy/basic_autonomy.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#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 <vector>
#include <boost/geometry.hpp>
#include <carma_wm/Geometry.h>
#include <ros/ros.h>
#include <cav_msgs/VehicleState.h>
#include <lanelet2_core/geometry/Point.h>
#include <carma_wm/WorldModel.h>


namespace basic_autonomy
{
namespace waypoint_generation
{
struct PointSpeedPair
{
lanelet::BasicPoint2d point;
double speed = 0;
};
}
}
98 changes: 98 additions & 0 deletions basic_autonomy/include/basic_autonomy/helper_functions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#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 <basic_autonomy/basic_autonomy.h>

namespace basic_autonomy
{
namespace waypoint_generation
{
//Small value corresponding to 0.1 mm in meters for comparing distance to a near zero.
const double epsilon_ = 0.0000001;
/**
* \brief Returns the nearest point (in terms of cartesian 2d distance) to the provided vehicle pose in the provided l
*
* \param points The points to evaluate
* \param state The current vehicle state
*
* \return index of nearest point in points
*/
int get_nearest_point_index(const std::vector<lanelet::BasicPoint2d>& points,
const cav_msgs::VehicleState& state);
/**
* \brief Returns the nearest point (in terms of cartesian 2d distance) to the provided vehicle pose in the provided list
*
* \param points The points to evaluate
* \param state The current vehicle state
*
* \return index of nearest point in points
*/
int get_nearest_point_index(const std::vector<PointSpeedPair>& points,
const cav_msgs::VehicleState& state);
/**
* \brief Returns the nearest "less than" point to the provided vehicle pose in the provided list by utilizing the downtrack measured along the route
* NOTE: This function compares the downtrack, provided by routeTrackPos, of each points in the list to get the closest one to the given point's downtrack.
* Therefore, it is rather costlier method than comparing cartesian distance between the points and getting the closest. This way, however, the function
* correctly returns the end point's index if the given state, despite being valid, is farther than the given points and can technically be near any of them.
*
* \param points BasicLineString2d points
* \param target_downtrack target downtrack along the route to get index near to
*
* \return index of nearest point in points
*/
int get_nearest_index_by_downtrack(const std::vector<lanelet::BasicPoint2d>& points, const carma_wm::WorldModelConstPtr& wm, double target_downtrack);

/**
* \brief Helper method to split a list of PointSpeedPair into separate point and speed lists
* \param points Point Speed pair to split
* \param basic_points points vector to be filled
* \param speeds speeds vector to be filled
*/
void split_point_speed_pairs(const std::vector<PointSpeedPair>& points,
std::vector<lanelet::BasicPoint2d>* basic_points,
std::vector<double>* speeds);
/**
* \brief Overload: Returns the nearest point to the provided vehicle pose in the provided list by utilizing the downtrack measured along the route
* NOTE: This function compares the downtrack, provided by routeTrackPos, of each points in the list to get the closest one to the given point's downtrack.
* Therefore, it is rather costlier method than comparing cartesian distance between the points and getting the closest. This way, however, the function
* correctly returns the end point's index if the given state, despite being valid, is farther than the given points and can technically be near any of them.
*
* \param points The points and speed pairs to evaluate
* \param state The current vehicle state
* \param wm The carma world model
*
* \return index of nearest point in points
*/
int get_nearest_index_by_downtrack(const std::vector<PointSpeedPair>& points, const carma_wm::WorldModelConstPtr& wm,
const cav_msgs::VehicleState& state);

/**
* \brief Overload: Returns the nearest point to the provided vehicle pose in the provided list by utilizing the downtrack measured along the route
* NOTE: This function compares the downtrack, provided by routeTrackPos, of each points in the list to get the closest one to the given point's downtrack.
* Therefore, it is rather costlier method than comparing cartesian distance between the points and getting the closest. This way, however, the function
* correctly returns the end point if the given state, despite being valid, is farther than the given points and can technically be near any of them.
*
* \param points The points to evaluate
* \param state The current vehicle state
* \param wm The carma world model
*
* \return index of nearest point in points
*/
int get_nearest_index_by_downtrack(const std::vector<lanelet::BasicPoint2d>& points, const carma_wm::WorldModelConstPtr& wm,
const cav_msgs::VehicleState& state);

}
}
31 changes: 31 additions & 0 deletions basic_autonomy/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0"?>

<!--
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.
-->

<package format="3">
<name>basic_autonomy</name>
<version>3.2.0</version>
<description>The Basic Autonomy Library includes logic for waypoint generation in CARMA Platform.</description>
<maintainer email="[email protected]">carma</maintainer>
<license>Apache License 2.0</license>
<author email="[email protected]">carma</author>
<buildtool_depend>catkin</buildtool_depend>
<depend>roscpp</depend>
<depend>std_msgs</depend>
<depend>cav_msgs</depend>
<depend>carma_wm</depend>
</package>
Loading

0 comments on commit 7f01d00

Please sign in to comment.