Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor driver library to follow patterns from PickNikRobotics/ros2_epick_gripper #34

Merged
merged 48 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
6b782ba
Refactoring for testability.
kineticsystem Sep 5, 2023
d32b44e
Added simple test.
kineticsystem Sep 5, 2023
1a8aeeb
Pre-commits.
kineticsystem Sep 5, 2023
ddda502
Added missing packages for testing.
kineticsystem Sep 5, 2023
79dfec4
In the on_configure method we try to connect to the hardware.
kineticsystem Sep 5, 2023
f371468
Added missing package.
kineticsystem Sep 5, 2023
c11d657
Refactoring.
kineticsystem Sep 5, 2023
76c5497
Removed not existing package.
kineticsystem Sep 5, 2023
8788593
Removed ros-linter. Reformatted code as per Studio conventions.
kineticsystem Sep 5, 2023
d7cfc1b
Revert "Auxiliary commit to revert individual files from 878859365914…
kineticsystem Sep 5, 2023
46b8b58
Linting packages.
kineticsystem Sep 5, 2023
92eefce
Remove ros linting clashing with .clang-format.
kineticsystem Sep 5, 2023
19569f8
Revert "Auxiliary commit to revert individual files from 92eefce7151f…
kineticsystem Sep 5, 2023
dad1114
Updated CMakeLists.txt
kineticsystem Sep 5, 2023
de63c83
Removed connection to the serial port in the contructor.
kineticsystem Sep 5, 2023
312ab08
Refactoring for testing.
kineticsystem Sep 6, 2023
c1dc459
Pre-commits.
kineticsystem Sep 6, 2023
4c3eafc
Added copyright.
kineticsystem Sep 6, 2023
e1089ad
Increased max line size to 120.
kineticsystem Sep 6, 2023
d283f18
Fixed ROS lints.
kineticsystem Sep 6, 2023
2239dd9
Try to exclude tests from linting.
kineticsystem Sep 6, 2023
011df4b
Removed cppcheck linter because it has problem recognizing macros in …
kineticsystem Sep 6, 2023
7414c37
Trying to add ros2_control_test_assets to test CMakeLists.txt
kineticsystem Sep 6, 2023
56ddcd4
Tryint to build everything on Ubuntu 22.04.
kineticsystem Sep 6, 2023
51e98f8
Moved gripper_interface_test command into its own package.
kineticsystem Sep 6, 2023
dfe6f79
Some refactoring.
kineticsystem Sep 6, 2023
21dc2c7
Some refactoring.
kineticsystem Sep 6, 2023
6ccf695
Some refactoring.
kineticsystem Sep 6, 2023
9691e54
Test command refactored.
kineticsystem Sep 6, 2023
685fe55
Ongoing refactoring.
kineticsystem Sep 6, 2023
5a5a62d
Ongoing refactoring.
kineticsystem Sep 6, 2023
91a08d0
Removed bringup package.
kineticsystem Sep 6, 2023
03e3701
Added fake driver for testing. config folder moved from robotiq_drive…
kineticsystem Sep 7, 2023
bcd5fe6
Hardware interface and driver refactoring.
kineticsystem Sep 8, 2023
7301c64
Driver refactoring.
kineticsystem Sep 8, 2023
d719ed2
Fixed pre-commits.
kineticsystem Sep 8, 2023
a434edf
Update .github/workflows/prerelease-check.yml
kineticsystem Sep 8, 2023
fb01131
Update .github/workflows/prerelease-check.yml
kineticsystem Sep 8, 2023
a5a9468
Update .github/workflows/prerelease-check.yml
kineticsystem Sep 8, 2023
21d1b4f
Update .github/workflows/prerelease-check.yml
kineticsystem Sep 8, 2023
c5819d8
Update .github/workflows/prerelease-check.yml
kineticsystem Sep 8, 2023
1658cdf
Adding ros2_control_test_assets to CMakeLists.txt
kineticsystem Sep 8, 2023
9f0a100
Removed unecessary dependencies.
kineticsystem Sep 8, 2023
660eec5
Added CRC-16/MODBUS test.
kineticsystem Sep 14, 2023
0f41ce9
Unit tests.
kineticsystem Sep 14, 2023
f5d7b7a
Update robotiq_driver/CMakeLists.txt
kineticsystem Sep 28, 2023
4c3fd18
Removed version from CMakeLists.txt file.
kineticsystem Oct 27, 2023
b4b73e6
Merge branch 'main' into pr-refactoring
moriarty Oct 31, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this 121 ? that seems strange.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a bug in the clang formatter. Sometimes a line is cut at 121 and this causes this linter to fail.
I experienced this bug in one single line of code: hardware_interface.cpp line 73.
If you have any suggestions let me know, maybe I'm missing something.

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
Comment on lines +21 to +23
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must be an old/outdated file or one that was autogenerated or accidentally copied while setting up this repo.

This repo doesn't have humble/iron/master branches only main


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
Loading