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

Fix/package structure #3

Merged
merged 11 commits into from
Oct 18, 2024
Merged

Fix/package structure #3

merged 11 commits into from
Oct 18, 2024

Conversation

vitorsmends
Copy link
Owner

Pull Request Description: Linting and CI Setup for ROS 2 Package

Summary

This Pull Request introduces several enhancements to the CI pipeline, code quality checks, and ROS 2 node updates for the softrobots_teleop package. The following linters and tools have been configured to automatically run during pull requests and manual workflows:

Linters Configured

  • Uncrustify: Enforces code style and formatting for C++ files.
  • Cpplint: Ensures compliance with the Google C++ Style Guide.
  • CMake Linter: Validates the syntax and best practices for CMake files.
  • Flake8: Lints Python files (including ROS 2 launch files written in Python).
  • xmllint: Validates XML launch files.

ROS 2 Node Changes

  • The PointCloudProcessor node has been updated to load parameters directly from the ROS 2 parameter server instead of a YAML file. This change ensures that parameters such as red_threshold, green_threshold, blue_threshold, and topics are dynamically loaded during runtime.
  • The load_parameters method now uses ROS 2's declare_parameter and get_parameter functions to fetch values from the ROS 2 parameters.
  • The corresponding launch.py file was modified to pass these parameters directly to the node using the ros__parameters structure.
  • Nodes were adjusted to use logging for parameter values (via RCLCPP_INFO) to ensure proper parameter retrieval and debugging.

CI Pipeline

Additionally, a GitHub Actions workflow named colcon-action-runner has been configured to automate the build, testing, and code coverage generation for the softrobots_teleop package. The CI pipeline will:

  1. Setup the ROS 2 environment using Docker and ROS 2 Humble.
  2. Run linters across the codebase to ensure consistent style and syntax.
  3. Build and test the package using colcon for ROS 2 workspaces.
  4. Generate code coverage using lcov for C++ code and coveragepy for Python files.
  5. Report the code coverage results directly to pull requests.

Workflow Configuration

  • Trigger: The workflow is triggered on pull requests and manual dispatch.
  • Docker Environment: The CI runs inside a Docker container based on rostooling/setup-ros-docker with support for Ubuntu 22.04 (Jammy) and ROS 2 Humble.
  • Matrix Build: The linters and tests are executed in parallel using GitHub Actions matrix strategy.

New Files Introduced

  1. .github/workflows/lint.yml: Configures the GitHub Actions workflow for running the various linters.
  2. .github/workflows/colcon-action-runner.yml: Configures the CI pipeline to build, test, and generate code coverage for the ROS 2 package.

How to Test

  • Submit a pull request or manually trigger the GitHub Actions workflows to ensure that all linters, build, and test processes run successfully.
  • Verify that code coverage reports are automatically commented on the pull request.
  • Run the modified ROS 2 nodes to ensure that parameters are dynamically loaded from the ROS 2 parameter server.

Checklist

  • CI pipeline for ROS 2 workspace using colcon.
  • Linters configured for C++, CMake, Python, and XML.
  • ROS 2 nodes updated to use ROS parameters.
  • Automated code coverage generation and reporting.

Future Enhancements

  • Consider extending the coverage tools to include additional packages or ROS nodes.

@vitorsmends vitorsmends merged commit 6368dc8 into main Oct 18, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant