Skip to content

Commit

Permalink
Refactor driver library to follow patterns from PickNikRobotics/ros2_…
Browse files Browse the repository at this point in the history
…epick_gripper (#34)
  • Loading branch information
kineticsystem authored Oct 31, 2023
1 parent 8e40258 commit 29ce398
Show file tree
Hide file tree
Showing 52 changed files with 3,236 additions and 892 deletions.
76 changes: 65 additions & 11 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,20 +1,74 @@
---
Language: Cpp
BasedOnStyle: Google
ColumnLimit: 120
MaxEmptyLinesToKeep: 1
SortIncludes: false

Standard: Auto
IndentWidth: 2
TabWidth: 2
UseTab: Never
AccessModifierOffset: -2
AlignAfterOpenBracket: AlwaysBreak
ConstructorInitializerIndentWidth: 2
NamespaceIndentation: None
ContinuationIndentWidth: 4
IndentCaseLabels: true
IndentFunctionDeclarationAfterType: false

AlignEscapedNewlinesLeft: false
AlignTrailingComments: true

AllowAllParametersOfDeclarationOnNextLine: false
ExperimentalAutoDetectBinPacking: false
ObjCSpaceBeforeProtocolList: true
Cpp11BracedListStyle: false

AllowShortBlocksOnASingleLine: true
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortCaseLabelsOnASingleLine: false

AlwaysBreakTemplateDeclarations: true
AlwaysBreakBeforeMultilineStrings: false
BreakBeforeBinaryOperators: false
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: true

BinPackParameters: true
ConstructorInitializerAllOnOneLineOrOnePerLine: true
DerivePointerBinding: false
PointerBindsToType: true

PenaltyExcessCharacter: 50
PenaltyBreakBeforeFirstCallParameter: 30
PenaltyBreakComment: 1000
PenaltyBreakFirstLessLess: 10
PenaltyBreakString: 100
PenaltyReturnTypeOnItsOwnLine: 50

SpacesBeforeTrailingComments: 2
SpacesInParentheses: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpaceAfterCStyleCast: false
SpaceAfterControlStatementKeyword: true
SpaceBeforeAssignmentOperators: true

# Configure each individual brace in BraceWrapping
BreakBeforeBraces: Custom

# Control of individual brace wrapping cases
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterEnum: true
BreakBeforeBraces: Custom
ColumnLimit: 100
ConstructorInitializerIndentWidth: 0
ContinuationIndentWidth: 2
DerivePointerAlignment: false
PointerAlignment: Middle
ReflowComments: false
...
AfterUnion: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
20 changes: 10 additions & 10 deletions .github/workflows/ci-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ on:
jobs:
pre-commit:
name: Format
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected]
with:
python-version: '3.10'
- name: Install system hooks
run: sudo apt install -qq clang-format-14 cppcheck
- uses: pre-commit/[email protected]
with:
extra_args: --all-files --hook-stage manual
- uses: actions/checkout@v3
- uses: actions/[email protected]
with:
python-version: "3.10"
- name: Install system hooks
run: sudo apt install -qq clang-format-14 cppcheck
- uses: pre-commit/[email protected]
with:
extra_args: --all-files --hook-stage manual
52 changes: 24 additions & 28 deletions .github/workflows/ci-ros-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,37 @@ on:
jobs:
ament_lint:
name: ament_${{ matrix.linter }}
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
linter: [cppcheck, copyright, lint_cmake]
linter: [copyright, lint_cmake]
steps:
- uses: actions/checkout@v3
- uses: ros-tooling/[email protected]
- uses: ros-tooling/[email protected]
with:
distribution: rolling
linter: ${{ matrix.linter }}
package-name:
robotiq_driver
robotiq_controllers
robotiq_description
- uses: actions/checkout@v3
- uses: ros-tooling/[email protected]
- uses: ros-tooling/[email protected]
with:
distribution: rolling
linter: ${{ matrix.linter }}
package-name: robotiq_driver
robotiq_controllers
robotiq_description


ament_lint_100:
ament_lint_121:
name: ament_${{ matrix.linter }}
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
linter: [cpplint]
linter: [cpplint]
steps:
- uses: actions/checkout@v3
- uses: ros-tooling/[email protected]
- uses: ros-tooling/[email protected]
with:
distribution: rolling
linter: cpplint
arguments: "--linelength=100 --filter=-whitespace/newline"
package-name:
robotiq_driver
robotiq_controllers
robotiq_description
ros2_robotiq_gripper
- uses: actions/checkout@v3
- uses: ros-tooling/[email protected]
- uses: ros-tooling/[email protected]
with:
distribution: rolling
linter: cpplint
arguments: "--linelength=121 --filter=-whitespace/newline"
package-name: robotiq_driver
robotiq_controllers
robotiq_description
26 changes: 11 additions & 15 deletions .github/workflows/prerelease-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,27 @@ on:
workflow_dispatch:
inputs:
ros_distro:
description: 'Chose ROS distribution'
description: "Chose ROS distribution"
required: true
default: 'rolling'
default: "rolling"
type: choice
options:
- foxy
- galactic
- humble
- iron
- rolling
- humble
- iron
- rolling
branch:
description: 'Chose branch for distro'
description: "Chose branch for distro"
required: true
default: 'master'
default: "main"
type: choice
options:
- foxy
- galactic
- humble
- iron
- master
- humble
- iron
- master

