Skip to content

Commit

Permalink
Merge pull request #11 from usdot-fhwa-stol/release/Wanderer
Browse files Browse the repository at this point in the history
Release/wanderer
  • Loading branch information
kjrush authored Dec 10, 2020
2 parents 384d01e + ee9183b commit 4e4cfdb
Show file tree
Hide file tree
Showing 51 changed files with 4,242 additions and 1 deletion.
96 changes: 96 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
version: 2
# Copyright (C) 2018-2020 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.
#

# Configuration file for Circle CI
# CI will report failure if any executed command returns and error status
# Operations performed are as follows
# Build source code
# Run unit tests for C++ and Java
# Run static code analyzer for SourceCloud
# Upload test results
# Every run command should start with source ${INIT_ENV} to ensure all default dependancies are available

jobs:
build:
# Pull docker image from docker hub
# XTERM used for better catkin_make output
docker:
- image: usdotfhwastol/carma-base:carma-system-3.4.0
user: carma
environment:
TERM: xterm # use xterm to get full display output from build
INIT_ENV: /home/carma/.base-image/init-env.sh
working_directory: "/opt/carma/"
# Execution steps
steps:
- run:
name: Create src folder
command: |
source ${INIT_ENV}
mkdir src
cd src
mkdir carma-simulation
- checkout:
path: src/carma-simulation
- run:
name: Pull Deps
command: |
source ${INIT_ENV}
./src/carma-simulation/docker/checkout.sh -r ${PWD}
- run:
name: Build Driver
command: |
source ${INIT_ENV}
export ROS_PARALLEL_JOBS='-j1 -l1' # Try to reduce memory consumption on build
build-wrapper-linux-x86-64 --out-dir /opt/carma/bw-output bash make_with_coverage.bash -m -e /opt/carma/ -o ./coverage_reports/gcov
- run:
name: Run C++ Tests
command: |
source ${INIT_ENV}
export ROS_PARALLEL_JOBS='-j1 -l1' # Try to reduce memory consumption on build
bash make_with_coverage.bash -t -e /opt/carma/ -o ./coverage_reports/gcov
# Run SonarCloud analysis
# PR Branchs and number extracted from Circle variables and github api
# Circle CI seems to make a change to the base branch, so we must fetch --force to ensure correct git file change stats
# SONAR_SCANNER_TOKEN MUST be secured as an environment variable in Circle CI NOT in this file.
# The following sonar settings MUST be set in SonarCloud UI NOT in this file
# sonar.pullrequest.provider
# sonar.pullrequest.github.endpoint
# sonar.pullrequest.github.token.secured
# sonar.pullrequest.github.repository
# Use -X on sonar-scanner to enable debug output
- run:
name: Run Sonar Scanner
command: |
set -x
source ${INIT_ENV}
if [ -z "${CIRCLE_PULL_REQUEST}" ]; then
echo "Non-PR Build Detected. Running analysis on ${CIRCLE_BRANCH}"
cd src/carma-simulation
sonar-scanner -Dproject.settings=.sonarqube/sonar-scanner.properties -Dsonar.login=${SONAR_SCANNER_TOKEN}
exit 0;
fi
echo "PR branch ${CIRCLE_BRANCH}"
echo "Repo name ${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}"
echo "URL ${CIRCLE_PULL_REQUEST}"
export PR_NUM=`echo ${CIRCLE_PULL_REQUEST} | cut -d'/' -f7`
echo "PR number ${PR_NUM}"
export BASE_BRANCH_URL="https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/pulls/${PR_NUM}"
export TARGET_BRANCH=$(curl "$BASE_BRANCH_URL" | jq '.base.ref' | tr -d '"')
echo "Target Branch = ${TARGET_BRANCH}"
cd src/carma-simulation
git fetch --force origin ${TARGET_BRANCH}:${TARGET_BRANCH}
sonar-scanner -Dproject.settings=.sonarqube/sonar-scanner.properties -Dsonar.login=${SONAR_SCANNER_TOKEN} -Dsonar.pullrequest.base=${TARGET_BRANCH} -Dsonar.pullrequest.branch=${CIRCLE_BRANCH} -Dsonar.pullrequest.key=${PR_NUM}
38 changes: 38 additions & 0 deletions .sonarqube/sonar-scanner.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright (C) 2018-2020 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.

