Skip to content

Commit

Permalink
Merge branch 'porting-ros2' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ptruka committed Nov 17, 2023
2 parents 8c4d6fe + b5c36b4 commit 3b09977
Show file tree
Hide file tree
Showing 116 changed files with 7,969 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
BasedOnStyle: Google
AccessModifierOffset: -2
ConstructorInitializerIndentWidth: 2
AlignEscapedNewlinesLeft: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AlwaysBreakTemplateDeclarations: true
AlwaysBreakBeforeMultilineStrings: false
BreakBeforeBinaryOperators: false
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: true
BinPackParameters: true
ColumnLimit: 120
ConstructorInitializerAllOnOneLineOrOnePerLine: true
DerivePointerBinding: false
PointerBindsToType: true
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: true
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 60
PenaltyBreakString: 1
PenaltyBreakFirstLessLess: 1000
PenaltyExcessCharacter: 1000
PenaltyReturnTypeOnItsOwnLine: 90
SpacesBeforeTrailingComments: 2
Cpp11BracedListStyle: false
Standard: Auto
IndentWidth: 2
TabWidth: 2
UseTab: Never
IndentFunctionDeclarationAfterType: false
SpacesInParentheses: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpaceAfterControlStatementKeyword: true
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 4
SortIncludes: false
SpaceAfterCStyleCast: false

# Configure each individual brace in BraceWrapping
BreakBeforeBraces: Custom

# Control of individual brace wrapping cases
BraceWrapping: {
AfterClass: 'true'
AfterControlStatement: 'true'
AfterEnum : 'true'
AfterFunction : 'true'
AfterNamespace : 'true'
AfterStruct : 'true'
AfterUnion : 'true'
BeforeCatch : 'true'
BeforeElse : 'true'
IndentBraces : 'false'
}
...
30 changes: 30 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This config uses industrial_ci (https://github.com/ros-industrial/industrial_ci.git).

name: CI

on: [push, pull_request] # on all pushes and PRs

jobs:
industrial_ci:
strategy:
matrix:
env:
- {ROS_DISTRO: foxy, ROS_REPO: testing}
- {ROS_DISTRO: foxy, CATKIN_LINT: true}
- {ROS_DISTRO: foxy, CLANG_FORMAT_CHECK: file}
- {ROS_DISTRO: galactic}
- {ROS_DISTRO: humble}
- {ROS_DISTRO: iron}
env:
CCACHE_DIR: /github/home/.ccache # Directory for ccache (and how we enable ccache in industrial_ci)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# This step will fetch/store the directory used by ccache before/after the ci run
- uses: actions/cache@v2
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-${{ matrix.env.ROS_DISTRO }}-${{ matrix.env.ROS_REPO }}
# Run industrial_ci
- uses: 'ros-industrial/industrial_ci@master'
env: ${{ matrix.env }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.json
*.pyc
*.orig
8 changes: 8 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<<<<<<< HEAD
=======

>>>>>>> porting-ros2
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Expand Down Expand Up @@ -186,7 +190,11 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

<<<<<<< HEAD
Copyright [yyyy] [name of copyright owner]
=======
Copyright 2022 Pepperl+Fuchs SE
>>>>>>> porting-ros2

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
57 changes: 57 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
## ROS drivers for R2000 and R2300 laser scanners

![Build Status](https://github.com/PepperlFuchs/pf_lidar_ros2_driver/actions/workflows/main.yml/badge.svg?branch=main)

**Required platform:**
Ubuntu 20.04 / ROS Foxy OR Ubuntu 20.04 / ROS Galactic OR Ubuntu 22.04 / ROS Humble

**Clone the repository:**
Clone the repository in the `src` folder of your ROS workspace
```
git clone https://github.com/PepperlFuchs/pf_lidar_ros2_driver.git
```

**Install the missing dependencies:**
```
export ROS_DISTRO=foxy OR export ROS_DISTRO=galactic OR export ROS_DISTRO=humble
cd <path/to/workspace>
rosdep update --include-eol-distros
rosdep install --from-paths src --ignore-src --rosdistro=$ROS_DISTRO -y
```

**Build the workspace:**
```
source /opt/ros/$ROS_DISTRO/setup.bash
colcon build --symlink-install
source <path/to/workspace>/install/setup.bash
```

**Usage:**
Now you are ready to use the driver. Make the necessary power and ethernet connections. Make sure your computer's IP address is on the same subnet mask as that of the device. Change the `scanner_ip` value in the respective yaml config file that can be found in: `src/pf_lidar_ros_driver/src/pf_driver/config/`. You can now launch one of the drivers in the following manner:
R2000:
```
ros2 launch pf_driver r2000.launch.py
```
R2300 4-layer:
```
ros2 launch pf_driver r2300.launch.py
```
R2300 1-layer:
```
ros2 launch pf_driver r2300_single_layer.launch.py
```

With R2300, the term scan refers to a contiguous group of measurements spanning one particular horizontal circular
sector. Depending on the orientation of the mirrors on the cube, the scans may be taken in the same or slightly different
layers.

In R2300 4-layer sensors, all four mirrors are inclined slightly differently so that scans are taken at the following vertical
angle (relative to the mounting plane). Note that the layers are numbered in the order they are scanned during one
turn. This is not strictly from bottom to top:

| **Layer index** | **Angle** | **Description** |
|-----------------|-----------|-----------------|
|0 |-4.5°|bottom (connector side)|
|1 |-1.5° | - |
|2 |+4.5° | top |
|3 |+1.5° | - |
1 change: 1 addition & 0 deletions src/CMakeLists.txt
23 changes: 23 additions & 0 deletions src/pf_description/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package pf_description
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

1.2.0 (2022-05-03)
-------------------
* fix xacro filename cases `#70 <https://github.com/PepperlFuchs/pf_lidar_ros_driver/issues/70>`_ from PepperlFuchs/fix_xacro_filenames
* replaced r2300 stl file `#69 <https://github.com/PepperlFuchs/pf_lidar_ros_driver/issues/69>`_ from PepperlFuchs/update_stl
* update test as per renamed launch file
* rename xacros and update mesh centre
* added urdf for r2000 and r2300 `#66 <https://github.com/PepperlFuchs/pf_lidar_ros_driver/issues/66>`_ from PepperlFuchs/urdf
* add tests for robot_description bringup
* fix deps for CI
* add urdf bringup launch file
* added urdf for r2000
* added urdf for r2300
* Contributors: Harsh Deshpande

1.1.1 (2021-02-18)
------------------

1.1.0 (2021-02-09)
------------------
14 changes: 14 additions & 0 deletions src/pf_description/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 3.7)
project(pf_description)

find_package(ament_cmake REQUIRED)

if(BUILD_TESTING)
find_package(launch_testing_ament_cmake REQUIRED)
add_launch_test(tests/test_r2000_bringup.launch.py)
add_launch_test(tests/test_r2300_bringup.launch.py)
endif()

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

ament_package()
7 changes: 7 additions & 0 deletions src/pf_description/launch/pf_bringup.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<launch>
<arg name="scanner" default="r2000" />
<arg name="model" default="$(find pf_description)/urdf/$(arg scanner)_world.urdf.xacro" />

<param name="robot_description" command="$(find xacro)/xacro $(arg model)" />
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
</launch>
42 changes: 42 additions & 0 deletions src/pf_description/launch/pf_bringup.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from ament_index_python.packages import get_package_share_directory
import os
import launch_ros
from launch.actions import DeclareLaunchArgument, OpaqueFunction
from launch.substitutions import Command, LaunchConfiguration, TextSubstitution
import launch


def launch_setup(context, *args, **kwargs):
package_name = 'pf_description'
scanner_arg = LaunchConfiguration('scanner').perform(context)

pkg_share = launch_ros.substitutions.FindPackageShare(
package=package_name).find(package_name)
scanner_description_path = os.path.join(
pkg_share, 'urdf', scanner_arg + '_world.urdf.xacro')
rviz_config_path = os.path.join(pkg_share, 'rviz', scanner_arg + '.rviz')

robot_state_publisher_node = launch_ros.actions.Node(
package='robot_state_publisher',
executable='robot_state_publisher',
output='screen',
parameters=[{'robot_description': Command(
['xacro ', scanner_description_path])}]
)

rviz2_node = launch_ros.actions.Node(
package='rviz2',
executable='rviz2',
output='screen',
arguments=['-d' + rviz_config_path],
)

return [robot_state_publisher_node, rviz2_node]


def generate_launch_description():
return launch.LaunchDescription([
launch.actions.DeclareLaunchArgument(
"scanner", default_value=TextSubstitution(text="r2000")),
OpaqueFunction(function=launch_setup)
])
193 changes: 193 additions & 0 deletions src/pf_description/meshes/R2000.dae

Large diffs are not rendered by default.

Binary file added src/pf_description/meshes/R2000.stl
Binary file not shown.
167 changes: 167 additions & 0 deletions src/pf_description/meshes/R2300.dae

Large diffs are not rendered by default.

Binary file added src/pf_description/meshes/R2300.stl
Binary file not shown.
28 changes: 28 additions & 0 deletions src/pf_description/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0"?>
<package format="3">
<name>pf_description</name>
<version>1.2.0</version>
<description>The pf_description package</description>

<maintainer email="harshavardhan.deshpande@ipa.fraunhofer.de">Harsh Deshpande</maintainer>
<author email="harshavardhan.deshpande@ipa.fraunhofer.de">Harsh Deshpande</author>
<license>Apache2.0</license>
<url type="website">https://github.com/PepperlFuchs/pf_lidar_ros_driver</url>

<exec_depend>launch_ros</exec_depend>
<exec_depend>robot_state_publisher</exec_depend>
<exec_depend>rviz2</exec_depend>
<exec_depend>urdf</exec_depend>
<exec_depend>xacro</exec_depend>

<test_depend>ament_copyright</test_depend>
<test_depend>ament_flake8</test_depend>
<test_depend>ament_pep257</test_depend>
<test_depend>python3-pytest</test_depend>
<test_depend>launch_testing_ament_cmake</test_depend>


<export>
<build_type>ament_cmake</build_type>
</export>
</package>
Empty file.
Empty file.
Loading

0 comments on commit 3b09977

Please sign in to comment.