Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Commit

Permalink
Initial commit of nearly empty template project.
Browse files Browse the repository at this point in the history
  • Loading branch information
aentinger committed May 7, 2024
0 parents commit 381e726
Show file tree
Hide file tree
Showing 14 changed files with 513 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check/.codespellrc
# See: https://github.com/codespell-project/codespell#using-a-config-file
[codespell]
# In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here:
ignore-words-list = ,
skip = ./.git,./.licenses,__pycache__,node_modules,./go.mod,./go.sum,./package-lock.json,./poetry.lock,./yarn.lock,./external
builtin = clear,informal,en-GB_to_en-US
check-filenames =
check-hidden =
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# See: https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#about-the-dependabotyml-file
version: 2

updates:
# Configure check for outdated GitHub Actions actions in workflows.
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/dependabot/README.md
# See: https://docs.github.com/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
- package-ecosystem: github-actions
directory: / # Check the repository's workflows under /.github/workflows/
schedule:
interval: daily
labels:
- "topic: ci"
52 changes: 52 additions & 0 deletions .github/workflows/ros2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: ros2

on:
push:
paths:
- ".github/workflows/ros2.yml"
- "include/**"
- "launch/**"
- "src/**"
- "CMakeLists.txt"
- "package.xml"
pull_request:
paths:
- ".github/workflows/ros2.yml"
- "include/**"
- "launch/**"
- "src/**"
- "CMakeLists.txt"
- "package.xml"

env:
BUILD_TYPE: Release

jobs:
build:
name: Build on ros2 ${{ matrix.ros_distro }}
runs-on: ubuntu-22.04
strategy:
matrix:
ros_distro: [ humble ]

steps:
- name: Install mp-units
uses: lxrobotics/install-mp-units@main

- uses: ros-tooling/[email protected]
with:
required-ros-distributions: ${{ matrix.ros_distro }}

- name: Setup ros2 workspace
run: |
mkdir -p ${{github.workspace}}/ros2_ws/src
- uses: actions/checkout@v4
with:
path: 'ros2_ws/src/robotem-rovne'

- name: colcon build
run: |
source /opt/ros/${{ matrix.ros_distro }}/setup.bash
cd ${{github.workspace}}/ros2_ws
colcon build --event-handlers console_direct+
26 changes: 26 additions & 0 deletions .github/workflows/spell-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Source: https://github.com/per1234/.github/blob/main/workflow-templates/spell-check.md
name: Spell Check

# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
on:
push:
pull_request:
schedule:
# Run every Tuesday at 8 AM UTC to catch new misspelling detections resulting from dictionary updates.
- cron: "0 8 * * TUE"
workflow_dispatch:
repository_dispatch:

permissions:
contents: read

jobs:
spellcheck:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Spell check
uses: codespell-project/actions-codespell@master
132 changes: 132 additions & 0 deletions .github/workflows/sync-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/sync-labels.md
name: Sync Labels

# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
on:
push:
paths:
- ".github/workflows/sync-labels.ya?ml"
- ".github/label-configuration-files/*.ya?ml"
pull_request:
paths:
- ".github/workflows/sync-labels.ya?ml"
- ".github/label-configuration-files/*.ya?ml"
schedule:
# run every Tuesday at 3 AM UTC
- cron: "0 3 * * 2"
workflow_dispatch:
repository_dispatch:

env:
CONFIGURATIONS_FOLDER: .github/label-configuration-files
CONFIGURATIONS_ARTIFACT: label-configuration-files

jobs:
check:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Download JSON schema for labels configuration file
id: download-schema
uses: carlosperate/[email protected]
with:
file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/arduino-tooling-gh-label-configuration-schema.json
location: ${{ runner.temp }}/label-configuration-schema

- name: Install JSON schema validator
run: |
sudo npm install \
--global \
ajv-cli \
ajv-formats
- name: Validate local labels configuration
run: |
# See: https://github.com/ajv-validator/ajv-cli#readme
ajv validate \
--all-errors \
-c ajv-formats \
-s "${{ steps.download-schema.outputs.file-path }}" \
-d "${{ env.CONFIGURATIONS_FOLDER }}/*.{yml,yaml}"
download:
needs: check
runs-on: ubuntu-latest

strategy:
matrix:
filename:
# Filenames of the shared configurations to apply to the repository in addition to the local configuration.
# https://github.com/107-systems/.github/blob/main/workflow-templates/assets/sync-labels
- universal.yml

steps:
- name: Download
uses: carlosperate/[email protected]
with:
file-url: https://raw.githubusercontent.com/107-systems/.github/main/workflow-templates/assets/sync-labels/${{ matrix.filename }}

- name: Pass configuration files to next job via workflow artifact
uses: actions/upload-artifact@v4
with:
path: |
*.yaml
*.yml
if-no-files-found: error
name: ${{ env.CONFIGURATIONS_ARTIFACT }}

sync:
needs: download
runs-on: ubuntu-latest

steps:
- name: Set environment variables
run: |
# See: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
echo "MERGED_CONFIGURATION_PATH=${{ runner.temp }}/labels.yml" >> "$GITHUB_ENV"
- name: Determine whether to dry run
id: dry-run
if: >
github.event == 'pull_request' ||
github.ref != format('refs/heads/{0}', github.event.repository.default_branch)
run: |
# Use of this flag in the github-label-sync command will cause it to only check the validity of the
# configuration.
echo "::set-output name=flag::--dry-run"
- name: Checkout repository
uses: actions/checkout@v4

- name: Download configuration files artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.CONFIGURATIONS_ARTIFACT }}
path: ${{ env.CONFIGURATIONS_FOLDER }}

- name: Remove unneeded artifact
uses: geekyeggo/delete-artifact@v4
with:
name: ${{ env.CONFIGURATIONS_ARTIFACT }}

- name: Merge label configuration files
run: |
# Merge all configuration files
shopt -s extglob
cat "${{ env.CONFIGURATIONS_FOLDER }}"/*.@(yml|yaml) > "${{ env.MERGED_CONFIGURATION_PATH }}"
- name: Install github-label-sync
run: sudo npm install --global github-label-sync

- name: Sync labels
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# See: https://github.com/Financial-Times/github-label-sync
github-label-sync \
--labels "${{ env.MERGED_CONFIGURATION_PATH }}" \
${{ steps.dry-run.outputs.flag }} \
${{ github.repository }}
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
build
log
install
**/__pycache__
.vscode
.idea/
cmake-build-debug/
39 changes: 39 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#######################################################################################
cmake_minimum_required(VERSION 3.8)
#######################################################################################
project(robotem_rovne)
set(ROBOTEM_ROVNE_ROBOT_TARGET ${PROJECT_NAME}_node)
#######################################################################################
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Werror -Wpedantic)
endif()
#######################################################################################
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(mp-units REQUIRED)
#######################################################################################
add_executable(${ROBOTEM_ROVNE_ROBOT_TARGET}
src/Node.cpp
src/main.cpp
)
#######################################################################################
target_include_directories(${ROBOTEM_ROVNE_ROBOT_TARGET} PRIVATE
include
${mp_units_INCLUDE_DIRS}
)
#######################################################################################
target_compile_features(${ROBOTEM_ROVNE_ROBOT_TARGET} PRIVATE cxx_std_20)
#######################################################################################
target_link_libraries(${ROBOTEM_ROVNE_ROBOT_TARGET}
${rclcpp_LIBRARIES}
${mp-units_LIBRARIES}
)
#######################################################################################
ament_target_dependencies(${ROBOTEM_ROVNE_ROBOT_TARGET} rclcpp std_msgs)
#######################################################################################
install(TARGETS ${ROBOTEM_ROVNE_ROBOT_TARGET} DESTINATION lib/${PROJECT_NAME})
install(DIRECTORY launch DESTINATION share/${PROJECT_NAME})
#######################################################################################
ament_package()
#######################################################################################
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Alexander Entinger, MSc / LXRobotics GmbH

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<a href="https://107-systems.org/"><img align="right" src="https://raw.githubusercontent.com/107-systems/.github/main/logo/107-systems.png" width="15%"></a>
:floppy_disk: `robotem_rovne`
=============================
[![Build Status](https://github.com/107-systems/robotem_rovne/actions/workflows/ros2.yml/badge.svg)](https://github.com/107-systems/robotem_rovne/actions/workflows/ros2.yml)
[![Spell Check status](https://github.com/107-systems/robotem_rovne/actions/workflows/spell-check.yml/badge.svg)](https://github.com/107-systems/robotem_rovne/actions/workflows/spell-check.yml)

Control code for [T07](https://github.com/107-systems/T07) based platforms to participate at Robotem Rovne.

#### How-to-build
```bash
cd $COLCON_WS/src
git clone --recursive https://github.com/107-systems/robotem_rovne
cd $COLCON_WS
source /opt/ros/humble/setup.bash
colcon build --packages-select robotem_rovne
```

#### How-to-run
```bash
cd $COLCON_WS
. install/setup.bash
ros2 launch robotem_rovne t07.py
```
58 changes: 58 additions & 0 deletions include/robotem_rovne/Node.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/**
* Copyright (c) 2023 LXRobotics GmbH.
* Author: Alexander Entinger <[email protected]>
* Contributors: https://github.com/107-systems/robotem_rovne/graphs/contributors.
*/

#pragma once

/**************************************************************************************
* INCLUDE
**************************************************************************************/

#include <memory>

#include <rclcpp/qos.hpp>
#include <rclcpp/rclcpp.hpp>

#include <std_msgs/msg/float32.hpp>

#include <mp-units/systems/si/si.h>
#include <mp-units/systems/angular/angular.h>

/**************************************************************************************
* NAMESPACE
**************************************************************************************/

using namespace mp_units;
using mp_units::si::unit_symbols::m;
using mp_units::si::unit_symbols::mm;
using mp_units::si::unit_symbols::s;
using mp_units::angular::unit_symbols::deg;
using mp_units::angular::unit_symbols::rad;

namespace t07
{

/**************************************************************************************
* CLASS DECLARATION
**************************************************************************************/

class Node : public rclcpp::Node
{
public:
Node();
~Node();

private:
static std::chrono::milliseconds constexpr CTRL_LOOP_RATE{50};
rclcpp::TimerBase::SharedPtr _ctrl_loop_timer;
void init_ctrl_loop();
void ctrl_loop();
};

/**************************************************************************************
* NAMESPACE
**************************************************************************************/

} /* t07 */
Loading

0 comments on commit 381e726

Please sign in to comment.