Skip to content

Commit

Permalink
Merge pull request #1 from Brazilian-Institute-of-Robotics/feat-code-…
Browse files Browse the repository at this point in the history
…improvements

Feat code improvements
  • Loading branch information
claudiaelizabete authored Jan 26, 2024
2 parents 981880c + d1afd8f commit 472be1a
Show file tree
Hide file tree
Showing 27 changed files with 1,498 additions and 759 deletions.
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# CODEOWNERS info: https://help.github.com/en/articles/about-code-owners
# Owners are automatically requested for review for PRs that changes code
* @claudiaelizabete
39 changes: 39 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

### Configuration

- Operating system: \<Ubuntu 00.00.0 LTS\>

- Package version: \<0.0.0\>

### Description of problem

- \<Currently it is possible to build ...\>

### Steps to Reproduce

1. step
2. step

### Actual Results

- \<API internal error\>

### Expected Results

- \<Successful build\>

### Related Package/PR

- N/A.

### Notes

- N/A.
45 changes: 45 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

#### **Overview**

- \<Overview for request or description for added feature.\>
- \<Briefly describe the feature, a short description of the requested feature.
Images can be included to improve the understanding of the functionality.\>

#### **Use the following settings in the overrides file for docker testing**

- Use these settings to compile and run the module using `autoproj`.
- The contents of the files manifest and `overrides.yaml` must be changed according to the `templates` below.
- Additional packages may be needed to test this module.

e.g.,

- _overrides.yaml_

```yaml
overrides:
- <package_name>:
branch: <branch>
```
- _manifest_
```yaml
layout:
- <package_name>
```
#### **What was added/changed in this update**
- \<Use the commit messages to describe what was included.\>
#### **Depends On:**
- \<Inform if there is a dependency on other pull requests.\>
#### **Related Issues:**
- \<Inform if the pull request is associated with issues.\>
#### **Notes:**
- Include notes and notes specific to this pull request here, if not, include the expression N/A. (Not Applicable)
61 changes: 61 additions & 0 deletions .github/workflows/autoproj-ci-runner.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# runner-ci-autoproj provides commands useful to build in CI environments
# run ci clean cache

name: autoproj-ci-runner

on: [pull_request]

jobs:
job-autoproj-test:
runs-on: [self-hosted, cimatec-host, linux, x64]
strategy:
fail-fast: false
matrix:
distro: [jammy]
name: "runner-ci-autoproj"
steps:
- name: Setup Checkout Code Quality
uses: actions/checkout@v3
with:
repository: Brazilian-Institute-of-Robotics/action-code-quality
token: ${{ secrets.PAT_ACTION_USER_CIBOT }}
ref: main
- name: Extract overrides from Pull Request Body
uses: ./
id: code_quality
with:
pull_request_body: ${{ github.event.pull_request.body }}
local_repository: '- ${{ github.event.repository.name }}:'
local_branch: 'branch: ${{ github.head_ref }}'
- name: Setup Checkout autoproj CI
uses: actions/checkout@v3
with:
repository: Brazilian-Institute-of-Robotics/bir-autoproj-action
token: ${{ secrets.PAT_ACTION_USER_CIBOT }}
ref: feat-colcon-suport-humble
- uses: ./
with:
distro: ${{ matrix.distro }}
buildconf-url: [email protected]:Brazilian-Institute-of-Robotics/cbr_build_conf.git
buildconf-branch: main
seed-config: |
---
apt_dpkg_update: true
osdeps_mode: all
GITORIOUS: ssh
GITHUB: ssh
GITHUB_ROOT: '[email protected]:'
GITHUB_PUSH_ROOT: '[email protected]:'
GITHUB_PRIVATE_ROOT: '[email protected]:'
USE_PYTHON: true
python_executable: "/usr/bin/python3"
ros_version: 2
ros_distro: 'humble'
user_shells:
- bash
project: 'cbr_build_conf'
packages: '${{ github.event.repository.name }}'
overrides: |
${{ steps.code_quality.outputs.overrides }}
manifest: |
${{ steps.code_quality.outputs.manifest }}
54 changes: 54 additions & 0 deletions .github/workflows/runner-ci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# This file configures a set of analyzers, which statically check code and configuration files
# using the following tools copyright, cppcheck, cpplint, gtest, lint_cmake, linter, uncrustify,
# xmllint. These tools look for formation errors, patterns and other warnings.
#
# Checkout This action checks-out your repository under $GITHUB_WORKSPACE,
# so your workflow can access it.
# https://github.com/actions/checkout
# https://github.com/marketplace/actions/checkout
#
# ROS 2 Tooling Working Group
# Github action to run linters on ROS 2 packages
# https://github.com/ros-tooling/action-ros-lint
# rostooling/setup-ros-docker:ubuntu-jammy-ros-humble-desktop-latest
# https://github.com/ros-tooling/setup-ros-docker
# https://hub.docker.com/r/rostooling/setup-ros-docker/tags

name: lint-runner

on:
push:
branches: ['main']
pull_request:

env:
AMENT_CPPCHECK_ALLOW_SLOW_VERSIONS: true

