Skip to content

Commit

Permalink
Merge pull request #45 from uci-uav-forge/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
rland93 authored Apr 28, 2022
2 parents a714823 + 58c4ee2 commit b8428f3
Show file tree
Hide file tree
Showing 33 changed files with 51 additions and 54 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
include src/odcl/labcolors.npy
include src/uavfpy/odcl/labcolors.npy
global-include *.md
30 changes: 15 additions & 15 deletions docs/ROS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
The UAVF ROS Package
********************

The ``uavf`` package in ``main`` is a python package that does not depend on ROS. We do use ROS to orchestrate the mission, so we have a ROS package as well.
The ``uavfpy`` package in ``main`` is a python package that does not depend on ROS. We do use ROS to orchestrate the mission, so we have a ROS package as well.

``uavf`` is the name of the ROS package. Its development shares an issue tracker and repository with the main python package, but its development happens on the ``ROS`` and ``ROS-dev`` branches of the repository.
``uavfros`` is the name of the ROS package. Its development shares an issue tracker and repository with the main python package, but its development happens on the ``ROS`` and ``ROS-dev`` branches of the repository.

Installation
============
Expand All @@ -13,7 +13,7 @@ Prerequisites
`````````````
In order to develop packages on ROS, you need a PC equipped with Linux. Any desktop linux platform is suitable, but the easiest by far is Ubuntu. I prefer Ubuntu MATE on the desktop, but you can use a standard Ubuntu, KDE, or whichever flavor you like.

``uavf`` is a ROS package. To install it, you need to have ROS installed and configured. That will not be covered in this documentation; if you are brand new to ROS, I recommend that you go through the ROS tutorial [1]_ before continuing to the next section.
``uavfros`` is a ROS package. To install it, you need to have ROS installed and configured. That will not be covered in this documentation; if you are brand new to ROS, I recommend that you go through the ROS tutorial [1]_ before continuing to the next section.

.. note::

Expand Down Expand Up @@ -75,7 +75,7 @@ You will see several new nodes:
This is the simulated PX4, which can be commanded with MAVROS.

Install ``uavf``
````````````````
`````````````````
.. warning::

Because we are using this package from ROS, we need to ensure that we are NOT in any python virtual environment. You can verify this by typing ``which python`` into a terminal window. Make sure that the output is ``/usr/bin/python``.
Expand Down Expand Up @@ -115,38 +115,38 @@ Run ``catkin_make`` and source your ``devel/setup.bash`` file:
Make sure you remember to start a ``roscore`` instance in a separate terminal window.

Running a Mission with ``uavf``
===============================
Running a Mission with ``uavfros``
==================================

Until we have viable hardware testing, this section deals with running a simulated mission with ``uavf``.
Until we have viable hardware testing, this section deals with running a simulated mission with ``uavfros``.

Run ``uavf`` Interop
--------------------
Run ``uavfros`` Interop
-----------------------

The interop client is a ros node written in Python. We start it with ``rosrun``.

.. code-block::
rosrun uavf interop
rosrun uavfros interop
Run ``uavf`` Planner
--------------------
Run ``uavfros`` Planner
-----------------------

The navigation node is a ros service node that will generate a new path for the UAV to follow between waypoints.

.. code-block:: bash
rosrun uavf planner
rosrun uavfros planner
Run ``uavf`` GNC
Run ``uavfros`` GNC
----------------

The uavf GNC node is a ros node that will take a computed plan and manage the execution of the plan on the UAV.

.. code-block:: bash
rosrun uavf gnc
rosrun uavfros gnc
.. [1] http://wiki.ros.org/ROS/Tutorials
9 changes: 3 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,10 @@

sys.path.insert(0, os.path.abspath("../src"))
try:
import odcl
import uavfpy
except ImportError:
raise ImportError("Csheck that `odcl` is available to Python.")
try:
import planner
except ImportError:
raise ImportError("Check that `pathplanner` is available to Python.")
raise ImportError("Csheck that `uavfpy` is available to Python.")


# -- Project information -----------------------------------------------------

