Skip to content

Commit 62971a3

Browse files
authored
Feature/ci 2 (#10)
* Added ci * modified ci * applied ci * fixed typo detection * updated ci pipeline
1 parent d64b800 commit 62971a3

34 files changed

+340
-134
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Lint, Build & Test
2+
on:
3+
push:
4+
branches:
5+
- jazzy
6+
pull_request:
7+
branches:
8+
- jazzy
9+
defaults:
10+
run:
11+
shell: bash
12+
13+
jobs:
14+
Linting:
15+
name: Lint Code Base
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout Code
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Setup
24+
run: |
25+
sudo apt-get update && sudo apt-get install -y black clang-format cppcheck libxml2-utils
26+
27+
- name: Set up Python
28+
uses: actions/setup-python@v4
29+
30+
- name: Install and Run pre-commit
31+
uses: pre-commit/[email protected]
32+
with:
33+
extra_args: --all-files
34+
35+
36+
37+
38+
build-and-test:
39+
needs: Linting
40+
strategy:
41+
matrix:
42+
setup:
43+
- rosdistro: jazzy
44+
os: ubuntu-24.04
45+
- rosdistro: rolling
46+
os: ubuntu-latest
47+
runs-on: ${{ matrix.setup.os }}
48+
container:
49+
image: ros:${{ matrix.setup.rosdistro }}-ros-base
50+
steps:
51+
- name: install build tools
52+
run: |
53+
sudo apt-get update
54+
sudo apt-get install -y ros-dev-tools
55+
- uses: actions/checkout@v4
56+
with:
57+
repository: tu-darmstadt-ros-pkg/hector_transmission_interface
58+
path: src/hector_transmission_interface
59+
- uses: actions/checkout@v4
60+
with:
61+
path: src/repo
62+
- name: rosdep
63+
run: |
64+
rosdep update --rosdistro ${{ matrix.setup.rosdistro }} --include-eol-distros
65+
rosdep install -y --from-paths src --ignore-src --rosdistro ${{ matrix.setup.rosdistro }}
66+
- name: build
67+
run: |
68+
source /opt/ros/${{ matrix.setup.rosdistro }}/setup.bash
69+
colcon build
70+
- name: test
71+
run: |
72+
source /opt/ros/${{ matrix.setup.rosdistro }}/setup.bash
73+
colcon test
74+
colcon test-result --verbose

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
CMakeLists.txt.user*
22
.idea
33
cmake-build-*
4-
.vscode
4+
.vscode

.pre-commit-config.yaml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# To use:
2+
#
3+
# pre-commit run -a
4+
#
5+
# Or:
6+
#
7+
# pre-commit install # (runs every time you commit in git)
8+
#
9+
# To update this file:
10+
#
11+
# pre-commit autoupdate
12+
#
13+
# See https://github.com/pre-commit/pre-commit
14+
15+
repos:
16+
# Standard hooks
17+
- repo: https://github.com/pre-commit/pre-commit-hooks
18+
rev: v5.0.0
19+
hooks:
20+
- id: check-added-large-files
21+
- id: check-docstring-first
22+
- id: check-merge-conflict
23+
- id: check-symlinks
24+
- id: check-xml
25+
- id: check-yaml
26+
args: ["--allow-multiple-documents"]
27+
- id: end-of-file-fixer
28+
- id: mixed-line-ending
29+
- id: trailing-whitespace
30+
exclude_types: [rst]
31+
32+
# CPP Checks
33+
- repo: https://github.com/pre-commit/mirrors-clang-format
34+
rev: v20.1.4
35+
hooks:
36+
- id: clang-format
37+
name: Clang Format
38+
args: [--style=file]
39+
files: \.(cpp|hpp|h|c|cc)$
40+
41+
- repo: local
42+
hooks:
43+
- id: cppcheck
44+
name: Cppcheck
45+
entry: bash -c "cppcheck --force --quiet --inline-suppr --error-exitcode=1 --language=c++ $(find . -type d -name 'cmake-build-*' -prune -false -o -name '*.cpp' -o -name '*.hpp' -o -name '*.h' -o -name '*.c' -o -name '*.cc')"
46+
language: system
47+
files: \.(cpp|cc|hpp|h)$
48+
pass_filenames: false
49+
50+
# Python hooks
51+
- repo: https://github.com/astral-sh/ruff-pre-commit
52+
rev: v0.12.7
53+
hooks:
54+
- id: ruff-check
55+
args: [ --fix ]
56+
- id: ruff-format
57+
58+
# CMake Formatting
59+
- repo: https://github.com/cheshirekow/cmake-format-precommit
60+
rev: v0.6.13
61+
hooks:
62+
- id: cmake-format
63+
- id: cmake-lint
64+
65+
# Package XML
66+
- repo: https://github.com/Joschi3/package_xml_validation.git
67+
rev: v1.2.3
68+
hooks:
69+
- id: format-package-xml
70+
name: Validate and Format package.xml
71+
72+
# Spellcheck
73+
- repo: https://github.com/crate-ci/typos
74+
rev: v1.34.0
75+
hooks:
76+
- id: typos
77+
78+
# Prevent committing with Bug comments
79+
- repo: local
80+
hooks:
81+
- id: no-bug-comments
82+
name: 'No Bug comments'
83+
description: 'Prevent commit if Bug comments are present'
84+
entry: '(?i)#\s*bug'
85+
language: pygrep
86+
types: [file]
87+
88+
- repo: https://github.com/python-jsonschema/check-jsonschema
89+
rev: 0.33.2
90+
hooks:
91+
- id: check-github-workflows
92+
args: ["--verbose"]
93+
- id: check-github-actions
94+
args: ["--verbose"]

dynamixel_ros_control/CMakeLists.txt

Lines changed: 48 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ cmake_minimum_required(VERSION 3.8)
22
project(dynamixel_ros_control)
33

44
# Default to C++17
5-
if (NOT CMAKE_CXX_STANDARD)
5+
if(NOT CMAKE_CXX_STANDARD)
66
set(CMAKE_CXX_STANDARD 17)
77
set(CMAKE_CXX_STANDARD_REQUIRED ON)
8-
endif ()
8+
endif()
99

10-
if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
10+
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
1111
add_compile_options(-Wall -Wextra -Wpedantic)
12-
endif ()
12+
endif()
1313

1414
# Find dependencies
1515
find_package(ament_cmake REQUIRED)
@@ -20,7 +20,7 @@ find_package(hardware_interface REQUIRED)
2020
find_package(pluginlib REQUIRED)
2121
find_package(dynamixel_sdk REQUIRED)
2222
find_package(yaml-cpp REQUIRED)
23-
#find_package(dynamixel_ros_control_msgs REQUIRED)
23+
# find_package(dynamixel_ros_control_msgs REQUIRED)
2424
find_package(std_msgs REQUIRED)
2525
find_package(std_srvs REQUIRED)
2626
find_package(ament_index_cpp REQUIRED)
@@ -29,48 +29,61 @@ find_package(hector_transmission_interface REQUIRED)
2929
find_package(hector_transmission_interface_msgs REQUIRED)
3030
find_package(controller_orchestrator REQUIRED)
3131

32-
3332
set(HEADERS
34-
include/${PROJECT_NAME}/common.hpp
35-
include/${PROJECT_NAME}/joint.hpp
36-
include/${PROJECT_NAME}/dynamixel.hpp
37-
include/${PROJECT_NAME}/control_table.hpp
38-
include/${PROJECT_NAME}/control_table_item.hpp
39-
include/${PROJECT_NAME}/dynamixel_driver.hpp
40-
include/${PROJECT_NAME}/dynamixel_hardware_interface.hpp
41-
include/${PROJECT_NAME}/sync_read_manager.hpp
42-
include/${PROJECT_NAME}/sync_write_manager.hpp
43-
include/${PROJECT_NAME}/log.hpp
44-
)
33+
include/${PROJECT_NAME}/common.hpp
34+
include/${PROJECT_NAME}/joint.hpp
35+
include/${PROJECT_NAME}/dynamixel.hpp
36+
include/${PROJECT_NAME}/control_table.hpp
37+
include/${PROJECT_NAME}/control_table_item.hpp
38+
include/${PROJECT_NAME}/dynamixel_driver.hpp
39+
include/${PROJECT_NAME}/dynamixel_hardware_interface.hpp
40+
include/${PROJECT_NAME}/sync_read_manager.hpp
41+
include/${PROJECT_NAME}/sync_write_manager.hpp
42+
include/${PROJECT_NAME}/log.hpp)
4543

