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

Add Basic ROS2 Support #1

Merged
merged 35 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
bb841a5
Migrate build to ros2/ament
Nov 1, 2023
188e756
Update logging to ROS2 formats, add namespaces
Nov 1, 2023
4685264
Parameter migration
Nov 1, 2023
f440c68
Incremental fixes to vision node
Nov 1, 2023
545a6e8
C++ changes
Nov 1, 2023
ffaab02
Ignore build output
Nov 1, 2023
bd5f489
Force that bad boi to build
Nov 3, 2023
df77e3b
Minor compiler warning
Nov 3, 2023
5f561f9
Actually install everything
Nov 3, 2023
f3f6108
Parameters need to be declared
Nov 3, 2023
a2c34cf
Add ros2 launch file
Nov 3, 2023
dd3cae0
Remove ROS 1 launch files
Nov 3, 2023
36fb4d9
Minor readme updates
Nov 3, 2023
7608cd4
What's a pointer
Nov 3, 2023
0a87402
Ensure camerainfo is populated correctly
Nov 3, 2023
455114d
Temporarily don't launch color node...
Nov 3, 2023
032e994
Node specific logging
Nov 3, 2023
93166d8
Update launch file
Nov 6, 2023
5356f47
Object pointer and timing fixes
Nov 6, 2023
3fe8619
Configure on start
Nov 6, 2023
18414e4
Redundant copy
Nov 6, 2023
df7f0f6
Pull in point cloud launches
Nov 6, 2023
379fa5a
Conditionally launch color and depth
Nov 7, 2023
7afb0a1
Launch depth registration nodes
Nov 7, 2023
8169787
Fix depth topics
Nov 7, 2023
b77b81a
Remove old rviz launch files
Nov 7, 2023
fbc69d5
Remove duplicate remap
Nov 7, 2023
c5fa0f1
Update README
Nov 7, 2023
0f0eb3c
Add files for format CI workflow
dyackzan Nov 9, 2023
1058dcc
Use consts for all params, and clean up some of the declarations
Nov 9, 2023
be452cd
Merge remote-tracking branch 'origin/add-format-ci-to-ros2-support-br…
Nov 9, 2023
4e06201
Compiler and format fixes
Nov 9, 2023
5d3dc92
Remove docker lint
Nov 9, 2023
07bc9be
format fixes
Nov 9, 2023
30e82ba
One more format fix
Nov 9, 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
3 changes: 1 addition & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ SpaceAfterCStyleCast: false
BreakBeforeBraces: Custom