jobs:
ament_lint_general:
name: ament_${{ matrix.linter }}
strategy:
fail-fast: false
matrix:
linter: [cppcheck, cpplint, copyright, flake8, lint_cmake, pep257, uncrustify, xmllint]
distro: [humble]
ubuntu: [jammy]
package: [gazebo_ros_link_attacher]
runs-on: [self-hosted, colcon-hosted, linux, x64]
container:
image: rostooling/setup-ros-docker:ubuntu-${{ matrix.ubuntu }}-latest
steps:
-
if: ${{ matrix.linter == 'cpplint' }}
name: Set env ${{ matrix.linter }}
run: |
echo "LINT_ARGUMENTS=--linelength=120" >> $GITHUB_ENV
- uses: actions/checkout@v3
- uses: ros-tooling/[email protected]
- uses: ros-tooling/action-ros-lint@master
with:
linter: ${{ matrix.linter }}
distribution: ${{ matrix.distro }}
package-name: ${{ matrix.package }}
arguments: ${{ env.LINT_ARGUMENTS }}
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Changelog

All notable changes to this project will be documented in this file.

## [Unreleased]


### Added


## [0.1.0] - 2024-01-16

### Changed

### Fixed

140 changes: 88 additions & 52 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,86 +1,122 @@
cmake_minimum_required(VERSION 2.8.3)
cmake_minimum_required(VERSION 3.5)
project(gazebo_ros_link_attacher)

#####################################
## Check c++11 / c++0x support ######
#####################################
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "-std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "-std=c++0x")
else()
message(FATAL_ERROR "Compiler ${CMAKE_CXX_COMPILER} has no C++11 support.")
##########################
## Set compiler options ##
##########################
add_compile_options(-std=c++17)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
#####################################

# Load catkin and all dependencies required for this package
find_package(catkin REQUIRED COMPONENTS
roscpp
gazebo_ros
std_msgs
message_generation
)

# Depend on system install of Gazebo
find_package(gazebo REQUIRED)
set(CMAKE_CXX_FLAGS "-std=c++17 ${CMAKE_CXX_FLAGS}")

add_service_files(
FILES
Attach.srv
)
########################

# Load dependencies required for this package
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(gazebo_ros REQUIRED)
find_package(std_msgs REQUIRED)
find_package(gazebo REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(rmw_implementation_cmake REQUIRED)


## Generate added messages and services with any dependencies listed here
generate_messages(
DEPENDENCIES
std_msgs
rosidl_generate_interfaces(${PROJECT_NAME}
srv/Attach.srv
DEPENDENCIES builtin_interfaces std_msgs
)

###################################
## catkin specific configuration ##
###################################
catkin_package(CATKIN_DEPENDS message_runtime)
ament_export_dependencies(rosidl_default_runtime)


###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(include)
link_directories(${GAZEBO_LIBRARY_DIRS})
include_directories(${Boost_INCLUDE_DIR} ${catkin_INCLUDE_DIRS} ${GAZEBO_INCLUDE_DIRS})
include_directories(include
${gazebo_ros_INCLUDE_DIRS}
${rclcpp_INCLUDE_DIRS}
${std_msgs_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}/srv
)

## Declare a cpp library
add_library(${PROJECT_NAME} src/gazebo_ros_link_attacher.cpp)
add_library(${PROJECT_NAME}_plugin SHARED src/gazebo_ros_link_attacher.cpp)


# Connect targets with locally defined messages
get_available_rmw_implementations(rmw_implementations2)
foreach(rmw_implementation ${rmw_implementations2})
find_package("${rmw_implementation}" REQUIRED)
get_rmw_typesupport(typesupport_impls "${rmw_implementation}" LANGUAGE "cpp")
foreach(typesupport_impl ${typesupport_impls})
rosidl_get_typesupport_target(cpp_typesupport_target "${PROJECT_NAME}" "rosidl_typesupport_cpp")
endforeach()
endforeach()

## Specify libraries to link a library or executable target against
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${GAZEBO_LIBRARIES})
add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS})
target_link_libraries(${PROJECT_NAME}_plugin
${ament_cmake_LIBRARIES}
${gazebo_ros_LIBRARIES}
${rclcpp_LIBRARIES}
${std_msgs_LIBRARIES}
"${cpp_typesupport_target}")


#############
## Install ##
#############

install(PROGRAMS
scripts/demo.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
install(TARGETS ${PROJECT_NAME}_plugin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)

## Mark executables and/or libraries for installation
install(TARGETS ${PROJECT_NAME}
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# List of scripts to install
set(SCRIPTS
demo.py
demo_multiple.py
spawn_models.py
attach.py
detach.py
)

# Install each script
foreach(SCRIPT ${SCRIPTS})
install(PROGRAMS
examples/${SCRIPT}
DESTINATION lib/${PROJECT_NAME}
)
endforeach()

foreach (dir launch)
foreach(dir launch worlds)
install(DIRECTORY ${dir}/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/${dir})
endforeach(dir)
DESTINATION share/${PROJECT_NAME}/${dir})
endforeach()

if(BUILD_DOCS)
find_package(ament_cmake_doxygen REQUIRED)
ament_doxygen(DOC_TITLE ${PROJECT_NAME})
endif()

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
set(AMENT_CPPCHECK_ALLOW_SLOW_VERSIONS True)
list(APPEND AMENT_LINT_AUTO_EXCLUDE
ament_cmake_cpplint
)
ament_lint_auto_find_test_dependencies()

find_package(ament_cmake_cpplint REQUIRED)
ament_cpplint(MAX_LINE_LENGTH "120")
ament_lint_auto_find_test_dependencies()
endif()

ament_package()
Loading

0 comments on commit 472be1a

Please sign in to comment.