Skip to content

Commit

Permalink
Merge pull request #1 from Alpaca-zip/feature/create_vgraph
Browse files Browse the repository at this point in the history
Feature/create vgraph
  • Loading branch information
Alpaca-zip authored Dec 13, 2023
2 parents 15b1b9d + f8f9334 commit 3c6a981
Show file tree
Hide file tree
Showing 17 changed files with 193 additions and 367 deletions.
75 changes: 0 additions & 75 deletions .clang-format

This file was deleted.

50 changes: 0 additions & 50 deletions .clang-tidy

This file was deleted.

33 changes: 4 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,6 @@ on:
- main

jobs:
clang_format_check:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: run industrial_ci
uses: 'ros-industrial/industrial_ci@master'
env:
ROS_DISTRO: noetic # Replace noetic for your chosen distro.
CLANG_FORMAT_CHECK: file
CLANG_FORMAT_VERSION: "10"

clang_tidy_check:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: run industrial_ci
uses: 'ros-industrial/industrial_ci@master'
env:
ROS_DISTRO: noetic # Replace noetic for your chosen distro.
# UPSTREAM_WORKSPACE: dependencies.rosinstall
# BEFORE_BUILD_TARGET_WORKSPACE: 'apt update -q && python3 -m pip install ****'
CLANG_TIDY: pedantic

black_check:
runs-on: ubuntu-latest
steps:
Expand All @@ -52,7 +27,7 @@ jobs:
env:
ROS_DISTRO: noetic # Replace noetic for your chosen distro.
# UPSTREAM_WORKSPACE: dependencies.rosinstall
# BEFORE_BUILD_TARGET_WORKSPACE: 'apt update -q && python3 -m pip install ****'
BEFORE_BUILD_TARGET_WORKSPACE: 'apt update -q && python3 -m pip install -q -r requirements.txt'
PYLINT_ARGS: '--errors-only'
PYLINT_CHECK: true

Expand All @@ -66,7 +41,7 @@ jobs:
env:
ROS_DISTRO: noetic # Replace noetic for your chosen distro.
# UPSTREAM_WORKSPACE: dependencies.rosinstall
# BEFORE_BUILD_TARGET_WORKSPACE: 'apt update -q && python3 -m pip install ****'
BEFORE_BUILD_TARGET_WORKSPACE: 'apt update -q && python3 -m pip install -q -r requirements.txt'
CATKIN_LINT: true

build_check:
Expand All @@ -79,12 +54,12 @@ jobs:
- ROS_DISTRO: noetic # Replace noetic for your chosen distro.
ROS_REPO: main
# UPSTREAM_WORKSPACE: dependencies.rosinstall
# BEFORE_BUILD_TARGET_WORKSPACE: 'apt update -q && python3 -m pip install ****'
BEFORE_BUILD_TARGET_WORKSPACE: 'apt update -q && python3 -m pip install -q -r requirements.txt'
IMMEDIATE_TEST_OUTPUT: true
- ROS_DISTRO: noetic # Replace noetic for your chosen distro.
ROS_REPO: testing
# UPSTREAM_WORKSPACE: dependencies.rosinstall
# BEFORE_BUILD_TARGET_WORKSPACE: 'apt update -q && python3 -m pip install ****'
BEFORE_BUILD_TARGET_WORKSPACE: 'apt update -q && python3 -m pip install -q -r requirements.txt'
IMMEDIATE_TEST_OUTPUT: true

steps:
Expand Down
18 changes: 4 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
cmake_minimum_required(VERSION 3.0.2)
project(template)
project(vgraph_planner)

set(CMAKE_CXX_STANDARD 14)

# find dependencies
find_package(catkin REQUIRED COMPONENTS roscpp rospy)
find_package(catkin REQUIRED COMPONENTS rospy)

# Declare a catkin package
catkin_package(CATKIN_DEPENDS roscpp rospy)

# Specify additional locations of header files
include_directories(include ${catkin_INCLUDE_DIRS})

# Create Cpp executable
add_executable(cpp_template src/cpp_template.cpp)
target_link_libraries(cpp_template ${catkin_LIBRARIES})

# Install Cpp executable
install(TARGETS cpp_template RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
catkin_package(CATKIN_DEPENDS rospy)

# Install Python executables
install(PROGRAMS scripts/py_template.py DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
install(PROGRAMS scripts/vgraph_planner.py DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
80 changes: 1 addition & 79 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,79 +1 @@
# ros1-pkg-template
This is the template repository for the ROS1 package with [Industrial CI](https://github.com/ros-industrial/industrial_ci).
## Before use
Adjust the `ROS_DISTRO` tag in [ci.yml](https://github.com/Alpaca-zip/ros1-pkg-template/blob/main/.github/workflows/ci.yml) to suit your ROS environment:
```yaml
jobs:
clang_format_check:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: run industrial_ci
uses: 'ros-industrial/industrial_ci@master'
env:
ROS_DISTRO: noetic # Replace noetic for your chosen distro.
CLANG_FORMAT_CHECK: file
CLANG_FORMAT_VERSION: "10"
```
## Industrial CI
This template provides a comprehensive CI pipeline for ROS project using GitHub Actions and the ros-industrial/industrial_ci action.
- `Clang Format Check` : Ensures code formatting adheres to defined standards using [clang-format](https://clang.llvm.org/docs/ClangFormat.html).
- `Clang Tidy Check` : Validates code for potential issues and adherence to coding standards using [Clang-Tidy](https://clang.llvm.org/extra/clang-tidy/).
- `Black Check` : Ensures code formatting adheres to PEP standards using [Black](https://black.readthedocs.io/en/stable/).
- `Pylint Check` : Runs [Pylint](https://pylint.readthedocs.io/en/stable/) for static code analysis on Python code.
- `Catkin Lint Check` : Validates our ROS package structure and dependencies with [catkin_lint](https://fkie.github.io/catkin_lint/).
- `Build Check` : Performs a build for both main and testing ROS repositories to ensure the codebase builds correctly.
## To pass all checks...
### clang-format
**1. install**
```
$ sudo apt-get install clang-format
```
**2. Format with clang-format**
```
$ roscd <this_package>
$ find . -type f \( -name "*.cpp" -or -name "*.hpp" -or -name "*.h" \) -exec clang-format -i -style=file {} \;
```
### Clang-Tidy
**1. install**
```
$ sudo apt-get install clang clang-tidy
```
**2. Format with Clang-Tidy**
```
$ cd <path_to_your_workspace> && catkin build <this_package> --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=1
$ clang-tidy -p build/<this_package>/ <path_to_this_package>/src/<your_cpp> -fix
```
Recommended tool : [catkin_tidy](https://github.com/nyxrobotics/catkin_tidy)
### Black
**1. install**
```
$ pip install black
```
**2. Format with Black**
```
$ roscd <this_package>
$ find . -type f -name "*.py" -exec black {} \;
```
### Pylint
**1. install**
```
$ pip install pylint
```
**2. Run Pylint**
```
$ roscd <this_package>
$ find . -type f -name "*.py" -exec pylint {} \;
```
### catkin_lint
**1. install**
```
$ sudo apt-get install catkin-lint
```
**2. Run catkin_lint**
```
$ catkin_lint --pkg <this_package>
```
# vgraph_planner
4 changes: 0 additions & 4 deletions dependencies.rosinstall

This file was deleted.

29 changes: 0 additions & 29 deletions include/cpp_template/cpp_template.h

This file was deleted.

5 changes: 0 additions & 5 deletions launch/template.launch

This file was deleted.

12 changes: 12 additions & 0 deletions launch/vgraph_planner.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<launch>
<arg name="pgm_file" default="$(find vgraph_planner)/map/map.pgm"/>
<arg name="save_graph_file" default="$(find vgraph_planner)/map/vgraph.png"/>
<arg name="resolution" default="0.1"/>

<node name="vgraph_planner_node" pkg="vgraph_planner" type="vgraph_planner.py" output="screen">
<param name="~pgm_file" value="$(arg pgm_file)"/>
<param name="~save_graph_file" value="$(arg save_graph_file)"/>
<param name="~resolution" value="$(arg resolution)"/>
</node>
</launch>
Binary file added map/map.pgm
Binary file not shown.
7 changes: 7 additions & 0 deletions map/map.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
image: map.pgm
mode: trinary
resolution: 0.05
origin: [-9.84, -9.23, 0]
negate: 0
occupied_thresh: 0.65
free_thresh: 0.25
Binary file added map/vgraph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 3 additions & 9 deletions package.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
<?xml version="1.0"?>
<package format="2">
<name>template</name>
<name>vgraph_planner</name>
<version>0.0.0</version>
<description>The template package</description>
<maintainer email="template@todo.todo">template</maintainer>
<description>The vgraph_planner package</description>
<maintainer email="zip@todo.todo">Alpaca-zip</maintainer>
<license>Apache 2.0</license>

<buildtool_depend>catkin</buildtool_depend>

<build_depend>roscpp</build_depend>
<build_depend>rospy</build_depend>

<build_export_depend>roscpp</build_export_depend>
<build_export_depend>rospy</build_export_depend>

<exec_depend>roscpp</exec_depend>
<exec_depend>rospy</exec_depend>

<export>
</export>
</package>
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Pillow
Loading

0 comments on commit 3c6a981

Please sign in to comment.