From 780f996cb0339526ee420a92ba7d934ee69fe049 Mon Sep 17 00:00:00 2001 From: rafal-gorecki Date: Fri, 7 Jun 2024 13:17:29 +0200 Subject: [PATCH] Add pre commit --- .github/workflows/colcon_test_build.yaml | 1 + .pre-commit-config.yaml | 121 +++++++++++++++++++++ CMakeLists.txt | 27 ++--- LICENSE.txt | 6 +- config/gz_orbbec_astra_remappings.yaml | 50 ++++----- config/kinova_6dof_controllers.yaml | 1 + config/kinova_7dof_controllers.yaml | 1 + config/robotiq_controllers.yaml | 2 +- config/ur_controllers.yaml | 25 +++-- env-hooks/ros_components_description.sh.in | 2 +- launch/gz_components.launch.py | 10 +- launch/gz_kinova_6dof.launch.py | 7 +- launch/gz_kinova_7dof.launch.py | 7 +- launch/gz_orbbec_astra.launch.py | 8 +- launch/gz_ouster_os.launch.py | 13 ++- launch/gz_robotiq.launch.py | 30 +++-- launch/gz_slamtec_rplidar.launch.py | 13 ++- launch/gz_ur.launch.py | 7 +- launch/gz_velodyne.launch.py | 13 ++- meshes/intel_realsense_d435.dae | 2 +- meshes/orbbec_astra.dae | 2 +- meshes/ouster_os01.dae | 2 +- meshes/slamtec_rplidar_a2m8.dae | 2 +- meshes/slamtec_rplidar_ax.dae | 2 +- meshes/slamtec_rplidar_s1.dae | 2 +- meshes/slamtec_rplidar_s3.dae | 2 +- meshes/velodyne_puck.dae | 2 +- package.xml | 17 ++- test/test_components_xacro.py | 19 ++-- urdf/intel_realsense_d435.urdf.xacro | 6 +- 30 files changed, 283 insertions(+), 119 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/colcon_test_build.yaml b/.github/workflows/colcon_test_build.yaml index 59035f6..d9a7afa 100644 --- a/.github/workflows/colcon_test_build.yaml +++ b/.github/workflows/colcon_test_build.yaml @@ -1,3 +1,4 @@ +--- name: ROS2 test build on: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..34fc77d --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,121 @@ +--- +repos: + # Standard hooks + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: check-added-large-files + # mesh files has to be taken into account + args: [--maxkb=3000] + - id: check-ast + - id: check-case-conflict + - id: check-merge-conflict + - id: check-symlinks + - id: check-xml + - id: check-yaml + - id: debug-statements + - id: destroyed-symlinks + - id: detect-private-key + - id: end-of-file-fixer + - id: fix-byte-order-marker + - id: name-tests-test + - id: mixed-line-ending + - id: trailing-whitespace + + # Python hooks + - repo: https://github.com/asottile/pyupgrade + rev: v3.15.2 + hooks: + - id: pyupgrade + args: [--py36-plus] + + - repo: https://github.com/psf/black + rev: 24.4.2 + hooks: + - id: black + args: [--line-length=99] + + - repo: https://github.com/PyCQA/flake8 + rev: 7.0.0 + hooks: + - id: flake8 + args: ['--ignore=E501,W503'] # ignore too long line and line break before binary operator, + # black checks it + + - repo: https://github.com/PyCQA/isort + rev: 5.13.2 + hooks: + - id: isort + args: [--profile, black] + + # CPP hooks + - repo: https://github.com/pre-commit/mirrors-clang-format + rev: v18.1.5 + hooks: + - id: clang-format + + - repo: local + hooks: + - id: ament_cppcheck + name: ament_cppcheck + description: Static code analysis of C/C++ files. + entry: env AMENT_CPPCHECK_ALLOW_SLOW_VERSIONS=1 ament_cppcheck + language: system + files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$ + + - repo: local + hooks: + - id: ament_cpplint + name: ament_cpplint + description: Static code analysis of C/C++ files. + entry: ament_cpplint + language: system + files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$ + args: [--linelength=100, --filter=-whitespace/newline] + + # Cmake hooks + - repo: local + hooks: + - id: ament_lint_cmake + name: ament_lint_cmake + description: Check format of CMakeLists.txt files. + entry: ament_lint_cmake + language: system + files: CMakeLists\.txt$ + + - repo: https://github.com/cheshirekow/cmake-format-precommit + rev: v0.6.13 + hooks: + - id: cmake-format + + # XML + - repo: https://github.com/tier4/pre-commit-hooks-ros + rev: v0.8.0 + hooks: + - id: prettier-package-xml + - id: sort-package-xml + + # YAML + - repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt + rev: 0.2.3 + hooks: + - id: yamlfmt + files: ^(?!.*compose)(?!.*ekf\.yaml$).*$ + args: [--mapping, '2', --sequence, '4', --offset, '2', --width, '100'] + + # Copyright + - repo: local + hooks: + - id: ament_copyright + name: ament_copyright + description: Check if copyright notice is available in all files. + entry: ament_copyright + language: system + + # Spellcheck + - repo: https://github.com/codespell-project/codespell + rev: v2.2.6 + hooks: + - id: codespell + args: [--write-changes, --uri-ignore-words-list=ist, -L manuel] + exclude: CHANGELOG\.rst|\.(svg|pyc|drawio)$ diff --git a/CMakeLists.txt b/CMakeLists.txt index c07fe79..4af46b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,26 +3,27 @@ project(ros_components_description) find_package(ament_cmake REQUIRED) -install( - DIRECTORY meshes urdf launch config test - DESTINATION share/${PROJECT_NAME} -) +install(DIRECTORY meshes urdf launch config test + DESTINATION share/${PROJECT_NAME}) if(BUILD_TESTING) find_package(ament_cmake_pytest REQUIRED) - set(pytest_tests - test/test_components_xacro.py - ) + set(pytest_tests test/test_components_xacro.py) foreach(test_path ${pytest_tests}) get_filename_component(test_name ${test_path} NAME_WE) - ament_add_pytest_test(${test_name} ${test_path} - APPEND_ENV PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR} - TIMEOUT 60 - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - ) + ament_add_pytest_test( + ${test_name} + ${test_path} + APPEND_ENV + PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR} + TIMEOUT + 60 + WORKING_DIRECTORY + ${CMAKE_SOURCE_DIR}) endforeach() endif() -ament_environment_hooks("${CMAKE_CURRENT_SOURCE_DIR}/env-hooks/${PROJECT_NAME}.sh.in") +ament_environment_hooks( + "${CMAKE_CURRENT_SOURCE_DIR}/env-hooks/${PROJECT_NAME}.sh.in") ament_export_dependencies(${THIS_PACKAGE_INCLUDE_DEPENDS}) ament_package() diff --git a/LICENSE.txt b/LICENSE.txt index 8d7be5d..13c8835 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,5 +1,5 @@ ROS COMPONENTS DESCRIPTION PACKAGE LICENSING -The default license for ROS components description package is the Apache License, Version 2.0 -(see LICENSE_APACHE2.txt); you may elect at your option to use the ROS COMPONENTS DESCRIPTION -package under the MIT License (see LICENSE_MIT.txt). Contributions must be +The default license for ROS components description package is the Apache License, Version 2.0 +(see LICENSE_APACHE2.txt); you may elect at your option to use the ROS COMPONENTS DESCRIPTION +package under the MIT License (see LICENSE_MIT.txt). Contributions must be made under both licenses. diff --git a/config/gz_orbbec_astra_remappings.yaml b/config/gz_orbbec_astra_remappings.yaml index 111cee2..11e1d5d 100644 --- a/config/gz_orbbec_astra_remappings.yaml +++ b/config/gz_orbbec_astra_remappings.yaml @@ -1,31 +1,31 @@ --- # https://github.com/orbbec/OrbbecSDK_ROS2#all-available-topics -- ros_topic_name: //color/camera_info - gz_topic_name: /color/camera_info - ros_type_name: sensor_msgs/msg/CameraInfo - gz_type_name: ignition.msgs.CameraInfo - lazy: true + - ros_topic_name: //color/camera_info + gz_topic_name: /color/camera_info + ros_type_name: sensor_msgs/msg/CameraInfo + gz_type_name: ignition.msgs.CameraInfo + lazy: true -- ros_topic_name: //color/image_raw - gz_topic_name: /color/image_raw - ros_type_name: sensor_msgs/msg/Image - gz_type_name: ignition.msgs.Image - lazy: true + - ros_topic_name: //color/image_raw + gz_topic_name: /color/image_raw + ros_type_name: sensor_msgs/msg/Image + gz_type_name: ignition.msgs.Image + lazy: true -- ros_topic_name: //depth/camera_info - gz_topic_name: /depth/camera_info - ros_type_name: sensor_msgs/msg/CameraInfo - gz_type_name: ignition.msgs.CameraInfo - lazy: true + - ros_topic_name: //depth/camera_info + gz_topic_name: /depth/camera_info + ros_type_name: sensor_msgs/msg/CameraInfo + gz_type_name: ignition.msgs.CameraInfo + lazy: true -- ros_topic_name: //depth/image_raw - gz_topic_name: /depth/image_raw - ros_type_name: sensor_msgs/msg/Image - gz_type_name: ignition.msgs.Image - lazy: true + - ros_topic_name: //depth/image_raw + gz_topic_name: /depth/image_raw + ros_type_name: sensor_msgs/msg/Image + gz_type_name: ignition.msgs.Image + lazy: true -- ros_topic_name: //depth/points - gz_ros_topic_name: /depth/image_raw/points - ros_type_name: sensor_msgs/msg/PointCloud2 - gz_type_name: ignition.msgs.PointCloudPacked - lazy: true + - ros_topic_name: //depth/points + gz_ros_topic_name: /depth/image_raw/points + ros_type_name: sensor_msgs/msg/PointCloud2 + gz_type_name: ignition.msgs.PointCloudPacked + lazy: true diff --git a/config/kinova_6dof_controllers.yaml b/config/kinova_6dof_controllers.yaml index 7990110..206262d 100644 --- a/config/kinova_6dof_controllers.yaml +++ b/config/kinova_6dof_controllers.yaml @@ -1,3 +1,4 @@ +--- /**: joint_trajectory_controller: ros__parameters: diff --git a/config/kinova_7dof_controllers.yaml b/config/kinova_7dof_controllers.yaml index af4e110..cf7ee9f 100644 --- a/config/kinova_7dof_controllers.yaml +++ b/config/kinova_7dof_controllers.yaml @@ -1,3 +1,4 @@ +--- /**: joint_trajectory_controller: ros__parameters: diff --git a/config/robotiq_controllers.yaml b/config/robotiq_controllers.yaml index 6035346..9cc737d 100644 --- a/config/robotiq_controllers.yaml +++ b/config/robotiq_controllers.yaml @@ -1,3 +1,4 @@ +--- /**: robotiq_gripper_controller: ros__parameters: @@ -10,4 +11,3 @@ ros__parameters: default: true joint: robotiq_85_left_knuckle_joint - diff --git a/config/ur_controllers.yaml b/config/ur_controllers.yaml index 8a03e26..06ce216 100644 --- a/config/ur_controllers.yaml +++ b/config/ur_controllers.yaml @@ -1,3 +1,4 @@ +--- /**: speed_scaling_state_broadcaster: ros__parameters: @@ -38,12 +39,12 @@ constraints: stopped_velocity_tolerance: 0.2 goal_time: 0.0 - shoulder_pan_joint: { trajectory: 0.2, goal: 0.1 } - shoulder_lift_joint: { trajectory: 0.2, goal: 0.1 } - elbow_joint: { trajectory: 0.2, goal: 0.1 } - wrist_1_joint: { trajectory: 0.2, goal: 0.1 } - wrist_2_joint: { trajectory: 0.2, goal: 0.1 } - wrist_3_joint: { trajectory: 0.2, goal: 0.1 } + shoulder_pan_joint: {trajectory: 0.2, goal: 0.1} + shoulder_lift_joint: {trajectory: 0.2, goal: 0.1} + elbow_joint: {trajectory: 0.2, goal: 0.1} + wrist_1_joint: {trajectory: 0.2, goal: 0.1} + wrist_2_joint: {trajectory: 0.2, goal: 0.1} + wrist_3_joint: {trajectory: 0.2, goal: 0.1} scaled_joint_trajectory_controller: @@ -66,12 +67,12 @@ constraints: stopped_velocity_tolerance: 0.2 goal_time: 0.0 - shoulder_pan_joint: { trajectory: 0.2, goal: 0.1 } - shoulder_lift_joint: { trajectory: 0.2, goal: 0.1 } - elbow_joint: { trajectory: 0.2, goal: 0.1 } - wrist_1_joint: { trajectory: 0.2, goal: 0.1 } - wrist_2_joint: { trajectory: 0.2, goal: 0.1 } - wrist_3_joint: { trajectory: 0.2, goal: 0.1 } + shoulder_pan_joint: {trajectory: 0.2, goal: 0.1} + shoulder_lift_joint: {trajectory: 0.2, goal: 0.1} + elbow_joint: {trajectory: 0.2, goal: 0.1} + wrist_1_joint: {trajectory: 0.2, goal: 0.1} + wrist_2_joint: {trajectory: 0.2, goal: 0.1} + wrist_3_joint: {trajectory: 0.2, goal: 0.1} forward_velocity_controller: ros__parameters: diff --git a/env-hooks/ros_components_description.sh.in b/env-hooks/ros_components_description.sh.in index 7c1fa5f..45d23a0 100755 --- a/env-hooks/ros_components_description.sh.in +++ b/env-hooks/ros_components_description.sh.in @@ -1,3 +1,3 @@ ament_prepend_unique_value GAZEBO_MODEL_PATH "@CMAKE_INSTALL_PREFIX@/share" ament_prepend_unique_value GZ_SIM_RESOURCE_PATH "@CMAKE_INSTALL_PREFIX@/share" -ament_prepend_unique_value IGN_GAZEBO_RESOURCE_PATH "@CMAKE_INSTALL_PREFIX@/share" \ No newline at end of file +ament_prepend_unique_value IGN_GAZEBO_RESOURCE_PATH "@CMAKE_INSTALL_PREFIX@/share" diff --git a/launch/gz_components.launch.py b/launch/gz_components.launch.py index 98980a5..175822d 100644 --- a/launch/gz_components.launch.py +++ b/launch/gz_components.launch.py @@ -13,17 +13,18 @@ # limitations under the License. import os + import yaml from ament_index_python.packages import get_package_share_directory + from launch import LaunchDescription from launch.actions import ( DeclareLaunchArgument, IncludeLaunchDescription, OpaqueFunction, ) - from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import LaunchConfiguration, EnvironmentVariable +from launch.substitutions import EnvironmentVariable, LaunchConfiguration def get_value(node: yaml.Node, key: str): @@ -63,6 +64,7 @@ def get_launch_descriptions_from_yaml_node( actions = [] components_types_with_names = { + "ANT02": "external_antenna", "LDR01": "slamtec_rplidar", "LDR06": "slamtec_rplidar", "LDR10": "ouster_os", @@ -106,11 +108,11 @@ def launch_setup(context, *args, **kwargs): if components_config_path == "None": return [] - with open(os.path.join(components_config_path), 'r') as file: + with open(os.path.join(components_config_path)) as file: components_config = yaml.safe_load(file) actions = [] - if components_config != None: + if components_config is not None: actions += get_launch_descriptions_from_yaml_node( components_config, ros_components_description, namespace ) diff --git a/launch/gz_kinova_6dof.launch.py b/launch/gz_kinova_6dof.launch.py index 941fa17..ee9df4a 100644 --- a/launch/gz_kinova_6dof.launch.py +++ b/launch/gz_kinova_6dof.launch.py @@ -12,17 +12,18 @@ # See the License for the specific language governing permissions and # limitations under the License. +from launch_ros.actions import Node +from launch_ros.substitutions import FindPackageShare +from nav2_common.launch import ReplaceString + from launch import LaunchDescription from launch.actions import DeclareLaunchArgument, OpaqueFunction -from launch_ros.actions import Node from launch.substitutions import ( EnvironmentVariable, LaunchConfiguration, PathJoinSubstitution, PythonExpression, ) -from launch_ros.substitutions import FindPackageShare -from nav2_common.launch import ReplaceString # The frame of the point cloud from ignition gazebo 6 isn't provided by . diff --git a/launch/gz_kinova_7dof.launch.py b/launch/gz_kinova_7dof.launch.py index b57e67e..beb7b20 100644 --- a/launch/gz_kinova_7dof.launch.py +++ b/launch/gz_kinova_7dof.launch.py @@ -12,17 +12,18 @@ # See the License for the specific language governing permissions and # limitations under the License. +from launch_ros.actions import Node +from launch_ros.substitutions import FindPackageShare +from nav2_common.launch import ReplaceString + from launch import LaunchDescription from launch.actions import DeclareLaunchArgument, OpaqueFunction -from launch_ros.actions import Node from launch.substitutions import ( EnvironmentVariable, LaunchConfiguration, PathJoinSubstitution, PythonExpression, ) -from launch_ros.substitutions import FindPackageShare -from nav2_common.launch import ReplaceString # The frame of the point cloud from ignition gazebo 6 isn't provided by . diff --git a/launch/gz_orbbec_astra.launch.py b/launch/gz_orbbec_astra.launch.py index 84bb00b..490243f 100644 --- a/launch/gz_orbbec_astra.launch.py +++ b/launch/gz_orbbec_astra.launch.py @@ -13,12 +13,14 @@ # limitations under the License. import os + +from ament_index_python import get_package_share_directory +from launch_ros.actions import Node +from nav2_common.launch import ReplaceString + from launch import LaunchDescription from launch.actions import DeclareLaunchArgument, OpaqueFunction -from launch_ros.actions import Node from launch.substitutions import EnvironmentVariable, LaunchConfiguration -from nav2_common.launch import ReplaceString -from ament_index_python import get_package_share_directory # The frame of the point cloud from ignition gazebo 6 isn't provided by . diff --git a/launch/gz_ouster_os.launch.py b/launch/gz_ouster_os.launch.py index d241318..fba2914 100644 --- a/launch/gz_ouster_os.launch.py +++ b/launch/gz_ouster_os.launch.py @@ -13,12 +13,14 @@ # limitations under the License. import os + +from ament_index_python import get_package_share_directory +from launch_ros.actions import Node +from nav2_common.launch import ReplaceString + from launch import LaunchDescription from launch.actions import DeclareLaunchArgument -from launch_ros.actions import Node from launch.substitutions import EnvironmentVariable, LaunchConfiguration -from nav2_common.launch import ReplaceString -from ament_index_python import get_package_share_directory def generate_launch_description(): @@ -33,7 +35,10 @@ def generate_launch_description(): namespaced_gz_bridge_config_path = ReplaceString( source_file=gz_bridge_config_path, - replacements={"": robot_namespace, "": device_namespace}, + replacements={ + "": robot_namespace, + "": device_namespace, + }, ) declare_device_namespace = DeclareLaunchArgument( diff --git a/launch/gz_robotiq.launch.py b/launch/gz_robotiq.launch.py index e5caebf..b3716a3 100644 --- a/launch/gz_robotiq.launch.py +++ b/launch/gz_robotiq.launch.py @@ -12,13 +12,20 @@ # See the License for the specific language governing permissions and # limitations under the License. -from launch import LaunchDescription -from launch.actions import DeclareLaunchArgument from launch_ros.actions import Node -from launch.substitutions import EnvironmentVariable, LaunchConfiguration, PathJoinSubstitution, PythonExpression from launch_ros.substitutions import FindPackageShare from nav2_common.launch import ReplaceString +from launch import LaunchDescription +from launch.actions import DeclareLaunchArgument +from launch.substitutions import ( + EnvironmentVariable, + LaunchConfiguration, + PathJoinSubstitution, + PythonExpression, +) + + def generate_launch_description(): robot_namespace = LaunchConfiguration("robot_namespace") device_namespace = LaunchConfiguration("device_namespace") @@ -27,7 +34,6 @@ def generate_launch_description(): [FindPackageShare("ros_components_description"), "config", "robotiq_controllers.yaml"] ) - # Using robot_namespace as prefix for controller name is caused by # https://github.com/ros-controls/ros2_control/issues/1506 # After this fix the device_namespace and --namespace should be used. @@ -39,8 +45,18 @@ def generate_launch_description(): source_file=initial_joint_controllers, replacements={ "robotiq_85_left_knuckle_joint": [device_namespace, "_robotiq_85_left_knuckle_joint"], - " robotiq_gripper_controller:": [" ", robot_namespace_ext, device_namespace, "_robotiq_gripper_controller:"], - " robotiq_activation_controller:": [" ", robot_namespace_ext, device_namespace, "_robotiq_activation_controller:"], + " robotiq_gripper_controller:": [ + " ", + robot_namespace_ext, + device_namespace, + "_robotiq_gripper_controller:", + ], + " robotiq_activation_controller:": [ + " ", + robot_namespace_ext, + device_namespace, + "_robotiq_activation_controller:", + ], }, ) @@ -63,7 +79,7 @@ def generate_launch_description(): # Using robot_namespace as prefix for controller name is caused by # https://github.com/ros-controls/ros2_control/issues/1506 # After this fix the device_namespace and --namespace should be used. - [robot_namespace_ext , device_namespace, "_robotiq_gripper_controller"], + [robot_namespace_ext, device_namespace, "_robotiq_gripper_controller"], "-t", "position_controllers/GripperActionController", "-c", diff --git a/launch/gz_slamtec_rplidar.launch.py b/launch/gz_slamtec_rplidar.launch.py index 8b655b9..f062b49 100644 --- a/launch/gz_slamtec_rplidar.launch.py +++ b/launch/gz_slamtec_rplidar.launch.py @@ -13,12 +13,14 @@ # limitations under the License. import os + +from ament_index_python import get_package_share_directory +from launch_ros.actions import Node +from nav2_common.launch import ReplaceString + from launch import LaunchDescription from launch.actions import DeclareLaunchArgument -from launch_ros.actions import Node from launch.substitutions import EnvironmentVariable, LaunchConfiguration -from nav2_common.launch import ReplaceString -from ament_index_python import get_package_share_directory def generate_launch_description(): @@ -33,7 +35,10 @@ def generate_launch_description(): namespaced_gz_bridge_config_path = ReplaceString( source_file=gz_bridge_config_path, - replacements={"": robot_namespace, "": device_namespace}, + replacements={ + "": robot_namespace, + "": device_namespace, + }, ) declare_device_namespace = DeclareLaunchArgument( diff --git a/launch/gz_ur.launch.py b/launch/gz_ur.launch.py index 8781d10..056f575 100644 --- a/launch/gz_ur.launch.py +++ b/launch/gz_ur.launch.py @@ -12,17 +12,18 @@ # See the License for the specific language governing permissions and # limitations under the License. +from launch_ros.actions import Node +from launch_ros.substitutions import FindPackageShare +from nav2_common.launch import ReplaceString + from launch import LaunchDescription from launch.actions import DeclareLaunchArgument -from launch_ros.actions import Node from launch.substitutions import ( EnvironmentVariable, LaunchConfiguration, PathJoinSubstitution, PythonExpression, ) -from launch_ros.substitutions import FindPackageShare -from nav2_common.launch import ReplaceString def generate_launch_description(): diff --git a/launch/gz_velodyne.launch.py b/launch/gz_velodyne.launch.py index 3aed15b..887e3ea 100644 --- a/launch/gz_velodyne.launch.py +++ b/launch/gz_velodyne.launch.py @@ -13,12 +13,14 @@ # limitations under the License. import os + +from ament_index_python import get_package_share_directory +from launch_ros.actions import Node +from nav2_common.launch import ReplaceString + from launch import LaunchDescription from launch.actions import DeclareLaunchArgument -from launch_ros.actions import Node from launch.substitutions import EnvironmentVariable, LaunchConfiguration -from nav2_common.launch import ReplaceString -from ament_index_python import get_package_share_directory def generate_launch_description(): @@ -33,7 +35,10 @@ def generate_launch_description(): namespaced_gz_bridge_config_path = ReplaceString( source_file=gz_bridge_config_path, - replacements={"": robot_namespace, "": device_namespace}, + replacements={ + "": robot_namespace, + "": device_namespace, + }, ) declare_device_namespace = DeclareLaunchArgument( diff --git a/meshes/intel_realsense_d435.dae b/meshes/intel_realsense_d435.dae index daee0ae..5961cc3 100644 --- a/meshes/intel_realsense_d435.dae +++ b/meshes/intel_realsense_d435.dae @@ -144,4 +144,4 @@ - \ No newline at end of file + diff --git a/meshes/orbbec_astra.dae b/meshes/orbbec_astra.dae index 034dc7d..0f4f759 100644 --- a/meshes/orbbec_astra.dae +++ b/meshes/orbbec_astra.dae @@ -190,4 +190,4 @@ - \ No newline at end of file + diff --git a/meshes/ouster_os01.dae b/meshes/ouster_os01.dae index b8ac4bf..0c15d31 100644 --- a/meshes/ouster_os01.dae +++ b/meshes/ouster_os01.dae @@ -164,4 +164,4 @@ - \ No newline at end of file + diff --git a/meshes/slamtec_rplidar_a2m8.dae b/meshes/slamtec_rplidar_a2m8.dae index 60e6299..a364852 100644 --- a/meshes/slamtec_rplidar_a2m8.dae +++ b/meshes/slamtec_rplidar_a2m8.dae @@ -138,4 +138,4 @@ - \ No newline at end of file + diff --git a/meshes/slamtec_rplidar_ax.dae b/meshes/slamtec_rplidar_ax.dae index bb0296c..1e19b02 100644 --- a/meshes/slamtec_rplidar_ax.dae +++ b/meshes/slamtec_rplidar_ax.dae @@ -138,4 +138,4 @@ - \ No newline at end of file + diff --git a/meshes/slamtec_rplidar_s1.dae b/meshes/slamtec_rplidar_s1.dae index 7766ac2..c54583f 100644 --- a/meshes/slamtec_rplidar_s1.dae +++ b/meshes/slamtec_rplidar_s1.dae @@ -138,4 +138,4 @@ - \ No newline at end of file + diff --git a/meshes/slamtec_rplidar_s3.dae b/meshes/slamtec_rplidar_s3.dae index cb4d2cb..1b47889 100644 --- a/meshes/slamtec_rplidar_s3.dae +++ b/meshes/slamtec_rplidar_s3.dae @@ -89,4 +89,4 @@ - \ No newline at end of file + diff --git a/meshes/velodyne_puck.dae b/meshes/velodyne_puck.dae index 3c8f945..7b3dd04 100644 --- a/meshes/velodyne_puck.dae +++ b/meshes/velodyne_puck.dae @@ -138,4 +138,4 @@ - \ No newline at end of file + diff --git a/package.xml b/package.xml index 202fbbe..b4b15b5 100644 --- a/package.xml +++ b/package.xml @@ -17,20 +17,19 @@ ament_cmake - robot_state_publisher - urdf - xacro - ur_description kortex_description - robotiq_description - - ros_gz_sim - ros_gz_bridge launch nav2_common + robot_state_publisher + robotiq_description + ros_gz_bridge + ros_gz_sim + ur_description + urdf + xacro - ament_index_python ament_cmake_pytest + ament_index_python python3-yaml diff --git a/test/test_components_xacro.py b/test/test_components_xacro.py index a480e65..6579912 100644 --- a/test/test_components_xacro.py +++ b/test/test_components_xacro.py @@ -13,11 +13,12 @@ # limitations under the License. +import os +import xml import xml.dom import xml.dom.minidom -import os + import xacro -import xml import yaml from ament_index_python.packages import get_package_share_directory @@ -81,26 +82,26 @@ def does_urdf_parse(self) -> bool: self._urdf = xacro.process_file( xacro_path, mappings={"components_config_path": self.components_config_path} ) - except xacro.XacroException as e: + except xacro.XacroException: return False return True def does_link_exist(self, doc: xml.dom.minidom.Document, link_name: str) -> bool: - links = doc.getElementsByTagName('link') + links = doc.getElementsByTagName("link") for link in links: - if link.getAttribute('name') == link_name: + if link.getAttribute("name") == link_name: return True return False def does_sensor_name_exist( self, doc: xml.dom.minidom.Document, link_name: str, sensor_name: str ) -> bool: - gazebos_tags = doc.getElementsByTagName('gazebo') + gazebos_tags = doc.getElementsByTagName("gazebo") for tag in gazebos_tags: - if tag.getAttribute('reference') == link_name: - sensors = doc.getElementsByTagName('sensor') + if tag.getAttribute("reference") == link_name: + sensors = doc.getElementsByTagName("sensor") for sensor in sensors: - if sensor.getAttribute('name') == sensor_name: + if sensor.getAttribute("name") == sensor_name: return True return False diff --git a/urdf/intel_realsense_d435.urdf.xacro b/urdf/intel_realsense_d435.urdf.xacro index 93b4d74..aa8861a 100644 --- a/urdf/intel_realsense_d435.urdf.xacro +++ b/urdf/intel_realsense_d435.urdf.xacro @@ -37,9 +37,9 @@ - + peripheral camera tripod mount --> @@ -52,7 +52,7 @@ -