Skip to content

Commit

Permalink
Implemented base control architecture and demonstrations (#11)
Browse files Browse the repository at this point in the history
* Added skeleton packages for controllers

* Added vcs install to devcontainers and fixed example_pkg build error

* Fixed clang format andlicense

* Implemented velocity controller, TAM controller, and thruster controller (#6)

* Started ISMC implementation

* Continued implementing ismc

* Started implementation file

* Added hydrodynamic parameters

* Added generate_parameter_library integration

* Added everything but state callback and control law

* Added system state updates

* Finished initial version of velocity controller

* Cleanup and minor bug fixes

* Added missing imports

* Added dummy package for testing

* Added call to update state values

* thruster allocation matrix controller before testing

* changes according to PR comments

* Fixed pluginlib issue. Able to load both controllers but need to address why ros2_control node dies

* WIP: Modified URDF

* Partially works. Still need to fix TAM controller

* Save point

* Started fixed

* Added configuration type

* Rewrite of tam controller and isolated bug in velocity controller

* Added author names

* Cleaned up velocity controller and fixed some bugs

* Fixed bug with URDF and cleaned up thruster controller

* Finished thrust curve controller

* Fixed linter errors

* Fixed tam bug

* fixing tam todos. more work needed.

* Added deadband into thruster controller

* renamed command interface prefix to reference controller

* Updated meta package

* Added auv_control_msg package and fixed the TODOs in TAM controller

* Removed unnecessary deps

* Cleanup a bit

* Added missing dep for hydrodynamics to package configuration

* Updated to use effort interfaces

* Removed unused package

* Initial cleanup for pr

* Fixed precommit errors and attempting to fix ci workflow

* i hate devops so much

* take two

* Trying ros industrial again

* Trying again

* WHY

* tired

* Attempting to setup the upstream workspace

* fixed clang-tidy file and linter errors

* you win clang tidy

* Forgot to remove colcon build from devcontainer stage

* Resolved pr comments

---------

Co-authored-by: unknown <[email protected]>
Co-authored-by: EverardoG <[email protected]>
Co-authored-by: Rakesh Vivekanandan <[email protected]>

* Added documentation and examples to demonstrate project use (#10)

* Create README.md

Added a readme for the tam controller

* Update README.md

* additional edits to tam README.md

* fixed formatting README.md

* revert code block formatting and update summary in tam README.md

* Created README.md for velocity controller.

* Fixed velocity controller README.md formatting

* Created README.md for thrust controllers.

* Update README.md

* Update README.md

* Update README.md

* Updated main README

* Cleaned up readmes

* Fixed notice

* More formatting changes

* Fixed capitalization of chainable

* Fixed formatting in velocity control readme

* Added missing abbreviation declaration

* Implemented examples and associated documentation (#9)

* add auv_control_demos

* added example for individual controller

* updated package.xml

* minor fix to launch file

* Suggested PR changes

* Made some minor grammar fixes and added copyright to launch files

* Fixed lint errors in auv_control_demos top-level readme

* Made some formatting improvements to the chained controller demo

* Made some final small changes

---------

Co-authored-by: EverardoG <[email protected]>
Co-authored-by: Evan Palmer <[email protected]>

---------

Co-authored-by: coamitch <[email protected]>
Co-authored-by: Rakesh Vivekanandan <[email protected]>
Co-authored-by: Rakesh Vivekanandan <[email protected]>
Co-authored-by: EverardoG <[email protected]>

---------

Co-authored-by: unknown <[email protected]>
Co-authored-by: EverardoG <[email protected]>
Co-authored-by: Rakesh Vivekanandan <[email protected]>
Co-authored-by: coamitch <[email protected]>
Co-authored-by: Rakesh Vivekanandan <[email protected]>
  • Loading branch information
6 people authored Mar 19, 2024
1 parent cc2e521 commit c811671
Show file tree
Hide file tree
Showing 68 changed files with 3,549 additions and 252 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
Language: Cpp
BasedOnStyle: Google
ColumnLimit: 100
ColumnLimit: 120
MaxEmptyLinesToKeep: 1

IndentWidth: 2
Expand Down
73 changes: 30 additions & 43 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -25,56 +25,43 @@ Checks: >
-bugprone-easily-swappable-parameters,
-bugprone-implicit-widening-of-multiplication-result,
-clang-diagnostic-error,
-bugprone-exception-escape
-bugprone-exception-escape,
-misc-include-cleaner,
-bugprone-reserved-identifier
WarningsAsErrors: "*"
CheckOptions:
- key: readability-braces-around-statements.ShortStatementLines
value: "2"
- key: readability-identifier-naming.NamespaceCase
value: lower_case
- key: readability-identifier-naming.ClassCase
# type names
- key: readability-identifier-naming.ClassCase
value: CamelCase
- key: readability-identifier-naming.StructCase
- key: readability-identifier-naming.StructCase
value: CamelCase
- key: readability-identifier-naming.TemplateParameterCase,
value: CamelCase,
- key: readability-identifier-naming.FunctionCase
value: camelBack
- key: readability-identifier-naming.MethodCase
value: camelBack
- key: readability-identifier-naming.VariableCase
value: lower_case
- key: readability-identifier-naming.ClassMemberCase
value: lower_case
- key: readability-identifier-naming.ClassMemberSuffix
value: _
- key: readability-identifier-naming.PrivateMemberSuffix
value: _
- key: readability-identifier-naming.ProtectedMemberSuffix
value: _
- key: readability-identifier-naming.EnumConstantCase
value: CamelCase
- key: readability-identifier-naming.EnumConstantPrefix
value: k
- key: readability-identifier-naming.ConstexprVariableCase
value: CamelCase
- key: readability-identifier-naming.ConstexprVariablePrefix
value: k
- key: readability-identifier-naming.GlobalConstantCase
- key: readability-identifier-naming.EnumCase
value: CamelCase
- key: readability-identifier-naming.GlobalConstantPrefix
value: k
- key: readability-identifier-naming.MemberConstantCase
- key: readability-identifier-naming.UnionCase
value: CamelCase
- key: readability-identifier-naming.MemberConstantPrefix
value: k
- key: readability-identifier-naming.StaticConstantCase
value: CamelCase
- key: readability-identifier-naming.StaticConstantPrefix
value: k
- key: readability-implicit-bool-conversion.AllowIntegerConditions
value: 1
- key: readability-implicit-bool-conversion.AllowPointerConditions
value: 1
- key: readability-function-cognitive-complexity.IgnoreMacros
value: 1
# function names
- key: readability-identifier-naming.FunctionCase
value: lower_case
# method names
- key: readability-identifier-naming.MethodCase
value: lower_case
# variable names
- key: readability-identifier-naming.VariableCase
value: lower_case
- key: readability-identifier-naming.PrivateMemberSuffix
value: "_"
- key: readability-identifier-naming.ProtectedMemberSuffix
value: "_"
# const, static, or global variables
- key: readability-identifier-naming.EnumConstantCase
value: UPPER_CASE
- key: readability-identifier-naming.StaticConstantCase
value: UPPER_CASE
- key: readability-identifier-naming.GlobalConstantCase
value: UPPER_CASE
- key: readability-identifier-naming.ClassConstantCase
value: UPPER_CASE
2 changes: 0 additions & 2 deletions .devcontainer/nouveau/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ WORKDIR $USER_WORKSPACE

COPY --chown=$USER_UID:$USER_GID . src/$PROJECT_NAME

RUN ls src/$PROJECT_NAME

RUN sudo apt-get -q update \
&& sudo apt-get -q -y upgrade \
&& rosdep update \
Expand Down
3 changes: 2 additions & 1 deletion .devcontainer/nouveau/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"esbenp.prettier-vscode",
"xaver.clang-format",
"charliermarsh.ruff",
"ms-python.black-formatter"
"ms-python.black-formatter",
"josetr.cmake-language-support-vscode"
]
}
}
Expand Down
2 changes: 0 additions & 2 deletions .devcontainer/nvidia/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ WORKDIR $USER_WORKSPACE

COPY --chown=$USER_UID:$USER_GID . src/$PROJECT_NAME

RUN ls src/$PROJECT_NAME

RUN sudo apt-get -q update \
&& sudo apt-get -q -y upgrade \
&& rosdep update \
Expand Down
3 changes: 2 additions & 1 deletion .devcontainer/nvidia/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"esbenp.prettier-vscode",
"xaver.clang-format",
"charliermarsh.ruff",
"ms-python.black-formatter"
"ms-python.black-formatter",
"josetr.cmake-language-support-vscode"
]
}
}
Expand Down
45 changes: 5 additions & 40 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ FROM ros:$ROS_DISTRO-ros-base as ci
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /root/ws_ros