# Control of individual brace wrapping cases
BraceWrapping: {
BraceWrapping:
AfterClass: 'true'
AfterControlStatement: 'true'
AfterEnum : 'true'
Expand All @@ -62,5 +62,4 @@ BraceWrapping: {
BeforeCatch : 'true'
BeforeElse : 'true'
IndentBraces : 'false'
}
...
17 changes: 17 additions & 0 deletions .github/workflows/format.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Format

on:
workflow_dispatch:
pull_request:
push:
branches:
- ros2

jobs:
pre-commit:
name: pre-commit
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
*.bin
*.ppm
*.bag

# Ignore build artifacts
build/*
install/*
log/*
72 changes: 72 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# To use:
#
# pre-commit run -a
#
# Or:
#
# pre-commit install # (runs every time you commit in git)
#
# To update this file:
#
# pre-commit autoupdate
#
# See https://github.com/pre-commit/pre-commit
repos:
# Standard hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: check-ast
- id: check-case-conflict
- id: check-docstring-first
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
args: ["--unsafe"] # Fixes errors parsing custom YAML constructors like ur_description's !degrees
exclude: 'src/moveit_studio_web/pnpm-lock.yaml'
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
- id: fix-byte-order-marker

- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black

- repo: https://github.com/codespell-project/codespell
rev: v2.0.0
hooks:
- id: codespell
args: ["--write-changes", "-L", "atleast,inout,ether"] # Provide a comma-separated list of misspelled words that codespell should ignore (for example: '-L', 'word1,word2,word3').
exclude: (\.(svg|pyc|stl|dae|asc)|pnpm-lock.yaml)$

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v14.0.6
hooks:
- id: clang-format
files: \.(c|cc|cxx|cpp|frag|glsl|h|hpp|hxx|ih|ispc|ipp|java|m|proto|vert)$
# -i arg is included by default by the hook
args: ["-fallback-style=none"]

- repo: https://github.com/adrienverge/yamllint
rev: v1.27.1
hooks:
- id: yamllint
args:
[
"--no-warnings",
"--config-data",
"{extends: default, rules: {line-length: disable, braces: {max-spaces-inside: 1}}}",
]
types: [text]
files: \.(yml|yaml)$
exclude: 'src/moveit_studio_web/pnpm-lock.yaml'

- repo: https://github.com/tcort/markdown-link-check
rev: v3.10.3
hooks:
- id: markdown-link-check
args:
- "-c"
- "markdown-link-check-config.json"
21 changes: 0 additions & 21 deletions .vscode/c_cpp_properties.json

This file was deleted.

124 changes: 77 additions & 47 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,60 +1,90 @@
cmake_minimum_required(VERSION 2.8.3)
cmake_minimum_required(VERSION 3.14)

project(kinova_vision)

# System Dependencies
find_package(PkgConfig)
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()

pkg_check_modules(GSTREAMER REQUIRED gstreamer-1.0)
pkg_check_modules(GST_APP REQUIRED gstreamer-app-1.0)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra)
endif()

# Use Catkin
find_package(catkin REQUIRED
COMPONENTS roscpp image_transport sensor_msgs nodelet
camera_calibration_parsers camera_info_manager tf
)
# Ament System Dependencies
find_package(ament_cmake REQUIRED)
find_package(camera_calibration_parsers REQUIRED)
find_package(camera_info_manager REQUIRED)
find_package(cv_bridge REQUIRED)
find_package(image_transport REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_components REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(tf2 REQUIRED)
find_package(tf2_ros REQUIRED)

catkin_package(
INCLUDE_DIRS include
LIBRARIES KinovaVision
CATKIN_DEPENDS roscpp nodelet image_transport sensor_msgs
camera_calibration_parsers camera_info_manager
DEPENDS GSTREAMER GST_APP
)
set(THIS_PACKAGE_INCLUDE_DEPENDS
ament_cmake
camera_calibration_parsers
camera_info_manager
cv_bridge
image_transport
rclcpp
rclcpp_components
sensor_msgs
tf2
tf2_ros
)

include_directories(
include
${catkin_INCLUDE_DIRS}
${GLIB_INCLUDE_DIRS}
${GST_APP_INCLUDE_DIRS})

add_library(KinovaVision src/vision.cpp)
target_link_libraries(KinovaVision
${catkin_LIBRARIES}
${GSTREAMER_LIBRARIES}
${GST_APP_LIBRARIES})

add_executable(KinovaVision_node src/vision_node.cpp)
target_link_libraries(KinovaVision_node KinovaVision
${catkin_LIBRARIES}
${GSTREAMER_LIBRARIES}
${GST_APP_LIBRARIES})
set_target_properties(KinovaVision_node PROPERTIES OUTPUT_NAME kinova_vision)
# Other Dependencies
find_package(PkgConfig)
pkg_check_modules(GSTREAMER REQUIRED
gstreamer-1.0
gstreamer-app-1.0
)

# Define targets
include_directories(include)
include_directories(${GSTREAMER_INCLUDE_DIRS})

add_library(${PROJECT_NAME} SHARED src/vision.cpp)
ament_target_dependencies(${PROJECT_NAME}
${THIS_PACKAGE_INCLUDE_DEPENDS})
target_link_libraries(${PROJECT_NAME}
"${GSTREAMER_LIBRARIES}")

add_executable(${PROJECT_NAME}_node src/vision_node.cpp)
ament_target_dependencies(${PROJECT_NAME}_node
${THIS_PACKAGE_INCLUDE_DEPENDS})
target_link_libraries(${PROJECT_NAME}_node ${PROJECT_NAME})

# Install directives
install(TARGETS KinovaVision KinovaVision_node
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
install(TARGETS ${PROJECT_NAME}
EXPORT export_${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION lib
)

install(DIRECTORY include/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
PATTERN ".svn" EXCLUDE)
install(TARGETS ${PROJECT_NAME}_node
ARCHIVE DESTINATION lib/${PROJECT_NAME}
LIBRARY DESTINATION lib/${PROJECT_NAME}
RUNTIME DESTINATION lib/${PROJECT_NAME}
)

install(DIRECTORY launch
DESTINATION share/${PROJECT_NAME}
)

install(DIRECTORY launch/calibration
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
FILES_MATCHING PATTERN "*.ini"
)
# Include additional settings if needed
set(CMAKE_CXX_FLAGS "-fpermissive")

set(CMAKE_CXX_FLAGS "-fpermissive")
## EXPORTS
ament_export_include_directories(
include
)
ament_export_libraries(
${PROJECT_NAME}
)
ament_export_dependencies(
)
ament_package()
Loading