jobs:
pre_release:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
Expand Down
27 changes: 13 additions & 14 deletions .github/workflows/reusable-industrial-ci-with-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,51 +6,50 @@ on:
workflow_call:
inputs:
ref_for_scheduled_build:
description: 'Reference on which the repo should be checkout for scheduled build. Usually is this name of a branch or a tag.'
default: ''
description: "Reference on which the repo should be checkout for scheduled build. Usually is this name of a branch or a tag."
default: ""
required: false
type: string

upstream_workspace:
description: 'UPSTREAM_WORKSPACE variable for industrial_ci. Usually path to local .repos file.'
description: "UPSTREAM_WORKSPACE variable for industrial_ci. Usually path to local .repos file."
required: true
type: string
ros_distro:
description: 'ROS_DISTRO variable for industrial_ci'
description: "ROS_DISTRO variable for industrial_ci"
required: true
type: string
ros_repo:
description: 'ROS_REPO to run for industrial_ci. Possible values: "main", "testing"'
default: 'main'
default: "main"
required: false
type: string
os_code_name:
description: 'OS_CODE_NAME variable for industrial_ci'
default: ''
description: "OS_CODE_NAME variable for industrial_ci"
default: ""
required: false
type: string
before_install_upstream_dependencies:
description: 'BEFORE_INSTALL_UPSTREAM_DEPENDENCIES variable for industrial_ci'
default: ''
description: "BEFORE_INSTALL_UPSTREAM_DEPENDENCIES variable for industrial_ci"
default: ""
required: false
type: string

ccache_dir:
description: 'Local path to store cache (from "github.workspace"). For standard industrial_ci configuration do not have to be changed'
default: '.ccache'
default: ".ccache"
required: false
type: string
basedir:
description: 'Local path to workspace base directory to cache (from "github.workspace"). For standard industrial_ci configuration do not have to be changed'
default: '.work'
default: ".work"
required: false
type: string


jobs:
reusable_industrial_ci_with_cache:
name: ${{ inputs.ros_distro }} ${{ inputs.ros_repo }} ${{ inputs.os_code_name }}
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
env:
CCACHE_DIR: ${{ github.workspace }}/${{ inputs.ccache_dir }}
BASEDIR: ${{ github.workspace }}/${{ inputs.basedir }}
Expand Down Expand Up @@ -80,7 +79,7 @@ jobs:
restore-keys: |
ccache-${{ env.CACHE_PREFIX }}-${{ github.sha }}
ccache-${{ env.CACHE_PREFIX }}
- uses: 'ros-industrial/industrial_ci@master'
- uses: "ros-industrial/industrial_ci@master"
env:
UPSTREAM_WORKSPACE: ${{ inputs.upstream_workspace }}
ROS_DISTRO: ${{ inputs.ros_distro }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,17 @@ class RobotiqActivationController : public controller_interface::ControllerInter

controller_interface::InterfaceConfiguration state_interface_configuration() const override;

controller_interface::return_type update(
const rclcpp::Time & time, const rclcpp::Duration & period) override;
controller_interface::return_type update(const rclcpp::Time& time, const rclcpp::Duration& period) override;

CallbackReturn on_activate(const rclcpp_lifecycle::State & previous_state) override;
CallbackReturn on_activate(const rclcpp_lifecycle::State& previous_state) override;

CallbackReturn on_deactivate(const rclcpp_lifecycle::State & previous_state) override;
CallbackReturn on_deactivate(const rclcpp_lifecycle::State& previous_state) override;

CallbackReturn on_init() override;

private:
bool reactivateGripper(
std_srvs::srv::Trigger::Request::SharedPtr req,
std_srvs::srv::Trigger::Response::SharedPtr resp);
bool reactivateGripper(std_srvs::srv::Trigger::Request::SharedPtr req,
std_srvs::srv::Trigger::Response::SharedPtr resp);

static constexpr double ASYNC_WAITING = 2.0;
enum CommandInterfaces
Expand Down
Loading

0 comments on commit 29ce398

Please sign in to comment.