Skip to content

Commit

Permalink
Implement driver and controller interfaces (#25)
Browse files Browse the repository at this point in the history
* Started project configuration

* Added missing dotfiles

* Started implementation of alpha driver

* continued implementation of alpha driver

* Finished initial crc implementation and started devops error resolution

* Working on resolving build errors for tests

* Resolved linking errors with testing in cmakelists

* cleaned up alpha driver cmakelists file

* Resolved bugs in crc calculation

* implemented cobs encoding and cleaned up crc methods

* Revert back to clang formatting

* added support for clang tidy and resolved clang tidy errors

* resolved copyright errors

* forgot to save

* more files that i forgot to save

* Started designing ros messages

* Implemented support for packet decoding

* Cleanup

* implemented unit tests for packet

* Resolve type warnings and discrepancies between cpplint and clang format

* Made a packet ros msg for comms between driver and control interface

* save point

* started implementing terminal configurations and serial device initialization

* added methods to send data and register read callbacks

* Added support for configuring read to block

* Added active public member

* started implementing heartbeat monitor

* Clean up linter errors

* Cleaned up some guidelines violations and integrated logging support into client

* Finished up initial implementation of serial client

* started implementation of ros wrapper for driver

* resolved some bugs in the serial client

* Resolved bug in serial read

* Cleaned up implemented and comments

* added heartbeat monitor

* sorry google but i hate your method naming convention

* rip buildx

* started refactoring to support ros2 control and started systeminterface implementation

* Continued refactoring driver to better support ros2 control integration

* Cleaned up comments and added new request method

* Converted driver to library and separated control interface

* get rid of gross src directory

* forgot to actually remove src

* started implementation of hardware interface

* removed alpha msgs package and added bringup and description packages

* started implementation of init method

* finished initial version of hardware interface on_init

* started implementing on_cleanup

* added logs and try catch blocks for mode switching

* Remove files from develop to start enforcing pr process

* Starting down the rabbit hole of exception safe code.. cheers Jon Kalb

* Integrate a Linux serial driver with ros2_control position, velocity, and joint trajectory control (#18)

* updated exceptions according to feedback from code review

* removed unnecessary consts

* Integrate ros2_control for position, velocity, and joint trajectory control (#11)

* moved ros2 control work to new branch

* started adding support for position control

* quick save

* Implemented command and state interface exports

* Resolve merge conflicts

* Save point

* added on_configure method

* finished read and write methods

* Implemented initial version of write method

* ported meshes and URDFs from reach sdk

* Added urdf specifications and rviz launch

* fix logger naming in hardware description

* added missing readme

* added missing readme

* starting integration of ros2_control xacro

* fix readme link

* Remove italics

* added ros2_control descriptions nad config and gazebo macro

* added moveit

* started moveit2 integration

* Starting to migrate moveit2 configs to description package

* started working on adding launch files

* removed joint state gui

* squashed system hardware bugs and continued bringup

* why does gazebo suck so much

* Save point

* finished first versions of launch files.. time to debug

* Fixed moveit configs

* curse you moveit

* fixed controller execution

* fixed rviz launch with gazebo

* fixed moveit bugs

* debugging gazebo

* Removed gazebo stuff for time being

* started system cleanup for PR

* i guess its ros 2 not ros2

* cleaned up bringup package

* cleaned up folder structure

* starting cleanup of documentation

* IMPORTANT GAZEBO SAVE POINT

* added gazebo to dockerfile

* Added documented inertial properties

* fixed bugs in state callbacks

* continued bug fixes

* save point for ramen

* resolved bugs in hardware configuration with moveit

* first pass for PR

* Resolved *most* of the comments from the pr review

* fixed joint limit issues

* Fixed initial positions file error

* Added missing changelog document

* Fixed camera angles for rviz and gazebo

* Fixed moveit rviz camera angle

* fixed order of moveit controllers

* Created a CODE_OF_CONDUCT document (#19)

* Integrate GH actions CI/CD pipelines (#21)

* started docker then got distracted

* split dev image from production images

* take 1

* take 2

* moving ci integration here to make docker updates easier

* testing precommit pipeline

* take one on ci

* ran with wrong branch

* attempt to use clang style config files

* another attempt at clang format

* testing different version of clang tidy

* testing to see if ici catches bug in test

* attempt to disable clang format checks

* remove clang format from build tests in favor of pre-commit

* weird things happening with tidy

* weird things happening with tidy

* im tired and want to go to bed

* im just guessing at this point

* another random test

* disable ici clang tidy in favor of other workflow

* why

* why

* why

* pain

* sad

* this is as good as it's going to get

* put env variable in wrong spot

* fixed readme. time for bed

* fixed readme. time for bed

* fixed readme. time for bed

* removed test branch from ci pipeline. actually going to bed now

* Resolved PR comments
  • Loading branch information
evan-palmer authored Mar 6, 2023
1 parent 643f9b0 commit 32a1072
Show file tree
Hide file tree
Showing 79 changed files with 5,555 additions and 3 deletions.
27 changes: 27 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
Language: Cpp
BasedOnStyle: Google
ColumnLimit: 100
MaxEmptyLinesToKeep: 1

IndentWidth: 2
TabWidth: 2
UseTab: Never
AccessModifierOffset: -2
AlignAfterOpenBracket: AlwaysBreak
ConstructorInitializerIndentWidth: 0
ContinuationIndentWidth: 2
DerivePointerAlignment: false
PointerAlignment: Middle
PackConstructorInitializers: Never

# Configure brace wrapping cases
BreakBeforeBraces: Custom
BraceWrapping:
AfterClass: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterUnion: true
BeforeCatch: true
81 changes: 81 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
Checks: >
-*,
abseil-*,
bugprone-*,
google-*,
misc-*,
modernize-*,
performance-*,
portability-*,
readability-*,
-google-readability-braces-around-statements,
-google-readability-namespace-comments,
-google-runtime-references,
-misc-non-private-member-variables-in-classes,
-modernize-return-braced-init-list,
-modernize-use-trailing-return-type,
-performance-move-const-arg,
-readability-braces-around-statements,
-readability-identifier-length,
-readability-magic-numbers,
-readability-named-parameter,
-readability-redundant-declaration,
-readability-function-cognitive-complexity,
-bugprone-narrowing-conversions,
-bugprone-easily-swappable-parameters,
-bugprone-implicit-widening-of-multiplication-result,
-modernize-avoid-bind,
-modernize-use-nodiscard
WarningsAsErrors: "*"
CheckOptions:
- key: readability-braces-around-statements.ShortStatementLines
value: "2"
- key: readability-identifier-naming.NamespaceCase
value: lower_case
- key: readability-identifier-naming.ClassCase
value: CamelCase
- 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
value: CamelCase
- key: readability-identifier-naming.GlobalConstantPrefix
value: k
- key: readability-identifier-naming.MemberConstantCase
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
94 changes: 94 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
ARG ROS_DISTRO=rolling

FROM ros:$ROS_DISTRO as core

LABEL maintainer="Evan Palmer"
LABEL maintainer-email="[email protected]"

ENV DEBIAN_FRONTEND=noninteractive

# Install core apt dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
apt-utils \
software-properties-common \
git \
wget \
gnupg2 \
lsb-release \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

# Install core ROS dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
ros-$ROS_DISTRO-robot-state-publisher \
ros-$ROS_DISTRO-xacro \
ros-$ROS_DISTRO-ros2-control \
ros-$ROS_DISTRO-ros2-controllers \
ros-$ROS_DISTRO-controller-manager \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

FROM core as ci

# Install CI apt dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
clang-format \
python3-dev \
python3-pip \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

# Install debugging/linting Python packages
RUN pip3 install \
black \
flake8 \
isort \
pydocstyle \
pre-commit \
mypy

FROM ci as base

RUN apt-get update && apt-get install -y --no-install-recommends \
ros-$ROS_DISTRO-rviz2 \
ros-dev-tools \
ros-$ROS_DISTRO-moveit \
ros-$ROS_DISTRO-gazebo-ros-pkgs \
ros-$ROS_DISTRO-gazebo-ros2-control \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

FROM base as develop

RUN apt-get update && apt-get install -y --no-install-recommends \
iputils-ping \
net-tools \
lsb-release \
gdb \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

# Configure a new non-root user
ARG USERNAME=dev
ARG USER_UID=1000
ARG USER_GID=$USER_UID

RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
&& apt-get update \
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME \
&& rm -rf /var/lib/apt/lists/* \
&& echo "source /usr/share/bash-completion/completions/git" >> /home/$USERNAME/.bashrc \
&& echo "if [ -f /opt/ros/${ROS_DISTRO}/setup.bash ]; then source /opt/ros/${ROS_DISTRO}/setup.bash; fi" >> /home/$USERNAME/.bashrc

ARG WORKSPACE
RUN echo "if [ -f ${WORKSPACE}/install/setup.bash ]; then source ${WORKSPACE}/install/setup.bash; fi" >> /home/$USERNAME/.bashrc
RUN echo "export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:${WORKSPACE}/" >> /home/$USERNAME/.bashrc
RUN echo "source /usr/share/gazebo/setup.sh" >> /home/$USERNAME/.bashrc
145 changes: 145 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
{
"dockerFile": "Dockerfile",
"build": {
"args": {
"WORKSPACE": "${containerWorkspaceFolder}",
"ROS_DISTRO": "humble"
}
},
"remoteUser": "dev",
"runArgs": [
"--network=host",
"--cap-add=SYS_PTRACE",
"--security-opt=seccomp:unconfined",
"--security-opt=apparmor:unconfined",
"--volume=/dev:/dev",
"--privileged"
],
"containerEnv": {
"DISPLAY": "${localEnv:DISPLAY}",
"WAYLAND_DISPLAY": "${localEnv:WAYLAND_DISPLAY}",
"XDG_RUNTIME_DIR": "${localEnv:XDG_RUNTIME_DIR}",
"PULSE_SERVER": "${localEnv:PULSE_SERVER}"
},
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.profiles.linux": {
"bash": {
"path": "/bin/bash"
}
},
"terminal.integrated.defaultProfile.linux": "bash",
"files.associations": {
"*.repos": "yaml",
"*.world": "xml",
"*.xacro": "xml",
"*.srdf": "xml",
"*.rviz": "yaml"
},
"files.eol": "\n",
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"editor.acceptSuggestionOnEnter": "smart",
"editor.wordWrap": "on",
"editor.formatOnSave": true,
"editor.tabSize": 2,
"editor.rulers": [80],
"editor.defaultFormatter": "esbenp.prettier-vscode",
"xml.format.maxLineWidth": 80,
"json.format.enable": true,
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.linting.pylintEnabled": false,
"python.linting.pydocstyleEnabled": true,
"python.linting.mypyEnabled": true,
"python.formatting.provider": "black",
"python.formatting.blackPath": "/usr/local/bin/black",
"python.autoComplete.extraPaths": [
"/opt/ros/humble/lib/python3.10/site-packages/"
],
"python.analysis.extraPaths": [
"/opt/ros/humble/lib/python3.10/site-packages/"
],
"C_Cpp.default.intelliSenseMode": "linux-gcc-x86",
"C_Cpp.clang_format_fallbackStyle": "Google",
"C_Cpp.codeAnalysis.clangTidy.enabled": true,
"C_Cpp.codeAnalysis.clangTidy.runAutomatically": true,
"clang-format.executable": "/usr/bin/clang-format",
"uncrustify.configPath.linux": "/opt/ros/humble/lib/python3.10/site-packages/ament_uncrustify/configuration/ament_code_style.cfg",
"[cpp]": {
"editor.wordBasedSuggestions": false,
"editor.suggest.insertMode": "replace",
"editor.semanticHighlighting.enabled": true,
"editor.rulers": [100],
"editor.defaultFormatter": "xaver.clang-format",
"editor.formatOnSave": true
},
"[python]": {
"editor.tabSize": 4,
"editor.rulers": [90],
"editor.defaultFormatter": "ms-python.python",
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
"editor.formatOnSave": true
},
"[dockerfile]": {
"editor.quickSuggestions": {
"strings": true
},
"editor.defaultFormatter": "ms-azuretools.vscode-docker",
"editor.tabSize": 4
},
"[json]": {
"editor.quickSuggestions": {
"strings": true
},
"editor.suggest.insertMode": "replace"
},
"[xml]": {
"editor.defaultFormatter": "redhat.vscode-xml"
},
"[yaml]": {
"editor.insertSpaces": true,
"editor.autoIndent": "advanced",
"editor.defaultFormatter": "redhat.vscode-yaml"
},
"[markdown]": {
"editor.unicodeHighlight.ambiguousCharacters": false,
"editor.unicodeHighlight.invisibleCharacters": false,
"diffEditor.ignoreTrimWhitespace": false,
"editor.wordWrap": "on",
"editor.quickSuggestions": {
"comments": "off",
"strings": "off",
"other": "off"
}
},
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/*.code-search": true,
"**/build": true,
"**/install": true,
"**/log": true
}
},
"extensions": [
"ms-azuretools.vscode-docker",
"ms-python.python",
"ms-python.vscode-pylance",
"njpwerner.autodocstring",
"redhat.vscode-xml",
"redhat.vscode-yaml",
"cschlosser.doxdocgen",
"ms-vscode.cpptools",
"josetr.cmake-language-support-vscode",
"smilerobotics.urdf",
"DavidAnson.vscode-markdownlint",
"esbenp.prettier-vscode",
"xaver.clang-format"
]
}
}
}
Loading

0 comments on commit 32a1072

Please sign in to comment.