# Update to be your project's name
ENV PROJECT_NAME=auv_controllers

COPY . src/$PROJECT_NAME
Expand All @@ -28,7 +27,8 @@ RUN apt-get -q update \
&& rm -rf /var/lib/apt/lists/*

# Install all ROS dependencies needed for CI
RUN apt-get -q update \
RUN vcs import src < src/$PROJECT_NAME/ros2.repos \
&& apt-get -q update \
&& apt-get -q -y upgrade \
&& rosdep update \
&& rosdep install -y --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} --as-root=apt:false \
Expand All @@ -37,7 +37,7 @@ RUN apt-get -q update \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

FROM ci as robot
FROM ci as desktop

# Configure a new non-root user
ARG USERNAME=ros
Expand All @@ -61,12 +61,10 @@ WORKDIR $USER_WORKSPACE

COPY --chown=$USER_UID:$USER_GID . src/$PROJECT_NAME

# Uncomment to download and install external repos used by the project
# RUN vcs import src < src/$PROJECT_NAME/ros2.repos

# Install all ROS dependencies
WORKDIR $USER_WORKSPACE
RUN sudo apt-get -q update \
RUN vcs import src < src/$PROJECT_NAME/ros2.repos \
&& sudo apt-get -q update \
&& sudo apt-get -q -y upgrade \
&& rosdep update \
&& rosdep install -y --from-paths src --ignore-src -r --rosdistro ${ROS_DISTRO} \
Expand All @@ -80,39 +78,6 @@ RUN . "/opt/ros/${ROS_DISTRO}/setup.sh" \
&& echo "source ${USER_WORKSPACE}/install/setup.bash" >> /home/$USERNAME/.bashrc \
&& echo "if [ -f /opt/ros/${ROS_DISTRO}/setup.bash ]; then source /opt/ros/${ROS_DISTRO}/setup.bash; fi" >> /home/$USERNAME/.bashrc

FROM robot as desktop

ENV DEBIAN_FRONTEND=noninteractive
ENV USER_WORKSPACE=/home/$USERNAME/ws_ros
WORKDIR $USER_WORKSPACE

# Install tools needed for Gazebo installation
RUN sudo apt-get -q update \
&& sudo apt-get -q -y upgrade \
&& sudo apt-get install -y \
lsb-release \
wget \
gnupg \
&& sudo apt-get autoremove -y \
&& sudo apt-get clean -y \
&& sudo rm -rf /var/lib/apt/lists/*

# Set to the desired version of Gazebo
# Refer to the official documentation for the recommended pairings:
# https://gazebosim.org/docs/harmonic/ros_installation
ENV GAZEBO_VERSION=harmonic

RUN sudo wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null \
&& sudo apt-get -q update \
&& sudo apt-get -q -y upgrade \
&& sudo apt-get install -y \
gz-$GAZEBO_VERSION \
ros-$ROS_DISTRO-ros-gz$GAZEBO_VERSION \
&& sudo apt-get autoremove -y \
&& sudo apt-get clean -y \
&& sudo rm -rf /var/lib/apt/lists/*

FROM desktop as desktop-nvidia

# Install NVIDIA software
Expand Down
9 changes: 6 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

# Except the following
!requirements-dev.txt

# Allow your ROS 2 packages here, e.g.:
!example_pkg
!auv_controllers
!velocity_controllers
!thruster_allocation_matrix_controller
!thruster_controllers
!auv_control_msgs
!ros2.repos
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ jobs:
uses: ros-industrial/industrial_ci@master
env:
DOCKER_IMAGE: ghcr.io/robotic-decision-making-lab/auv_controllers:${{ matrix.env.IMAGE }}
UPSTREAM_WORKSPACE: ros2.repos
AFTER_SETUP_UPSTREAM_WORKSPACE: vcs pull $BASEDIR/upstream_ws/src
AFTER_SETUP_DOWNSTREAM_WORKSPACE: vcs pull $BASEDIR/downstream_ws/src
CXXFLAGS: >-
-Wall -Wextra -Wpedantic -Wwrite-strings -Wunreachable-code -Wpointer-arith -Wredundant-decls
CC: ${{ env.CLANG_TIDY && 'clang' }}
Expand Down
48 changes: 0 additions & 48 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,54 +55,6 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
push: ${{ env.PUSH }}

robot:
strategy:
fail-fast: false
matrix:
ROS_DISTRO: [iron]
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/[email protected]

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log into registry
if: env.PUSH == 'true'
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Docker metadata
if: env.PUSH == 'true'
id: meta
uses: docker/[email protected]
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=raw,value=${{ matrix.ROS_DISTRO }}-${{ github.job }}
- name: Build and push Docker image
uses: docker/[email protected]
with:
context: .
file: .docker/Dockerfile
build-args: ROS_DISTRO=${{ matrix.ROS_DISTRO }}
target: ${{ github.job }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: ${{ env.PUSH }}
platforms: linux/amd64,linux/arm64

desktop:
strategy:
fail-fast: false
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ROS 2
build
install
log
build/
install/
log/
3 changes: 2 additions & 1 deletion .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"includePath": [
"${workspaceFolder}/**",
"/opt/ros/iron/include/**",
"/usr/include/gz/**"
"/usr/include/eigen3/**",
"/home/ros/ws_ros/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"C_Cpp.codeAnalysis.clangTidy.codeAction.formatFixes": true,
"clang-format.executable": "/usr/bin/clang-format-14",
"[cpp]": {
"editor.rulers": [100],
"editor.rulers": [120],
"editor.tabSize": 2,
"editor.defaultFormatter": "xaver.clang-format"
},
Expand Down
41 changes: 17 additions & 24 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
BSD 3-Clause License
MIT License

Copyright (c) 2024, Robotic Decision Making Lab
Copyright (c) 2024 Evan Palmer

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
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:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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.
Loading

0 comments on commit c811671

Please sign in to comment.