Expand Down
6 changes: 3 additions & 3 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ We also keep ROS code separate because `it's good practice to do so anyway <http
:width: 50%
:align: center

So, to avoid development hell, we put the bulk of the functionality into the ``main`` branch, install ``main`` package (and all of its dependencies) onto the vehicle's system python, and then we can just import the ``uavf`` package and use its functionality in our ROS scripts.
So, to avoid development hell, we put the bulk of the functionality into the ``main`` branch, install ``main`` package (and all of its dependencies) onto the vehicle's system python, and then we can just import the :py:package:`uavfpy` package and use its functionality in our ROS scripts.

The Golden Rule of ROS Development
``````````````````````````````````
Expand Down Expand Up @@ -310,7 +310,7 @@ Then, call it from the piece of code in the ``ROS`` branch.:

.. code-block:: python
from Pipeline import pipeline
from uavfpy.Pipeline import pipeline
def publish_pixels(pipeline, image):
pixels = pipeline.count_pixels(image)
Expand Down Expand Up @@ -342,7 +342,7 @@ Documentation

We have attempted to make writing documentation as easy as possible -- and as close to the codebase as possible! This documentation contains documentation that people have written manually (such as this guide). This manual documentation is written in a format called reStructuredText, which is a commonly-used format for software documentation. To get started writing manual documentation with reStructuredText, read the `reStructuredText Primer <https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html>`_.

The second type of documentation is the auto-generated documentation. This documentation is generated from in-line comments in the codebase. You don't need to touch anything in the `docs/` folder to write this documentation -- just comment your code, and your comments are added to the API page (:py:mod:`odcl`) automatically. The API page will rebuild itself automatically whenever pushes are made to the ``main`` branch of the repository.
The second type of documentation is the auto-generated documentation. This documentation is generated from in-line comments in the codebase. You don't need to touch anything in the `docs/` folder to write this documentation -- just comment your code, and your comments are added to the API page (:py:package:`uavfpy`) automatically. The API page will rebuild itself automatically whenever pushes are made to the ``main`` branch of the repository.

We use `Sphinx <https://www.sphinx-doc.org/en/master/index.html>`_ and a tool called `Sphinx Autoapi <https://github.com/readthedocs/sphinx-autoapi>`_ to automatically generate descriptions and API documentation for any class or method with a numpy-formatted docstring. This tool automatically parses the codebase.

Expand Down
28 changes: 14 additions & 14 deletions docs/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
Getting Started
***************

This page is a guide on how get started with the ``uavf`` API.
This page is a guide on how get started with the :py:package:`uavfpy` API.

Prerequisites
=============

We have tested the API under linux and MacOS. Development of ``uavf`` is possible under Windows also.
We have tested the API under linux and MacOS. Development of :py:package:`uavfpy` is possible under Windows also.

Our release targets Python 3.8.

.. note::

``odcl`` uses the tflite runtime for inference. You can perform inference on the CPU, but this can be very slow. The vehicle uses the `Coral Edge TPU <https://www.coral.ai/docs/>`_ for on-board acceleration of inferencing.
:py:mod:`uavfpy.odcl` uses the tflite runtime for inference. You can perform inference on the CPU, but this can be very slow. The vehicle uses the `Coral Edge TPU <https://www.coral.ai/docs/>`_ for on-board acceleration of inferencing.

The Coral Edge TPU is an ASIC developed by Google specifically designed for accelerating deep learning. If you do not have access to an Edge TPU, you can use the CPU for inference.

Expand Down Expand Up @@ -51,10 +51,10 @@ First, we import necessary modules:
.. code-block:: python
# import classes
from odcl.inference import TargetInterpreter, Tiler
from odcl.utils.drawer import TargetDrawer
from odcl.color import Color
from odcl.pipeline import Pipeline
from uavfpy.odcl.inference import TargetInterpreter, Tiler
from uavfpy.odcl.utils.drawer import TargetDrawer
from uavfpy.odcl.color import Color
from uavfpy.odcl.pipeline import Pipeline
import logging, cv2
Then, we set paths to the example data and the models we downloaded. We also want to display logs.
Expand All @@ -71,9 +71,9 @@ Then, we set paths to the example data and the models we downloaded. We also wan
format="%(levelname)s:%(processName)s@%(module)s\t%(message)s", level=logging.INFO
)
The :py:class:`odcl.inference.TargetInterpreter` class handles inputs and outputs to the neural network for object detection. We give it paths to the model and labels, tell it whether to run on CPU or TPU, and set the threshold for detection.
The :py:class:`uavfpy.odcl.inference.TargetInterpreter` class handles inputs and outputs to the neural network for object detection. We give it paths to the model and labels, tell it whether to run on CPU or TPU, and set the threshold for detection.

Instantiating a :py:class:`odcl.inference.TargetInterpreter` object takes a while, so this object should be created outside of a loop if latency is at issue.
Instantiating a :py:class:`uavfpy.odcl.inference.TargetInterpreter` object takes a while, so this object should be created outside of a loop if latency is at issue.

.. code-block:: python
Expand All @@ -86,13 +86,13 @@ Instantiating a :py:class:`odcl.inference.TargetInterpreter` object takes a whil
order_key="efficientdetd0",
)
Next, we create the :py:class:`odcl.inference.Tiler`, which handles the tiling of the input image. We are dealing with inputs that are very large compared to the inputs of the neural network; the tiler will decompose the image into overlapping tiles, feed the NN, and then parse NN outputs from the respective tiles back into the raw image.
Next, we create the :py:class:`uavfpy.odcl.inference.Tiler`, which handles the tiling of the input image. We are dealing with inputs that are very large compared to the inputs of the neural network; the tiler will decompose the image into overlapping tiles, feed the NN, and then parse NN outputs from the respective tiles back into the raw image.

:py:class:`odcl.color.Color` is a class used to extract color information from found targets. For now, it does not take any arguments.
:py:class:`uavfpy.odcl.color.Color` is a class used to extract color information from found targets. For now, it does not take any arguments.

:py:class:`odcl.utils.drawer.TargetDrawer` is a utility class used to draw bounding boxes. Passing it as an argument will draw bounding boxes on the raw image and store the result into the :py:class:`Pipeline`'s :py:attr:`drawn` attribute. Passing it will also open a window to display targets that were found, along with the shape color-mask. Therefore, it is useful for evaluating the performance of the pipeline in real time.
:py:class:`uavfpy.odcl.utils.drawer.TargetDrawer` is a utility class used to draw bounding boxes. Passing it as an argument will draw bounding boxes on the raw image and store the result into the :py:class:`Pipeline`'s :py:attr:`drawn` attribute. Passing it will also open a window to display targets that were found, along with the shape color-mask. Therefore, it is useful for evaluating the performance of the pipeline in real time.

If a :py:class:`TargetDrawer` is not passed to the :py:class:`odcl.pipeline.Pipeline` constructor, the :py:class:`Pipeline` will not draw bounding boxes on the image, nor will found targets be displayed.
If a :py:class:`TargetDrawer` is not passed to the :py:class:`uavfpy.odcl.pipeline.Pipeline` constructor, the :py:class:`Pipeline` will not draw bounding boxes on the image, nor will found targets be displayed.

.. code-block:: python
Expand All @@ -108,7 +108,7 @@ If a :py:class:`TargetDrawer` is not passed to the :py:class:`odcl.pipeline.Pipe
# create the pipeline object
pipeline = Pipeline(interpreter, tiler, color, drawer)
The :py:meth:`odcl.pipeline.Pipeline.run` method takes an image and returns a list of found targets.
The :py:meth:`uavfpy.odcl.pipeline.Pipeline.run` method takes an image and returns a list of found targets.

.. code-block:: python
Expand Down
16 changes: 8 additions & 8 deletions docs/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ Purpose of This Software

This package is a collection of tools for UCI's competition team at the `AUVSI SUAS <https://www.auvsi-suas.org/>`_. The AUVSI SUAS is a student competition in which an Autonomous Aerial System navigates through waypoints, avoids other vehicles and static obstacles, identifies and submits objects on the ground, and performs mapping tasks.

This package contains python modules for:
This :py:package:`uavfpy` contains python modules for:

* Autonomous Navigation (``planner``)
* Object Detection, Classification, and Localization (``odcl``)
* Interoperability with the AUVSI SUAS (``interop``)
* Autonomous Navigation (:py:mod:`uavfpy.planner`)
* Object Detection, Classification, and Localization (:py:mod:`uavfpy.odcl`)
* Interoperability with the AUVSI SUAS

This package is intended to be deployed both on the vehicle and on the ground station. To orchestrate the mission and manage communications between the vehicle and the ground, we use `ROS Noetic <http://wiki.ros.org/noetic>`_.

Expand Down Expand Up @@ -63,8 +63,8 @@ Repository Structure

Therefore, there are two branches in the repository:

* ``main`` -- contains the python package
* ``ROS`` -- contains the ROS package
* ``main`` -- contains the ``uavf`` python package
* ``ROS`` -- contains the ``rosuavf`` ROS package

The development of these two branches are kept *entirely separate*.

Expand All @@ -74,7 +74,7 @@ To install the package to system python (e.g., on board the UAV or on the Ground
pip install git+https://github.com/uci-uav-forge/uavf.git
outside of a virtual environment. This will install the ``uavf`` package into the system python. Then, from ``catkin_ws/src``, we run:
outside of a virtual environment. This will install the :py:package:`uavfpy` package into the system python. Then, from ``catkin_ws/src``, we run:

.. code-block:: bash
Expand All @@ -84,4 +84,4 @@ outside of a virtual environment. This will install the ``uavf`` package into th
catkin make
to checkout the ROS package and build it. Inside of the ROS software, we can import the python package and use its APIs.
to checkout the ROS package and build it. Inside of the ROS software, we can import :py:package:`uavfpy` and use its APIs.
10 changes: 5 additions & 5 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[metadata]
name = odcl
version = attr: odcl.__version__
name = uavfpy
version = attr: uavfpy.__version__
author = Mike Sutherland, An Dang, & the UAV Forge Team
author_email = [email protected]
url = https://uci-uav-forge.github.io/odcl/
description = "UCI UAV Forge's Object Detection, Classification, and Localization Framework"
url = https://uci-uav-forge.github.io/uavf/
description = "UCI UAV Forge's Software for the AUVSI Student Unmanned Aerial Systems competition"
long_description = file: README.md
long_description_content_type = text/markdown
keywords = object detection, uav
keywords = object detection, uav, path planning
license = MIT
classifiers =
Programming Language :: Python :: 3.7
Expand Down
1 change: 0 additions & 1 deletion src/odcl/__init__.py

This file was deleted.

1 change: 0 additions & 1 deletion src/odcl/version.py

This file was deleted.

1 change: 1 addition & 0 deletions src/uavfpy/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.1.0"
File renamed without changes.
1 change: 1 addition & 0 deletions src/uavfpy/odcl/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.1.0"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit b8428f3

Please sign in to comment.