4644
set(SOURCES
47-
src/common.cpp
48-
src/joint.cpp
49-
src/dynamixel.cpp
50-
src/control_table.cpp
51-
src/control_table_item.cpp
52-
src/dynamixel_driver.cpp
53-
src/dynamixel_hardware_interface.cpp
54-
src/sync_read_manager.cpp
55-
src/sync_write_manager.cpp
56-
)
45+
src/common.cpp
46+
src/joint.cpp
47+
src/dynamixel.cpp
48+
src/control_table.cpp
49+
src/control_table_item.cpp
50+
src/dynamixel_driver.cpp
51+
src/dynamixel_hardware_interface.cpp
52+
src/sync_read_manager.cpp
53+
src/sync_write_manager.cpp)
5754
include_directories(include)
5855

5956
add_library(${PROJECT_NAME} SHARED ${SOURCES} ${HEADERS})
6057
target_link_libraries(${PROJECT_NAME} PUBLIC yaml-cpp)
61-
ament_target_dependencies(${PROJECT_NAME} PUBLIC rclcpp rclcpp_lifecycle lifecycle_msgs hardware_interface pluginlib
62-
dynamixel_sdk yaml-cpp std_msgs std_srvs ament_index_cpp transmission_interface hector_transmission_interface hector_transmission_interface_msgs controller_orchestrator)
58+
ament_target_dependencies(
59+
${PROJECT_NAME}
60+
PUBLIC
61+
rclcpp
62+
rclcpp_lifecycle
63+
lifecycle_msgs
64+
hardware_interface
65+
pluginlib
66+
dynamixel_sdk
67+
yaml-cpp
68+
std_msgs
69+
std_srvs
70+
ament_index_cpp
71+
transmission_interface
72+
hector_transmission_interface
73+
hector_transmission_interface_msgs
74+
controller_orchestrator)
6375

