diff --git a/.github/actions/lint/run.sh b/.github/actions/lint/run.sh index 3441cf7..94e8f0c 100755 --- a/.github/actions/lint/run.sh +++ b/.github/actions/lint/run.sh @@ -2,6 +2,7 @@ set -e sudo apt-get update +source /opt/ros/$ROS_DISTRO/setup.bash if [[ "ament_flake8" == "ament_${LINTER}" ]]; then ament_${LINTER} . --config python_linter.flake8 else diff --git a/.github/workflows/build_and_test.yaml b/.github/workflows/build_and_test.yaml index e17d9b4..5c85c12 100644 --- a/.github/workflows/build_and_test.yaml +++ b/.github/workflows/build_and_test.yaml @@ -14,7 +14,7 @@ jobs: build: runs-on: ubuntu-latest container: - image: ubuntu:jammy + image: ubuntu:noble steps: - uses: ros-tooling/setup-ros@v0.7 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1f52448..bfe49b6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,11 +32,12 @@ repos: - id: black args: ["--line-length=120", "--preview", "--exclude=grasp_service_parameters.py"] - - repo: https://github.com/PyCQA/flake8 - rev: 6.1.0 + - repo: local hooks: - id: flake8 - args: ["--ignore=E501,W503,E203", "--exclude=grasp_service_parameters.py"] + name: flake8 checker + entry: bash -c "flake8 --config python_linter.flake8" + language: python - repo: https://github.com/PyCQA/doc8 rev: v1.1.1 diff --git a/python_linter.flake8 b/python_linter.flake8 index 364b497..a037c1f 100644 --- a/python_linter.flake8 +++ b/python_linter.flake8 @@ -1,3 +1,4 @@ [flake8] exclude = .git,__pycache__,grasp_service_parameters.py, install/*, build/* +extend-ignore = Q000, D100, D101, D104, D103, D102, D107 max-line-length = 120 diff --git a/ros2_grasp_service/ros2_grasp_service/grasp_service.py b/ros2_grasp_service/ros2_grasp_service/grasp_service.py index 1749659..354f9a6 100644 --- a/ros2_grasp_service/ros2_grasp_service/grasp_service.py +++ b/ros2_grasp_service/ros2_grasp_service/grasp_service.py @@ -1,14 +1,21 @@ -from rclpy import init, spin_once, shutdown, spin -from control_msgs.action import FollowJointTrajectory, GripperCommand -from rclpy.node import Node -from std_srvs.srv import Empty -from rclpy.action import ActionClient +from time import sleep + from action_msgs.msg import GoalStatus -from trajectory_msgs.msg import JointTrajectoryPoint, JointTrajectory + from builtin_interfaces.msg import Duration -from time import sleep + +from control_msgs.action import FollowJointTrajectory, GripperCommand + +from rclpy import init, shutdown, spin, spin_once +from rclpy.action import ActionClient +from rclpy.node import Node + from ros2_grasp_service.grasp_service_parameters import grasp_service_parameters +from std_srvs.srv import Empty + +from trajectory_msgs.msg import JointTrajectory, JointTrajectoryPoint + class FollowJointTrajectoryActionClient(Node): def __init__(self, joints_controller_name): diff --git a/ros2_grasp_service/setup.py b/ros2_grasp_service/setup.py index 56b51b6..ebb1504 100644 --- a/ros2_grasp_service/setup.py +++ b/ros2_grasp_service/setup.py @@ -1,7 +1,9 @@ +import os +from glob import glob + from generate_parameter_library_py.setup_helper import generate_parameter_module + from setuptools import find_packages, setup -from glob import glob -import os package_name = "ros2_grasp_service" diff --git a/ros2_grasp_service_demo/manipulator_simulation/launch/manipulator_simulation_bringup.launch.py b/ros2_grasp_service_demo/manipulator_simulation/launch/manipulator_simulation_bringup.launch.py index 79a7157..5b3232a 100644 --- a/ros2_grasp_service_demo/manipulator_simulation/launch/manipulator_simulation_bringup.launch.py +++ b/ros2_grasp_service_demo/manipulator_simulation/launch/manipulator_simulation_bringup.launch.py @@ -1,11 +1,14 @@ import os + from ament_index_python.packages import get_package_share_directory + from launch import LaunchDescription -from launch.actions import IncludeLaunchDescription, DeclareLaunchArgument +from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch_ros.actions import Node from launch.substitutions import LaunchConfiguration +from launch_ros.actions import Node + def generate_launch_description(): open_manipulator_bringup = IncludeLaunchDescription( diff --git a/ros2_grasp_service_demo/manipulator_simulation/setup.py b/ros2_grasp_service_demo/manipulator_simulation/setup.py index 6115a32..acf2a88 100644 --- a/ros2_grasp_service_demo/manipulator_simulation/setup.py +++ b/ros2_grasp_service_demo/manipulator_simulation/setup.py @@ -1,6 +1,7 @@ -from setuptools import find_packages, setup -from glob import glob import os +from glob import glob + +from setuptools import find_packages, setup package_name = "manipulator_simulation" diff --git a/ros2_grasp_service_demo/open_manipulator/open_manipulator_bringup/launch/open_manipulator_bringup.launch.py b/ros2_grasp_service_demo/open_manipulator/open_manipulator_bringup/launch/open_manipulator_bringup.launch.py index 2fad8ac..6af22a6 100644 --- a/ros2_grasp_service_demo/open_manipulator/open_manipulator_bringup/launch/open_manipulator_bringup.launch.py +++ b/ros2_grasp_service_demo/open_manipulator/open_manipulator_bringup/launch/open_manipulator_bringup.launch.py @@ -1,9 +1,11 @@ from ament_index_python.packages import get_package_share_directory + from launch import LaunchDescription -from launch.launch_description_sources import PythonLaunchDescriptionSource from launch.actions import IncludeLaunchDescription -from launch_ros.actions import Node +from launch.launch_description_sources import PythonLaunchDescriptionSource from launch.substitutions import PathJoinSubstitution + +from launch_ros.actions import Node from launch_ros.substitutions import FindPackageShare diff --git a/ros2_grasp_service_demo/open_manipulator/open_manipulator_bringup/setup.py b/ros2_grasp_service_demo/open_manipulator/open_manipulator_bringup/setup.py index 926b266..7769a9d 100644 --- a/ros2_grasp_service_demo/open_manipulator/open_manipulator_bringup/setup.py +++ b/ros2_grasp_service_demo/open_manipulator/open_manipulator_bringup/setup.py @@ -1,7 +1,8 @@ -from setuptools import find_packages, setup import os from glob import glob +from setuptools import find_packages, setup + package_name = "open_manipulator_bringup" setup( diff --git a/ros2_grasp_service_demo/open_manipulator/open_manipulator_control/launch/control.launch.py b/ros2_grasp_service_demo/open_manipulator/open_manipulator_control/launch/control.launch.py index 9da6859..e469d5e 100644 --- a/ros2_grasp_service_demo/open_manipulator/open_manipulator_control/launch/control.launch.py +++ b/ros2_grasp_service_demo/open_manipulator/open_manipulator_control/launch/control.launch.py @@ -1,10 +1,14 @@ +import os + +from ament_index_python.packages import get_package_share_directory + from launch import LaunchDescription -from launch_ros.actions import Node from launch.actions import ExecuteProcess, RegisterEventHandler from launch.event_handlers import OnProcessExit -from ament_index_python.packages import get_package_share_directory + +from launch_ros.actions import Node + import xacro -import os def generate_launch_description(): diff --git a/ros2_grasp_service_demo/open_manipulator/open_manipulator_control/setup.py b/ros2_grasp_service_demo/open_manipulator/open_manipulator_control/setup.py index 06bec71..79f217b 100644 --- a/ros2_grasp_service_demo/open_manipulator/open_manipulator_control/setup.py +++ b/ros2_grasp_service_demo/open_manipulator/open_manipulator_control/setup.py @@ -1,6 +1,7 @@ -from setuptools import find_packages, setup -from glob import glob import os +from glob import glob + +from setuptools import find_packages, setup package_name = "open_manipulator_control" diff --git a/ros2_grasp_service_demo/open_manipulator/open_manipulator_description/setup.py b/ros2_grasp_service_demo/open_manipulator/open_manipulator_description/setup.py index e6f6efc..e169c38 100644 --- a/ros2_grasp_service_demo/open_manipulator/open_manipulator_description/setup.py +++ b/ros2_grasp_service_demo/open_manipulator/open_manipulator_description/setup.py @@ -1,6 +1,7 @@ -from setuptools import find_packages, setup -from glob import glob import os +from glob import glob + +from setuptools import find_packages, setup package_name = "open_manipulator_description"