Skip to content

Commit

Permalink
release: version 3.2.0
Browse files Browse the repository at this point in the history
Version 3.2.0 is a minor update to modulo with a new feature that allows the component period parameter to be set
through a new parameter called 'rate'. In the future, the period parameter will be deprecated.
  • Loading branch information
domire8 authored Oct 23, 2023
2 parents 125b720 + 41a5990 commit d1aaea9
Show file tree
Hide file tree
Showing 22 changed files with 285 additions and 66 deletions.
3 changes: 3 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
"vscode": {
"extensions": [
"ms-vscode.cpptools-extension-pack",
"ms-python.pylint",
"ms-python.autopep8",
"ms-python.isort",
"eamodio.gitlens"
]
}
Expand Down
76 changes: 60 additions & 16 deletions .github/workflows/build-release.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,70 @@
name: Build and Push Multi-Arch Images
name: Build and release

on:
push:
branches:
- develop
- main
tags:
- "v*.*.*"

jobs:
get-tag:
runs-on: ubuntu-latest
name: Get tag
check-version:
name: Check if the version has been updated
outputs:
tag: ${{ steps.parse-tag.outputs.tag }}
has_changed: ${{ steps.check.outputs.has_changed }}
version: ${{ steps.versions.outputs.new_version }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: aica-technology/.github/.github/actions/docker-tag-from-git@v0.6.1
id: parse-tag
with:
fetch-depth: 2
- id: versions
run: |
PREV_VERSION=$(git show HEAD^:VERSION)
NEW_VERSION=$(git show HEAD:VERSION)
echo "prev_version=${PREV_VERSION}" >> $GITHUB_OUTPUT
echo "new_version=${NEW_VERSION}" >> $GITHUB_OUTPUT
shell: bash
- uses: aica-technology/.github/.github/actions/compare-versions@v0.11.0
id: check
with:
previous_version: ${{ steps.versions.outputs.prev_version }}
new_version: ${{ steps.versions.outputs.new_version }}

metadata:
name: Get metadata
needs: check-version
runs-on: ubuntu-latest
outputs:
image_name: ${{ steps.ensure-image.outputs.image_name }}
image_tags: ${{ steps.tags.outputs.image_tags }}
create_tag: ${{ steps.tags.outputs.create_tag }}
git_tag: ${{ steps.tags.outputs.git_tag }}
steps:
- uses: aica-technology/.github/.github/actions/ghcr-ensure-prefix@v0.6.0
id: ensure-image
with:
image_name: aica-technology/modulo

- run: |
CREATE_TAG=false
GIT_TAG=""
if [ ${{ needs.check-version.outputs.has_changed }} = 'true' ]; then
CREATE_TAG=true
GIT_TAG="v${{ needs.check-version.outputs.version }}"
IMAGE_TAGS=latest,"${GIT_TAG}",rolling
else
IMAGE_TAGS=rolling
fi
echo "Image tags: ${IMAGE_TAGS}"
echo "Create tag: ${CREATE_TAG}"
echo "Git tag: ${GIT_TAG}"
echo "image_tags=${IMAGE_TAGS}" >> $GITHUB_OUTPUT
echo "create_tag=${CREATE_TAG}" >> $GITHUB_OUTPUT
echo "git_tag=${GIT_TAG}" >> $GITHUB_OUTPUT
id: tags
shell: bash
build:
needs: [get-tag]
needs: metadata
strategy:
matrix:
arch: [amd64, arm64]
Expand All @@ -38,24 +82,24 @@ jobs:
- uses: aica-technology/.github/.github/actions/list-add-suffixes@v0.6.0
id: merge-tags
with:
list: ${{ needs.get-tag.outputs.tag }}
list: ${{ needs.metadata.outputs.image_tags }}
suffixes: ${{ matrix.arch }}
glue_separator: "-"

- uses: aica-technology/.github/.github/actions/ghcr-build@v0.6.1
with:
image_name: aica-technology/modulo
image_name: ${{ needs.metadata.outputs.image_name }}
image_tags: ${{ steps.merge-tags.outputs.list }}
token: ${{ secrets.GITHUB_TOKEN }}

multi-arch:
runs-on: ubuntu-latest
name: Merge into a multi-arch image
needs: [get-tag, build]
needs: [ metadata, build ]
steps:
- uses: aica-technology/.github/.github/actions/ghcr-manifest-merge@v0.6.1
with:
image_name: aica-technology/modulo
image_tags: ${{ needs.get-tag.outputs.tag }}
image_name: ${{ needs.metadata.outputs.image_name }}
image_tags: ${{ needs.metadata.outputs.image_tags }}
archs: amd64,arm64
token: ${{ secrets.GITHUB_TOKEN }}
1 change: 0 additions & 1 deletion .github/workflows/generate-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
push:
branches:
- main
- develop
release:
types: [published]
workflow_dispatch:
Expand Down
32 changes: 12 additions & 20 deletions .github/workflows/build-test.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
name: Build and Test
name: Check CHANGELOG update and run tests

on:
pull_request:
workflow_dispatch:

jobs:
check:
name: Check if changelog and version have been updated
check-changelog:
name: Check if changelog has been updated
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Check changelog
run: |
- uses: actions/checkout@v3
- run: |
git fetch origin main ${{ github.event.pull_request.base.sha }}
VER_DIFF=$(git diff ${{ github.event.pull_request.base.sha }} ${{ github.sha }} -- ./VERSION)
if ! [ "${VER_DIFF}" ]; then
echo "::warning title=Version check failed::VERSION must be updated!"
exit 1
fi
CL_DIFF=$(git diff ${{ github.event.pull_request.base.sha }} ${{ github.sha }} -- ./CHANGELOG.md)
if ! [ "${CL_DIFF}" ]; then
echo "::warning title=CHEANGELOG check failed::CHANGELOG.md must be updated!"
PACKAGE_DIFF=$(git diff ${{ github.event.pull_request.base.sha }} ${{ github.sha }} -- ./source)
CL_DIFF=$(git diff ${{ github.event.pull_request.base.sha }} ${{ github.sha }} -- CHANGELOG.md)
if [ "${PACKAGE_DIFF}" ] && ! [ "${CL_DIFF}" ]; then
echo "::error file="CHANGELOG.md",title=Check failed::CHANGELOG.md must be updated!"
exit 1
fi
shell: bash
Expand All @@ -30,14 +23,13 @@ jobs:
name: Check skippable changes
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.check_if_skippable.outputs.should_skip }}
skip: ${{ steps.check.outputs.should_skip }}
steps:
- id: check_if_skippable
- id: check
uses: fkirc/skip-duplicate-actions@master
with:
cancel_others: 'true'
do_not_skip: '["workflow_dispatch"]'
paths_ignore: '["**.md"]'
paths_ignore: '["**.md", ".**/**", "**.gitignore", "**.sh"]'
skip_after_successful_duplicate: 'true'

test:
Expand Down
2 changes: 1 addition & 1 deletion .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "AMD",
"includePath": [
"/opt/ros/humble/include/**",
"/opt/ros/iron/include/**",
"/home/ros2/ros2_ws/install/**",
"/home/ros2/ws/install/**",
"/home/ros2/ws/src/modulo_utils/include",
Expand Down
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
{
"C_Cpp.clang_format_style": "file:/home/ros2/.clang-format",
"cmake.sourceDirectory": "/home/ros2/ws/src/modulo_components",
"python.analysis.typeCheckingMode": "basic",
"python.languageServer": "Pylance",
"editor.rulers": [
120
],
"autopep8.args": ["--max-line-length", "120", "--experimental"],
"pylint.args": ["--generate-members", "--max-line-length", "120", "-d", "C0114", "-d", "C0115", "-d", "C0116"]
}
23 changes: 22 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,33 @@

Release Versions:

- [3.1.0](#300)
- [3.2.0](#320)
- [3.1.0](#310)
- [3.0.0](#300)
- [2.3.0](#230)
- [2.2.0](#220)
- [2.1.1](#211)
- [2.1.0](#210)

## 3.2.0

### October 23, 2023

Version 3.2.0 is a minor update to modulo with a new feature that allows the component period parameter to be set
through a new parameter called 'rate'. In the future, the period parameter will be deprecated.

Additionally, this is the last release with the current release strategy of creating release branches from develop and
merging them to main. From now on, branches will be directly created from main and merged back to main. If there is a
version update in such a PR, the CI will automatically create a new tag and push a tagged image.

### Features

- feat: add rate parameter to component interface (#57)

### Behind the scenes

- build: prepare workflows for deletion of develop branch (#58)

## 3.1.0

### September 27, 2023
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.0
3.2.0
2 changes: 1 addition & 1 deletion doxygen/doxygen.conf
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "Modulo"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 3.1.0
PROJECT_NUMBER = 3.2.0

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
2 changes: 1 addition & 1 deletion source/modulo_component_interfaces/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>modulo_component_interfaces</name>
<version>3.1.0</version>
<version>3.2.0</version>
<description>Interface package for communicating with modulo components through the ROS framework</description>
<maintainer email="enrico@aica.tech">Enrico Eberhard</maintainer>
<license>GPLv3</license>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,20 @@
"registration": "modulo_components::Component",
"inherits": "",
"parameters": [
{
"display_name": "Rate",
"description": "The frequency in Hertz for all periodic callbacks",
"parameter_name": "rate",
"parameter_type": "int",
"default_value": "10"
},
{
"display_name": "Period",
"description": "The time interval in seconds for all periodic callbacks",
"description": "The time interval in seconds for all periodic callbacks. This parameter is deprecated and will be removed in the next major release. The rate parameter takes precedence and overrides the component period.",
"parameter_name": "period",
"parameter_type": "double",
"default_value": "0.1"
"default_value": "0.1",
"internal": true
}
],
"predicates": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,20 @@
"registration": "modulo_components::LifecycleComponent",
"inherits": "",
"parameters": [
{
"display_name": "Rate",
"description": "The frequency in Hertz for all periodic callbacks",
"parameter_name": "rate",
"parameter_type": "int",
"default_value": "10"
},
{
"display_name": "Period",
"description": "The time interval in seconds for all periodic callbacks",
"description": "The time interval in seconds for all periodic callbacks. This parameter is deprecated and will be removed in the next major release. The rate parameter takes precedence and overrides the component period.",
"parameter_name": "period",
"parameter_type": "double",
"default_value": "0.1"
"default_value": "0.1",
"internal": true
}
],
"predicates": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -592,14 +592,15 @@ class ComponentInterface : public NodeT {
template<class NodeT>
ComponentInterface<NodeT>::ComponentInterface(
const rclcpp::NodeOptions& options, modulo_core::communication::PublisherType publisher_type,
const std::string& fallback_name
) :
NodeT(utilities::parse_node_name(options, fallback_name), options), publisher_type_(publisher_type) {
const std::string& fallback_name)
: NodeT(utilities::parse_node_name(options, fallback_name), utilities::modify_parameter_overrides(options)),
publisher_type_(publisher_type) {
// register the parameter change callback handler
parameter_cb_handle_ = NodeT::add_on_set_parameters_callback(
[this](const std::vector<rclcpp::Parameter>& parameters) -> rcl_interfaces::msg::SetParametersResult {
return this->on_set_parameters_callback(parameters);
});
this->add_parameter("rate", 10, "The rate in Hertz for all periodic callbacks", true);
this->add_parameter("period", 0.1, "The time interval in seconds for all periodic callbacks", true);

this->predicate_publisher_ =
Expand Down Expand Up @@ -712,6 +713,13 @@ template<class NodeT>
inline bool ComponentInterface<NodeT>::validate_parameter(
const std::shared_ptr<state_representation::ParameterInterface>& parameter
) {
if (parameter->get_name() == "rate") {
auto value = parameter->get_parameter_value<int>();
if (value <= 0 || !std::isfinite(value)) {
RCLCPP_ERROR(this->get_logger(), "Value for parameter 'rate' has to be a positive finite number.");
return false;
}
}
if (parameter->get_name() == "period") {
auto value = parameter->get_parameter_value<double>();
if (value <= 0.0 || !std::isfinite(value)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,40 @@ parse_node_name(const rclcpp::NodeOptions& options, const std::string& fallback
}
return output;
}

/**
* @brief Modify parameter overrides to handle the rate and period parameters
* @details This function checks for existence of the rate and period parameter in the parameter overrides
* and modifies them to correspond to the same value. If both the rate and the period parameter exist, the period will
* be set from the rate.
* @param options The node options passed to the component constructor
* @return The same node options with modified parameter overrides
*/
[[maybe_unused]] static rclcpp::NodeOptions modify_parameter_overrides(const rclcpp::NodeOptions& options) {
auto modified = options;
rclcpp::Parameter rate;
rclcpp::Parameter period;
std::vector<rclcpp::Parameter> parameters;
for (const auto& parameter : options.parameter_overrides()) {
if (parameter.get_name() == "rate") {
rate = parameter;
} else if (parameter.get_name() == "period") {
period = parameter;
} else {
parameters.push_back(parameter);
}
}
if (rate.get_type() != rclcpp::ParameterType::PARAMETER_NOT_SET) {
period = rclcpp::Parameter("period", 1.0 / rate.as_int());
} else if (period.get_type() != rclcpp::ParameterType::PARAMETER_NOT_SET) {
rate = rclcpp::Parameter("rate", static_cast<int>(1.0 / period.as_double()));
} else {
modified.parameter_overrides() = parameters;
return modified;
}
parameters.push_back(rate);
parameters.push_back(period);
modified.parameter_overrides() = parameters;
return modified;
}
}// namespace modulo_components::utilities
Loading

0 comments on commit d1aaea9

Please sign in to comment.