# Configuration file for Sonar Scanner used for CI

sonar.projectKey=usdot-fhwa-stol_carma-simulation
sonar.organization=usdot-fhwa-stol
sonar.cfamily.build-wrapper-output=/opt/carma/bw-output
sonar.host.url=https://sonarcloud.io
sonar.cfamily.gcov.reportsPath=/opt/carma/coverage_reports/gcov
# Set Git as SCM sensor
sonar.scm.disabled=false
sonar.scm.enabled=true
sonar.scm.provider=git
sonar.cfamily.cache.enabled=false

# Modules
sonar.modules=carla_ackermann_control_wrapper

carla_ackermann_control_wrapper.sonar.projectBaseDir=/opt/carma/src/carma-simulation/carla_ackermann_control_wrapper

# C++ Package differences
# Sources
carla_ackermann_control_wrapper.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.
carla_ackermann_control_wrapper.sonar.tests=test
42 changes: 42 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright (C) 2018-2020 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.

FROM usdotfhwastol/carma-base:carma-system-3.4.0 as deps

FROM deps as setup

RUN mkdir ~/src
COPY --chown=carma . /home/carma/src/
RUN ~/src/docker/checkout.sh
RUN ~/src/docker/install.sh

FROM deps

ARG BUILD_DATE="NULL"
ARG VERSION="NULL"
ARG VCS_REF="NULL"

LABEL org.label-schema.schema-version="1.0"
LABEL org.label-schema.name="carla-ackermann-control-wrapper-driver"
LABEL org.label-schema.description="carla ackermann control wrapper driver for the CARMA Platform"
LABEL org.label-schema.vendor="Leidos"
LABEL org.label-schema.version=${VERSION}
LABEL org.label-schema.url="https://highways.dot.gov/research/research-programs/operations/CARMA"
LABEL org.label-schema.vcs-url="https://github.com/usdot-fhwa-stol/carma-simulation/"
LABEL org.label-schema.vcs-ref=${VCS_REF}
LABEL org.label-schema.build-date=${BUILD_DATE}

COPY --from=deps /home/carma/install /opt/carma/install

CMD [ "wait-for-it.sh", "localhost:11311", "--", "roslaunch", "carla_ackermann_control_wrapper", "carla_ackermann_control_wrapper.launch"]
31 changes: 30 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,30 @@
# carma-simulation
# CARMASimulation
CARMA Simulation is a CARMA execution environment that integrates the CARLA vehicle simulator and the CARMA Platform vehicle on-board software (hereinafter referred to simply as CARMA) for the simulation of vehicle dynamics and feedback control (in CARMA) and the environment in which the subject vehicle runs.

# carla_ackermann_control
The carla_ackermann_control package is under MIT license and te orginal repository can be found [here](https://github.com/carla-simulator/ros-bridge.git).

## CARMAPlatform
The primary CARMAPlatform repository can be found [here](https://github.com/usdot-fhwa-stol/carma-platform) and is part of the [USDOT FHWA STOL](https://github.com/usdot-fhwa-stol/)
github organization. Documentation on how the CARMAPlatform functions, how it will evolve over time, and how you can contribute can be found at the above links as well

## Contribution
Welcome to the CARMA contributing guide. Please read this guide to learn about our development process, how to propose pull requests and improvements, and how to build and test your changes to this project. [CARMA Contributing Guide](https://github.com/usdot-fhwa-stol/carma-platform/blob/develop/Contributing.md)

## Code of Conduct
Please read our [CARMA Code of Conduct](https://github.com/usdot-fhwa-stol/carma-platform/blob/develop/Code_of_Conduct.md) which outlines our expectations for participants within the CARMA community, as well as steps to reporting unacceptable behavior. We are committed to providing a welcoming and inspiring community for all and expect our code of conduct to be honored. Anyone who violates this code of conduct may be banned from the community.

## Attribution
The development team would like to acknowledge the people who have made direct contributions to the design and code in this repository. [CARMA Attribution](https://github.com/usdot-fhwa-stol/carma-platform/blob/develop/ATTRIBUTION.txt)

## License
By contributing to the Federal Highway Administration (FHWA) Connected Automated Research Mobility Applications (CARMA), you agree that your contributions will be licensed under its Apache License 2.0 license. [CARMA License](https://github.com/usdot-fhwa-stol/carma-platform/blob/develop/docs/License.md)

### NOTE

Some of the packages within this repo contain different licensing restrictions. Consult the README in each package for details.

## Contact
Please click on the CARMA logo below to visit the Federal Highway Adminstration(FHWA) CARMA website.

[![CARMA Image](https://raw.githubusercontent.com/usdot-fhwa-stol/carma-platform/develop/docs/image/CARMA_icon.png)](https://highways.dot.gov/research/research-programs/operations/CARMA)
54 changes: 54 additions & 0 deletions carla_ackermann_control/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
cmake_minimum_required(VERSION 2.8.3)
project(carla_ackermann_control)

## Find catkin macros and libraries
find_package(catkin REQUIRED COMPONENTS
rospy
std_msgs
ackermann_msgs
dynamic_reconfigure
carla_msgs
roslaunch
message_generation
)

catkin_python_setup()

add_message_files(
FILES
EgoVehicleControlCurrent.msg
EgoVehicleControlInfo.msg
EgoVehicleControlMaxima.msg
EgoVehicleControlStatus.msg
EgoVehicleControlTarget.msg
)

generate_messages(
DEPENDENCIES
std_msgs
carla_msgs
)

generate_dynamic_reconfigure_options(
config/EgoVehicleControlParameter.cfg
)

roslaunch_add_file_check(launch)

catkin_package(
CATKIN_DEPENDS message_runtime carla_msgs std_msgs
)

install(PROGRAMS
src/carla_ackermann_control/carla_ackermann_control_node.py
src/carla_ackermann_control/carla_control_physics.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

install(DIRECTORY launch/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
)

install(DIRECTORY config/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/config
)
21 changes: 21 additions & 0 deletions carla_ackermann_control/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018-2019 CARLA

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
44 changes: 44 additions & 0 deletions carla_ackermann_control/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Carla Ackermann Control

ROS Node to convert [AckermannDrive](http://docs.ros.org/api/ackermann_msgs/html/msg/AckermannDrive.html) messages to [CarlaEgoVehicleControl](carla_ros_bridge/msg/CarlaEgoVehicleControl.msg).

- A PID controller is used to control the acceleration/velocity.
- Reads the Vehicle Info, required for controlling from Carla (via carla ros bridge)

## Prerequisites

#install python simple-pid
pip install --user simple-pid

### Configuration

Initial parameters can be set via [configuration file](config/settings.yaml).

It is possible to modify the parameters during runtime via ROS dynamic reconfigure.

## Available Topics

| Topic | Type | Description |
| --------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
| `/carla/<ROLE NAME>/ackermann_cmd` (subscriber) | [ackermann_msgs.AckermannDrive](http://docs.ros.org/api/ackermann_msgs/html/msg/AckermannDrive.html) | Subscriber for stearing commands |
| `/carla/<ROLE NAME>/ackermann_control/control_info` | [carla_ackermann_control.EgoVehicleControlInfo](msg/EgoVehicleControlInfo.msg) | The current values used within the controller (for debugging) |

The role name is specified within the configuration.

### Test control messages

You can send command to the car using the topic `/carla/<ROLE NAME>/ackermann_cmd`.

Examples for a ego vehicle with role_name 'ego_vehicle':

Forward movements, speed in in meters/sec.

rostopic pub /carla/ego_vehicle/ackermann_cmd ackermann_msgs/AckermannDrive "{steering_angle: 0.0, steering_angle_velocity: 0.0, speed: 10, acceleration: 0.0,
jerk: 0.0}" -r 10

Forward with steering

rostopic pub /carla/ego_vehicle/ackermann_cmd ackermann_msgs/AckermannDrive "{steering_angle: 1.22, steering_angle_velocity: 0.0, speed: 10, acceleration: 0.0,
jerk: 0.0}" -r 10

Info: the steering_angle is the driving angle (in radians) not the wheel angle.
Loading

0 comments on commit 4e4cfdb

Please sign in to comment.