Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Raidakarim committed May 4, 2021
0 parents commit f86010a
Show file tree
Hide file tree
Showing 20 changed files with 284 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[bumpversion]
current_version = 0.0.0
files = .dtproject
commit = True
tag = True
12 changes: 12 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Ignore everything
**

# Allow files and directories
!assets
!packages
!dependencies-apt.txt
!dependencies-py3.txt
!launchers

# YOUR FILES LISTED BELOW THIS LINE (IMPORTANT: PREPEND !)
# ----------------------------------------------------------------------------
3 changes: 3 additions & 0 deletions .dtproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
VERSION=0.0.0
TYPE=template-ros
TYPE_VERSION=2
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
docs/build
*pyc

# documentation artifacts
html/*
!html/HTML_DOCS_WILL_BE_GENERATED_HERE
84 changes: 84 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# parameters
ARG REPO_NAME="<REPO_NAME_HERE>"
ARG DESCRIPTION="<DESCRIPTION_HERE>"
ARG MAINTAINER="<YOUR_FULL_NAME> (<YOUR_EMAIL_ADDRESS>)"
# pick an icon from: https://fontawesome.com/v4.7.0/icons/
ARG ICON="cube"

# ==================================================>
# ==> Do not change the code below this line
ARG ARCH=arm32v7
ARG DISTRO=daffy
ARG BASE_TAG=${DISTRO}-${ARCH}
ARG BASE_IMAGE=dt-ros-commons
ARG LAUNCHER=default

# define base image
FROM duckietown/${BASE_IMAGE}:${BASE_TAG} as BASE

# recall all arguments
ARG ARCH
ARG DISTRO
ARG REPO_NAME
ARG DESCRIPTION
ARG MAINTAINER
ARG ICON
ARG BASE_TAG
ARG BASE_IMAGE
ARG LAUNCHER

# check build arguments
RUN dt-build-env-check "${REPO_NAME}" "${MAINTAINER}" "${DESCRIPTION}"

# define/create repository path
ARG REPO_PATH="${CATKIN_WS_DIR}/src/${REPO_NAME}"
ARG LAUNCH_PATH="${LAUNCH_DIR}/${REPO_NAME}"
RUN mkdir -p "${REPO_PATH}"
RUN mkdir -p "${LAUNCH_PATH}"
WORKDIR "${REPO_PATH}"

# keep some arguments as environment variables
ENV DT_MODULE_TYPE "${REPO_NAME}"
ENV DT_MODULE_DESCRIPTION "${DESCRIPTION}"
ENV DT_MODULE_ICON "${ICON}"
ENV DT_MAINTAINER "${MAINTAINER}"
ENV DT_REPO_PATH "${REPO_PATH}"
ENV DT_LAUNCH_PATH "${LAUNCH_PATH}"
ENV DT_LAUNCHER "${LAUNCHER}"

# install apt dependencies
COPY ./dependencies-apt.txt "${REPO_PATH}/"
RUN dt-apt-install ${REPO_PATH}/dependencies-apt.txt

# install python3 dependencies
COPY ./dependencies-py3.txt "${REPO_PATH}/"
RUN pip3 install --use-feature=2020-resolver -r ${REPO_PATH}/dependencies-py3.txt

# copy the source code
COPY ./packages "${REPO_PATH}/packages"

# build packages
RUN . /opt/ros/${ROS_DISTRO}/setup.sh && \
catkin build \
--workspace ${CATKIN_WS_DIR}/

# install launcher scripts
COPY ./launchers/. "${LAUNCH_PATH}/"
COPY ./launchers/default.sh "${LAUNCH_PATH}/"
RUN dt-install-launchers "${LAUNCH_PATH}"

# define default command
CMD ["bash", "-c", "dt-launcher-${DT_LAUNCHER}"]

# store module metadata
LABEL org.duckietown.label.module.type="${REPO_NAME}" \
org.duckietown.label.module.description="${DESCRIPTION}" \
org.duckietown.label.module.icon="${ICON}" \
org.duckietown.label.architecture="${ARCH}" \
org.duckietown.label.code.location="${REPO_PATH}" \
org.duckietown.label.code.version.distro="${DISTRO}" \
org.duckietown.label.base.image="${BASE_IMAGE}" \
org.duckietown.label.base.tag="${BASE_TAG}" \
org.duckietown.label.maintainer="${MAINTAINER}"
# <== Do not change the code above this line
# <==================================================
Binary file added LICENSE.pdf
Binary file not shown.
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Template: template-ros

This template provides a boilerplate repository
for developing ROS-based software in Duckietown.

**NOTE:** If you want to develop software that does not use
ROS, check out [this template](https://github.com/duckietown/template-basic).


## How to use it

### 1. Fork this repository

Use the fork button in the top-right corner of the github page to fork this template repository.


### 2. Create a new repository

Create a new repository on github.com while
specifying the newly forked template repository as
a template for your new repository.


### 3. Define dependencies

List the dependencies in the files `dependencies-apt.txt` and
`dependencies-py3.txt` (apt packages and pip packages respectively).


### 4. Place your code

Place your code in the directory `/packages/` of
your new repository.


### 5. Setup launchers

The directory `/launchers` can contain as many launchers (launching scripts)
as you want. A default launcher called `default.sh` must always be present.

If you create an executable script (i.e., a file with a valid shebang statement)
a launcher will be created for it. For example, the script file
`/launchers/my-launcher.sh` will be available inside the Docker image as the binary
`dt-launcher-my-launcher`.

When launching a new container, you can simply provide `dt-launcher-my-launcher` as
command.
1 change: 1 addition & 0 deletions assets/STORE_MODULE_ASSETS_HERE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
INTENTIONALLY LEFT BLANK
3 changes: 3 additions & 0 deletions configurations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
version: '1.0'

configurations: {}
1 change: 1 addition & 0 deletions dependencies-apt.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# LIST YOUR APT PACKAGES HERE
1 change: 1 addition & 0 deletions dependencies-py3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# LIST YOUR PYTHON3 PACKAGES HERE
58 changes: 58 additions & 0 deletions docs/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
docs_config_version: v1

# CONFIGURE THESE TO MATCH YOUR PROJECT:
project: "REPOSITORY_NAME_HERE"
copyright: "Duckietown"
author: "YOUR_NAME_HERE"
version: "daffy"
custom_sections: [
"Configuration",
"Subscribers",
"Subscriber",
"Publishers",
"Publisher",
"Services",
"Service",
"Fields",
"Attribute",
"Attributes",
"inputs",
"input",
"outputs",
"output"
]

# REFRAIN FROM CHANGING THESE SPHINX-SPECIFIC CONFIGURATION SETTINGS:
autodoc_default_flags:
members: True
member-order: alphabetical
undoc-members: True
inherited-members: True
show-inheritance: True

add_module_names: False

# settings for napoleon
napoleon_google_docstring: True
napoleon_numpy_docstring: False
napoleon_include_init_with_doc: False
napoleon_include_private_with_doc: False
napoleon_include_special_with_doc: False
napoleon_use_admonition_for_examples: True
napoleon_use_admonition_for_notes: True
napoleon_use_admonition_for_references: True
napoleon_use_ivar: False
napoleon_use_param: False
napoleon_use_rtype: True
napoleon_use_keyword: True

# options for the sphinx_rtd_theme
html_theme_options:
prev_next_buttons_location: 'bottom'
style_nav_header_background: '#fbc10b'
collapse_navigation: False
sticky_navigation: True
navigation_depth: 4
includehidden: False
titles_only: False

23 changes: 23 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

.. documentation master file, created by
sphinx-quickstart on Fri Jul 19 20:26:50 2019.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to REPOSITORY_NAME_HERE documentation!
==============================================

.. toctree::
:maxdepth: 1
:caption: Contents:

packages



Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
Empty file added docs/mock_imports
Empty file.
8 changes: 8 additions & 0 deletions docs/packages.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Duckietown Module: REPOSITORY_NAME_HERE
=======================================

.. toctree::
:glob:
:maxdepth: 4

packages/*
1 change: 1 addition & 0 deletions docs/packages/PLACE_YOUR_RST_FILES_HERE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
INTENTIONALLY LEFT BLANK
6 changes: 6 additions & 0 deletions docs/packages/example.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Python Package: example
=======================

.. contents::

TODO: This is a placeholder description of the Python Package.
1 change: 1 addition & 0 deletions html/HTML_DOCS_WILL_BE_GENERATED_HERE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
INTENTIONALLY LEFT BLANK
23 changes: 23 additions & 0 deletions launchers/default.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

source /environment.sh

# initialize launch file
dt-launchfile-init

# YOUR CODE BELOW THIS LINE
# ----------------------------------------------------------------------------


# NOTE: Use the variable DT_REPO_PATH to know the absolute path to your code
# NOTE: Use `dt-exec COMMAND` to run the main process (blocking process)

# launching app
dt-exec echo "This is an empty launch script. Update it to launch your application."


# ----------------------------------------------------------------------------
# YOUR CODE ABOVE THIS LINE

# wait for app to end
dt-launchfile-join
1 change: 1 addition & 0 deletions packages/PLACE_YOUR_ROS_PACKAGES_HERE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# INTENTIONALLY LEFT BLANK

0 comments on commit f86010a

Please sign in to comment.