From 0a1c804947cdb3f1f82c7cec519677389803e72e Mon Sep 17 00:00:00 2001 From: Lovro Date: Thu, 26 Nov 2020 19:33:45 +0000 Subject: [PATCH 1/3] Add parsing robot_description via xacro. --- .../rrbot_system_position_only.launch.py | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/ros2_control_demo_robot/launch/rrbot_system_position_only.launch.py b/ros2_control_demo_robot/launch/rrbot_system_position_only.launch.py index 2784643a8..3da46d837 100755 --- a/ros2_control_demo_robot/launch/rrbot_system_position_only.launch.py +++ b/ros2_control_demo_robot/launch/rrbot_system_position_only.launch.py @@ -26,23 +26,10 @@ def generate_launch_description(): ld = LaunchDescription() -# TODO(anyone): This does not work... why? -# robot_description_file = os.path.join( -# get_package_share_directory('ros2_control_demo_robot'), -# 'description', -# 'rrbot_system_position_only.urdf.xacro' -# ) -# descr = xacro.process_file(robot_description_file) - - robot_description_file = os.path.join( - get_package_share_directory('ros2_control_demo_robot'), - 'description', - 'rrbot_system_position_only.urdf' - ) - with open(robot_description_file, 'r') as infile: - descr = infile.read() - - robot_description = {'robot_description': descr} + # Get URDF via xacro + robot_description_path = os.path.join(get_package_share_directory('ros2_control_demo_robot'), 'description', 'rrbot_system_position_only.urdf.xacro') + robot_description_config = xacro.process_file(robot_description_path).toxml() + robot_description = {'robot_description': robot_description_config} rrbot_forward_controller = os.path.join( get_package_share_directory('ros2_control_demo_robot'), From 960fdeb449154ed8a8894ec4faf2e97849d0daeb Mon Sep 17 00:00:00 2001 From: Lovro Date: Fri, 27 Nov 2020 15:14:22 +0000 Subject: [PATCH 2/3] Fix pep8. --- .../launch/rrbot_system_position_only.launch.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ros2_control_demo_robot/launch/rrbot_system_position_only.launch.py b/ros2_control_demo_robot/launch/rrbot_system_position_only.launch.py index 3da46d837..8f826c67d 100755 --- a/ros2_control_demo_robot/launch/rrbot_system_position_only.launch.py +++ b/ros2_control_demo_robot/launch/rrbot_system_position_only.launch.py @@ -27,7 +27,8 @@ def generate_launch_description(): ld = LaunchDescription() # Get URDF via xacro - robot_description_path = os.path.join(get_package_share_directory('ros2_control_demo_robot'), 'description', 'rrbot_system_position_only.urdf.xacro') + robot_description_path = os.path.join(get_package_share_directory('ros2_control_demo_robot'), 'description', + 'rrbot_system_position_only.urdf.xacro') robot_description_config = xacro.process_file(robot_description_path).toxml() robot_description = {'robot_description': robot_description_config} From 7e6639b28345bbba150b4ad024066a7a428be475 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20=C5=A0togl?= Date: Fri, 27 Nov 2020 16:47:32 +0100 Subject: [PATCH 3/3] Make Linters and PEP8 happy --- .../launch/rrbot_system_position_only.launch.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ros2_control_demo_robot/launch/rrbot_system_position_only.launch.py b/ros2_control_demo_robot/launch/rrbot_system_position_only.launch.py index 8f826c67d..f98a855a8 100755 --- a/ros2_control_demo_robot/launch/rrbot_system_position_only.launch.py +++ b/ros2_control_demo_robot/launch/rrbot_system_position_only.launch.py @@ -24,13 +24,13 @@ def generate_launch_description(): - ld = LaunchDescription() - # Get URDF via xacro - robot_description_path = os.path.join(get_package_share_directory('ros2_control_demo_robot'), 'description', - 'rrbot_system_position_only.urdf.xacro') - robot_description_config = xacro.process_file(robot_description_path).toxml() - robot_description = {'robot_description': robot_description_config} + robot_description_path = os.path.join( + get_package_share_directory('ros2_control_demo_robot'), + 'description', + 'rrbot_system_position_only.urdf.xacro') + robot_description_config = xacro.process_file(robot_description_path) + robot_description = {'robot_description': robot_description_config.toxml()} rrbot_forward_controller = os.path.join( get_package_share_directory('ros2_control_demo_robot'),