64-
pluginlib_export_plugin_description_file(hardware_interface dynamixel_ros_control.xml)
76+
pluginlib_export_plugin_description_file(hardware_interface
77+
dynamixel_ros_control.xml)
6578

6679
# Install library and include folder
67-
install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}-targets LIBRARY DESTINATION lib)
80+
install(
81+
TARGETS ${PROJECT_NAME}
82+
EXPORT ${PROJECT_NAME}-targets
83+
LIBRARY DESTINATION lib)
6884
install(DIRECTORY include/ DESTINATION include)
6985

7086
# Install directories
71-
install(DIRECTORY launch config devices
72-
DESTINATION share/${PROJECT_NAME}
73-
)
87+
install(DIRECTORY launch config devices DESTINATION share/${PROJECT_NAME})
7488

7589
ament_package()
76-

dynamixel_ros_control/devices/interface_to_register_names.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ limits:
2626
- interface_name: "effort"
2727
register_name: "torque_limit"
2828
- interface_name: "current"
29-
register_name: "current_limit"
29+
register_name: "current_limit"

dynamixel_ros_control/devices/models/H42-20-S300-R.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ unit_conversions: # dxl value to unit ratio
66
celsius: 1.0
77
V: 0.1
88
A: 0.00402832031
9-
9+
1010
indirect_addresses:
1111
# address start | data start | count
1212
- 49 | 634 | 256
13-
13+
1414
control_table:
1515
# addr | item name | length | access | memory | unit/type
1616
- 0 | model_number | 2 | R | EEPROM |

dynamixel_ros_control/devices/models/H42-20-S300-RA.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ unit_conversions: # dxl value to unit ratio
77
V: 0.1
88
ms: 1.0
99
A: 0.001
10-
10+
1111
indirect_addresses:
1212
# address start | data start | count
1313
- 168 | 634 | 128
14-
14+
1515
control_table:
1616
# addr | item name | length | access | memory | unit/type
1717
- 0 | model_number | 2 | R | EEPROM |

dynamixel_ros_control/devices/models/MX2.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# XM series
1+
# XM series
22
unit_conversions: # dxl value to unit ratio
33
rad: 0.001533936
44
rad_per_s: 0.023980117
@@ -8,7 +8,7 @@ unit_conversions: # dxl value to unit ratio
88
ms: 1.0
99
A: 0.00269
1010
load: 0.1
11-
11+
1212
indirect_addresses:
1313
# address start | data start | count
1414
#- 168 | 224 | 28

dynamixel_ros_control/devices/models/PH.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# PH-Series
1+
# PH-Series
22
unit_conversions: # dxl value to unit ratio
33
rad: 0.00000625911
44
rad_per_s: 0.00104719755
@@ -7,7 +7,7 @@ unit_conversions: # dxl value to unit ratio
77
V: 0.1
88
ms: 1.0
99
A: 0.001
10-
10+
1111
indirect_addresses:
1212
# address start | data start | count
1313
- 168 | 634 | 128
@@ -19,14 +19,14 @@ control_table:
1919
- 7 | id | 1 | RW | EEPROM |
2020
- 8 | baud_rate | 1 | RW | EEPROM |
2121
- 9 | return_delay_time | 1 | RW | EEPROM |
22-
- 10 | drive_mode | 1 | RW | EEPROM |
22+
- 10 | drive_mode | 1 | RW | EEPROM |
2323
- 11 | operating_mode | 1 | RW | EEPROM |
2424
- 20 | homing_offset | 4 | RW | EEPROM | rad
2525
- 24 | moving_threshold | 4 | RW | EEPROM | rad_per_s
2626
- 31 | temperature_limit | 1 | RW | EEPROM | celsius
2727
- 32 | max_voltage_limit | 2 | RW | EEPROM | V
2828
- 34 | min_voltage_limit | 2 | RW | EEPROM | V
29-
- 36 | pwm_limit | 2 | RW | EEPROM |
29+
- 36 | pwm_limit | 2 | RW | EEPROM |
3030
- 38 | current_limit | 2 | RW | EEPROM | A
3131
- 40 | acceleration_limit | 4 | RW | EEPROM | rad_per_s2
3232
- 44 | velocity_limit | 4 | RW | EEPROM | rad_per_s
@@ -60,7 +60,7 @@ control_table:
6060
- 568 | realtime_tick | 2 | R | RAM | ms
6161
- 570 | moving | 1 | R | RAM | bool
6262
- 571 | moving_status | 1 | R | RAM |
63-
- 572 | present_pwm | 2 | R | RAM |
63+
- 572 | present_pwm | 2 | R | RAM |
6464
- 574 | present_current | 2 | R | RAM | A
6565
- 576 | present_velocity | 4 | R | RAM | rad_per_s
6666
- 580 | present_position | 4 | R | RAM | rad

0 commit comments

Comments
 (0)