From a12993336df5ac7b3105d5539e9a3f4725ec55a3 Mon Sep 17 00:00:00 2001 From: Bartek Date: Thu, 22 Aug 2024 11:36:03 +0200 Subject: [PATCH 01/23] Created package for meldog urdf --- src/meldog_description/CMakeLists.txt | 26 ++++ src/meldog_description/LICENSE | 202 ++++++++++++++++++++++++++ src/meldog_description/package.xml | 18 +++ 3 files changed, 246 insertions(+) create mode 100644 src/meldog_description/CMakeLists.txt create mode 100644 src/meldog_description/LICENSE create mode 100644 src/meldog_description/package.xml diff --git a/src/meldog_description/CMakeLists.txt b/src/meldog_description/CMakeLists.txt new file mode 100644 index 00000000..1586b629 --- /dev/null +++ b/src/meldog_description/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.8) +project(meldog_description) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +# find dependencies +find_package(ament_cmake REQUIRED) +# uncomment the following section in order to fill in +# further dependencies manually. +# find_package( REQUIRED) + +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + # the following line skips the linter which checks for copyrights + # comment the line when a copyright and license is added to all source files + set(ament_cmake_copyright_FOUND TRUE) + # the following line skips cpplint (only works in a git repo) + # comment the line when this package is in a git repo and when + # a copyright and license is added to all source files + set(ament_cmake_cpplint_FOUND TRUE) + ament_lint_auto_find_test_dependencies() +endif() + +ament_package() diff --git a/src/meldog_description/LICENSE b/src/meldog_description/LICENSE new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/src/meldog_description/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/src/meldog_description/package.xml b/src/meldog_description/package.xml new file mode 100644 index 00000000..8c87aa77 --- /dev/null +++ b/src/meldog_description/package.xml @@ -0,0 +1,18 @@ + + + + meldog_description + 0.0.0 + TODO: Package description + bartek + Apache-2.0 + + ament_cmake + + ament_lint_auto + ament_lint_common + + + ament_cmake + + From be2c708e0d654cf70329b45bbfe00695652c63d4 Mon Sep 17 00:00:00 2001 From: Bartek Date: Sat, 31 Aug 2024 19:21:15 +0200 Subject: [PATCH 02/23] Added first base and trunk links for meldog --- src/meldog_description/CMakeLists.txt | 13 +++ .../description/meldog_core.urdf.xacro | 9 ++ .../description/trunk/trunk.urdf.xacro | 66 +++++++++++++ .../launch/robot_visualize.launch.py | 93 +++++++++++++++++++ src/meldog_description/package.xml | 7 ++ 5 files changed, 188 insertions(+) create mode 100644 src/meldog_description/description/meldog_core.urdf.xacro create mode 100644 src/meldog_description/description/trunk/trunk.urdf.xacro create mode 100644 src/meldog_description/launch/robot_visualize.launch.py diff --git a/src/meldog_description/CMakeLists.txt b/src/meldog_description/CMakeLists.txt index 1586b629..29752e11 100644 --- a/src/meldog_description/CMakeLists.txt +++ b/src/meldog_description/CMakeLists.txt @@ -7,6 +7,10 @@ endif() # find dependencies find_package(ament_cmake REQUIRED) +find_package(xacro REQUIRED) +find_package(urdf REQUIRED) +find_package(rviz2 REQUIRED) +find_package(robot_state_publisher REQUIRED) # uncomment the following section in order to fill in # further dependencies manually. # find_package( REQUIRED) @@ -23,4 +27,13 @@ if(BUILD_TESTING) ament_lint_auto_find_test_dependencies() endif() + +install(DIRECTORY + test_controllers + description + launch + worlds + DESTINATION share/${PROJECT_NAME} +) + ament_package() diff --git a/src/meldog_description/description/meldog_core.urdf.xacro b/src/meldog_description/description/meldog_core.urdf.xacro new file mode 100644 index 00000000..377bd404 --- /dev/null +++ b/src/meldog_description/description/meldog_core.urdf.xacro @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/meldog_description/description/trunk/trunk.urdf.xacro b/src/meldog_description/description/trunk/trunk.urdf.xacro new file mode 100644 index 00000000..3723aef3 --- /dev/null +++ b/src/meldog_description/description/trunk/trunk.urdf.xacro @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/meldog_description/launch/robot_visualize.launch.py b/src/meldog_description/launch/robot_visualize.launch.py new file mode 100644 index 00000000..0aceadfe --- /dev/null +++ b/src/meldog_description/launch/robot_visualize.launch.py @@ -0,0 +1,93 @@ +from launch import LaunchDescription +from launch.actions import DeclareLaunchArgument, RegisterEventHandler +from launch.conditions import IfCondition +from launch.event_handlers import OnProcessExit +from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution + +from launch_ros.actions import Node +from launch_ros.substitutions import FindPackageShare + + +def generate_launch_description(): + # Declare arguments + declared_arguments = [] + + declared_arguments.append( + DeclareLaunchArgument( + "gui", + default_value="true", + description="Start RViz2 automatically with this launch file.", + ) + ) + declared_arguments.append( + DeclareLaunchArgument( + "package", + default_value="meldog_description", + ) + ) + + declared_arguments.append( + DeclareLaunchArgument( + "urdf_file", + default_value="meldog_core.urdf.xacro", + ) + ) + + + # Initialize Arguments + package_name = LaunchConfiguration("package") + urdf_file = LaunchConfiguration("urdf_file") + + # Get URDF via xacro + robot_description_content = Command( + [ + PathJoinSubstitution([FindExecutable(name="xacro")]), + " ", + PathJoinSubstitution( + [ + FindPackageShare(package_name), + "description", + urdf_file, + ] + ), + ] + ) + robot_description = {"robot_description": robot_description_content} + + # rviz_config_file = PathJoinSubstitution( + # [FindPackageShare("ros2_control_demo_description"), "rrbot/rviz", "rrbot.rviz"] + # ) + + robot_state_pub_node = Node( + package="robot_state_publisher", + executable="robot_state_publisher", + output="both", + parameters=[robot_description], + ) + + joint_state_publisher_gui = Node( + package = "joint_state_publisher_gui", + executable = "joint_state_publisher_gui", + ) + + # Initialize Arguments + gui = LaunchConfiguration("gui") + + rviz_node = Node( + package="rviz2", + executable="rviz2", + name="rviz2", + output="log", + # arguments=["-d", rviz_config_file], + condition=IfCondition(gui), + ) + + + + nodes = [ + robot_state_pub_node, + joint_state_publisher_gui, + rviz_node + ] + + return LaunchDescription(declared_arguments + nodes) \ No newline at end of file diff --git a/src/meldog_description/package.xml b/src/meldog_description/package.xml index 8c87aa77..1c26018a 100644 --- a/src/meldog_description/package.xml +++ b/src/meldog_description/package.xml @@ -9,6 +9,13 @@ ament_cmake + ros2launch + rviz2 + urdf + xacro + joint_state_publisher_gui + robot_state_publisher + ament_lint_auto ament_lint_common From f58ac72451d06c6607ba65c48dc24061e8472961 Mon Sep 17 00:00:00 2001 From: Bartek Date: Sun, 1 Sep 2024 15:52:00 +0200 Subject: [PATCH 03/23] Hip links and joints added --- .../description/hip/hip.urdf.xacro | 35 +++++++++++ .../description/meldog_core.urdf.xacro | 59 ++++++++++++++++++- .../description/trunk/trunk.urdf.xacro | 13 +--- 3 files changed, 95 insertions(+), 12 deletions(-) create mode 100644 src/meldog_description/description/hip/hip.urdf.xacro diff --git a/src/meldog_description/description/hip/hip.urdf.xacro b/src/meldog_description/description/hip/hip.urdf.xacro new file mode 100644 index 00000000..46deb5ca --- /dev/null +++ b/src/meldog_description/description/hip/hip.urdf.xacro @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/meldog_description/description/meldog_core.urdf.xacro b/src/meldog_description/description/meldog_core.urdf.xacro index 377bd404..5a9de98b 100644 --- a/src/meldog_description/description/meldog_core.urdf.xacro +++ b/src/meldog_description/description/meldog_core.urdf.xacro @@ -1,9 +1,66 @@ + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/meldog_description/description/trunk/trunk.urdf.xacro b/src/meldog_description/description/trunk/trunk.urdf.xacro index 3723aef3..7174b266 100644 --- a/src/meldog_description/description/trunk/trunk.urdf.xacro +++ b/src/meldog_description/description/trunk/trunk.urdf.xacro @@ -1,14 +1,5 @@ - - - - - - - - - - + @@ -18,7 +9,7 @@ - + From 37335dce40754d1e8f13fb2b5648f65a69832139 Mon Sep 17 00:00:00 2001 From: Bartek Date: Sun, 1 Sep 2024 16:18:17 +0200 Subject: [PATCH 04/23] Lower leg links and joints added --- .../lower_leg/lower_leg.urdf.xacro | 33 ++++++++++++ .../description/meldog_core.urdf.xacro | 52 +++++++++++++++++++ .../launch/robot_visualize.launch.py | 7 ++- 3 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 src/meldog_description/description/lower_leg/lower_leg.urdf.xacro diff --git a/src/meldog_description/description/lower_leg/lower_leg.urdf.xacro b/src/meldog_description/description/lower_leg/lower_leg.urdf.xacro new file mode 100644 index 00000000..9d31d0ac --- /dev/null +++ b/src/meldog_description/description/lower_leg/lower_leg.urdf.xacro @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/meldog_description/description/meldog_core.urdf.xacro b/src/meldog_description/description/meldog_core.urdf.xacro index 5a9de98b..cf2764f5 100644 --- a/src/meldog_description/description/meldog_core.urdf.xacro +++ b/src/meldog_description/description/meldog_core.urdf.xacro @@ -4,6 +4,8 @@ + + @@ -18,6 +20,17 @@ + + + + + + + + + + + @@ -26,6 +39,7 @@ + @@ -63,4 +77,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/meldog_description/launch/robot_visualize.launch.py b/src/meldog_description/launch/robot_visualize.launch.py index 0aceadfe..e32d3ec9 100644 --- a/src/meldog_description/launch/robot_visualize.launch.py +++ b/src/meldog_description/launch/robot_visualize.launch.py @@ -7,6 +7,8 @@ from launch_ros.actions import Node from launch_ros.substitutions import FindPackageShare +from launch_ros.parameter_descriptions import ParameterValue + def generate_launch_description(): # Declare arguments @@ -39,7 +41,8 @@ def generate_launch_description(): urdf_file = LaunchConfiguration("urdf_file") # Get URDF via xacro - robot_description_content = Command( + robot_description_content = ParameterValue( + Command( [ PathJoinSubstitution([FindExecutable(name="xacro")]), " ", @@ -51,7 +54,7 @@ def generate_launch_description(): ] ), ] - ) + ), value_type=str) robot_description = {"robot_description": robot_description_content} # rviz_config_file = PathJoinSubstitution( From 553a783f8dbc2c37b68635589872e399045ee3dc Mon Sep 17 00:00:00 2001 From: Bartek Date: Mon, 2 Sep 2024 17:29:51 +0200 Subject: [PATCH 05/23] Added shank links and joints, changed lower_leg to thigh --- .../description/meldog_core.urdf.xacro | 99 ++++++++++++++----- .../description/shank/shank.urdf.xacro | 33 +++++++ .../thigh.urdf.xacro} | 16 +-- 3 files changed, 113 insertions(+), 35 deletions(-) create mode 100644 src/meldog_description/description/shank/shank.urdf.xacro rename src/meldog_description/description/{lower_leg/lower_leg.urdf.xacro => thigh/thigh.urdf.xacro} (63%) diff --git a/src/meldog_description/description/meldog_core.urdf.xacro b/src/meldog_description/description/meldog_core.urdf.xacro index cf2764f5..e7a6b7c5 100644 --- a/src/meldog_description/description/meldog_core.urdf.xacro +++ b/src/meldog_description/description/meldog_core.urdf.xacro @@ -20,19 +20,27 @@ - - - - - - + + + + + + + + + + + + + + - + @@ -41,7 +49,7 @@ - + @@ -50,7 +58,7 @@ - + @@ -59,7 +67,7 @@ - + @@ -68,7 +76,7 @@ - + @@ -77,38 +85,75 @@ - - - + + + - + - - - + + + - + - - - + + + - + - - - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/meldog_description/description/shank/shank.urdf.xacro b/src/meldog_description/description/shank/shank.urdf.xacro new file mode 100644 index 00000000..f5e739f8 --- /dev/null +++ b/src/meldog_description/description/shank/shank.urdf.xacro @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/meldog_description/description/lower_leg/lower_leg.urdf.xacro b/src/meldog_description/description/thigh/thigh.urdf.xacro similarity index 63% rename from src/meldog_description/description/lower_leg/lower_leg.urdf.xacro rename to src/meldog_description/description/thigh/thigh.urdf.xacro index 9d31d0ac..22197a98 100644 --- a/src/meldog_description/description/lower_leg/lower_leg.urdf.xacro +++ b/src/meldog_description/description/thigh/thigh.urdf.xacro @@ -1,23 +1,23 @@ - + - - + + - - + + - + - + - + From e4b030469d7c4ca2838ce7f11668a68acf8f0bc2 Mon Sep 17 00:00:00 2001 From: Bartek Date: Tue, 3 Sep 2024 20:09:24 +0200 Subject: [PATCH 06/23] Changed shank joints and added feet links and joints --- .../description/feet/feet.urdf.xacro | 52 +++++++++++++++++++ .../description/meldog_core.urdf.xacro | 46 +++++++++++++--- 2 files changed, 92 insertions(+), 6 deletions(-) create mode 100644 src/meldog_description/description/feet/feet.urdf.xacro diff --git a/src/meldog_description/description/feet/feet.urdf.xacro b/src/meldog_description/description/feet/feet.urdf.xacro new file mode 100644 index 00000000..a930d017 --- /dev/null +++ b/src/meldog_description/description/feet/feet.urdf.xacro @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/meldog_description/description/meldog_core.urdf.xacro b/src/meldog_description/description/meldog_core.urdf.xacro index e7a6b7c5..5ed44800 100644 --- a/src/meldog_description/description/meldog_core.urdf.xacro +++ b/src/meldog_description/description/meldog_core.urdf.xacro @@ -36,6 +36,13 @@ + + + + + + + @@ -62,7 +69,7 @@ - + @@ -71,7 +78,7 @@ - + @@ -90,7 +97,7 @@ - + @@ -99,7 +106,7 @@ - + @@ -127,7 +134,7 @@ - + @@ -136,7 +143,7 @@ - + @@ -159,5 +166,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 993d96e5e4be50c97221858acda333caa4504858 Mon Sep 17 00:00:00 2001 From: Bartek Date: Wed, 4 Sep 2024 18:14:14 +0200 Subject: [PATCH 07/23] Deleted feed link, added only frames --- .../description/feet/feet.urdf.xacro | 52 ------------------- .../description/meldog_core.urdf.xacro | 15 +++--- .../description/shank/shank.urdf.xacro | 13 ++++- 3 files changed, 19 insertions(+), 61 deletions(-) delete mode 100644 src/meldog_description/description/feet/feet.urdf.xacro diff --git a/src/meldog_description/description/feet/feet.urdf.xacro b/src/meldog_description/description/feet/feet.urdf.xacro deleted file mode 100644 index a930d017..00000000 --- a/src/meldog_description/description/feet/feet.urdf.xacro +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/meldog_description/description/meldog_core.urdf.xacro b/src/meldog_description/description/meldog_core.urdf.xacro index 5ed44800..7f144376 100644 --- a/src/meldog_description/description/meldog_core.urdf.xacro +++ b/src/meldog_description/description/meldog_core.urdf.xacro @@ -36,14 +36,13 @@ - - - - - - - - + + + + + + + diff --git a/src/meldog_description/description/shank/shank.urdf.xacro b/src/meldog_description/description/shank/shank.urdf.xacro index f5e739f8..1bb9ef35 100644 --- a/src/meldog_description/description/shank/shank.urdf.xacro +++ b/src/meldog_description/description/shank/shank.urdf.xacro @@ -3,6 +3,7 @@ + @@ -17,11 +18,21 @@ - + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/meldog_description/description/shank/shank.urdf.xacro b/src/meldog_description/description/shank/shank.urdf.xacro index 1bb9ef35..11155115 100644 --- a/src/meldog_description/description/shank/shank.urdf.xacro +++ b/src/meldog_description/description/shank/shank.urdf.xacro @@ -3,42 +3,51 @@ - + + - - - + + + - + + - + - - + - + - - + + \ No newline at end of file diff --git a/src/meldog_description/description/thigh/thigh.urdf.xacro b/src/meldog_description/description/thigh/thigh.urdf.xacro index 22197a98..21e0b5e2 100644 --- a/src/meldog_description/description/thigh/thigh.urdf.xacro +++ b/src/meldog_description/description/thigh/thigh.urdf.xacro @@ -4,30 +4,33 @@ + - - - + + + - + + - + - - + + diff --git a/src/meldog_description/description/trunk/trunk.urdf.xacro b/src/meldog_description/description/trunk/trunk.urdf.xacro index 7174b266..34b2dfba 100644 --- a/src/meldog_description/description/trunk/trunk.urdf.xacro +++ b/src/meldog_description/description/trunk/trunk.urdf.xacro @@ -9,48 +9,60 @@ + + - - + + - + - + - - + - - + - - + + - + + + + + + + + + + + + + From e689457da2f999aa13ee5c9254c9aca01d6d744c Mon Sep 17 00:00:00 2001 From: Bartek Date: Thu, 5 Sep 2024 18:43:24 +0200 Subject: [PATCH 09/23] Added xacro files for actuator (joints) and gazebo links and joints parameters --- .../description/actuator/actuator.urdf.xacro | 16 +++++++ .../gazebo/gazebo_macros.urdf.xacro | 46 +++++++++++++++++++ .../description/meldog_core.urdf.xacro | 1 - 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 src/meldog_description/description/actuator/actuator.urdf.xacro create mode 100644 src/meldog_description/description/gazebo/gazebo_macros.urdf.xacro diff --git a/src/meldog_description/description/actuator/actuator.urdf.xacro b/src/meldog_description/description/actuator/actuator.urdf.xacro new file mode 100644 index 00000000..217c827b --- /dev/null +++ b/src/meldog_description/description/actuator/actuator.urdf.xacro @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/meldog_description/description/gazebo/gazebo_macros.urdf.xacro b/src/meldog_description/description/gazebo/gazebo_macros.urdf.xacro new file mode 100644 index 00000000..60e8a276 --- /dev/null +++ b/src/meldog_description/description/gazebo/gazebo_macros.urdf.xacro @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + Gazebo/${color} + + + + + + + ${selfCollide_value} + + + + + + + + + + + + + + ${Damper_value} + ${springstiffness_value} + ${springReference_value} + ${stopErp_value} + ${stopCfm_value} + + + + + \ No newline at end of file diff --git a/src/meldog_description/description/meldog_core.urdf.xacro b/src/meldog_description/description/meldog_core.urdf.xacro index 7f144376..1ff1ff58 100644 --- a/src/meldog_description/description/meldog_core.urdf.xacro +++ b/src/meldog_description/description/meldog_core.urdf.xacro @@ -44,7 +44,6 @@ - From b0d2ba7a959fc328f4d3585a7495ebeb98bdcee0 Mon Sep 17 00:00:00 2001 From: Bartek Date: Fri, 6 Sep 2024 13:54:21 +0200 Subject: [PATCH 10/23] Added feet links and joints, added realistic joint limits for actuators --- .../actuator_macros.urdf.xacro} | 8 ++-- .../gazebo_macros.urdf.xacro | 3 +- .../description/feet/feet.urdf.xacro | 34 ++++++++++++++++ .../description/meldog_core.urdf.xacro | 39 +++++++++++-------- .../description/meldog_gazebo.urdf.xacro | 7 ++++ .../description/shank/shank.urdf.xacro | 17 -------- 6 files changed, 68 insertions(+), 40 deletions(-) rename src/meldog_description/description/{actuator/actuator.urdf.xacro => common/actuator_macros.urdf.xacro} (62%) rename src/meldog_description/description/{gazebo => common}/gazebo_macros.urdf.xacro (93%) create mode 100644 src/meldog_description/description/feet/feet.urdf.xacro create mode 100644 src/meldog_description/description/meldog_gazebo.urdf.xacro diff --git a/src/meldog_description/description/actuator/actuator.urdf.xacro b/src/meldog_description/description/common/actuator_macros.urdf.xacro similarity index 62% rename from src/meldog_description/description/actuator/actuator.urdf.xacro rename to src/meldog_description/description/common/actuator_macros.urdf.xacro index 217c827b..0000542b 100644 --- a/src/meldog_description/description/actuator/actuator.urdf.xacro +++ b/src/meldog_description/description/common/actuator_macros.urdf.xacro @@ -2,10 +2,10 @@ - - - - + + + + diff --git a/src/meldog_description/description/gazebo/gazebo_macros.urdf.xacro b/src/meldog_description/description/common/gazebo_macros.urdf.xacro similarity index 93% rename from src/meldog_description/description/gazebo/gazebo_macros.urdf.xacro rename to src/meldog_description/description/common/gazebo_macros.urdf.xacro index 60e8a276..21d95a3f 100644 --- a/src/meldog_description/description/gazebo/gazebo_macros.urdf.xacro +++ b/src/meldog_description/description/common/gazebo_macros.urdf.xacro @@ -9,9 +9,8 @@ - - + Gazebo/${color} diff --git a/src/meldog_description/description/feet/feet.urdf.xacro b/src/meldog_description/description/feet/feet.urdf.xacro new file mode 100644 index 00000000..a7512e53 --- /dev/null +++ b/src/meldog_description/description/feet/feet.urdf.xacro @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/meldog_description/description/meldog_core.urdf.xacro b/src/meldog_description/description/meldog_core.urdf.xacro index 1ff1ff58..fee23c71 100644 --- a/src/meldog_description/description/meldog_core.urdf.xacro +++ b/src/meldog_description/description/meldog_core.urdf.xacro @@ -1,9 +1,12 @@ - + + + + @@ -37,10 +40,11 @@ - - - - + + + + + @@ -59,7 +63,7 @@ - + @@ -68,7 +72,7 @@ - + @@ -77,7 +81,7 @@ - + @@ -86,7 +90,7 @@ - + @@ -96,7 +100,7 @@ - + @@ -105,7 +109,7 @@ - + @@ -114,7 +118,7 @@ - + @@ -123,7 +127,7 @@ - + @@ -133,7 +137,7 @@ - + @@ -142,7 +146,7 @@ - + @@ -151,7 +155,7 @@ - + @@ -160,7 +164,7 @@ - + @@ -192,4 +196,5 @@ + \ No newline at end of file diff --git a/src/meldog_description/description/meldog_gazebo.urdf.xacro b/src/meldog_description/description/meldog_gazebo.urdf.xacro new file mode 100644 index 00000000..7d6b4c78 --- /dev/null +++ b/src/meldog_description/description/meldog_gazebo.urdf.xacro @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/src/meldog_description/description/shank/shank.urdf.xacro b/src/meldog_description/description/shank/shank.urdf.xacro index 11155115..370e5eeb 100644 --- a/src/meldog_description/description/shank/shank.urdf.xacro +++ b/src/meldog_description/description/shank/shank.urdf.xacro @@ -3,7 +3,6 @@ - @@ -24,16 +23,6 @@ - - - - - - - - - - @@ -41,12 +30,6 @@ - - - - - - From 1029fc8c88b13d76f05aac6449c1b549e7f09516 Mon Sep 17 00:00:00 2001 From: Bartek Date: Fri, 6 Sep 2024 14:32:25 +0200 Subject: [PATCH 11/23] Added transmission macros --- .../common/gazebo_macros.urdf.xacro | 4 +- .../common/transmission_macros.urdf.xacro | 51 +++++++++++++++++ .../description/meldog_core.urdf.xacro | 3 - .../description/meldog_gazebo.urdf.xacro | 56 +++++++++++++++++++ 4 files changed, 109 insertions(+), 5 deletions(-) create mode 100644 src/meldog_description/description/common/transmission_macros.urdf.xacro diff --git a/src/meldog_description/description/common/gazebo_macros.urdf.xacro b/src/meldog_description/description/common/gazebo_macros.urdf.xacro index 21d95a3f..485b476a 100644 --- a/src/meldog_description/description/common/gazebo_macros.urdf.xacro +++ b/src/meldog_description/description/common/gazebo_macros.urdf.xacro @@ -11,7 +11,7 @@ - + Gazebo/${color} @@ -32,7 +32,7 @@ - + ${Damper_value} ${springstiffness_value} ${springReference_value} diff --git a/src/meldog_description/description/common/transmission_macros.urdf.xacro b/src/meldog_description/description/common/transmission_macros.urdf.xacro new file mode 100644 index 00000000..6e9a2104 --- /dev/null +++ b/src/meldog_description/description/common/transmission_macros.urdf.xacro @@ -0,0 +1,51 @@ + + + + + + + transmission_interface/SimpleTransmission + + + ${reduction} + ${offset} + + + + + + + + transmission_interface/FourBarLinkageTransmission + + ${reduction} + + + ${reduction} + + + 1.0 + ${first_offset} + + + 1.0 + ${second_offset} + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/meldog_description/description/meldog_core.urdf.xacro b/src/meldog_description/description/meldog_core.urdf.xacro index fee23c71..196852f3 100644 --- a/src/meldog_description/description/meldog_core.urdf.xacro +++ b/src/meldog_description/description/meldog_core.urdf.xacro @@ -8,8 +8,6 @@ - - @@ -47,7 +45,6 @@ - diff --git a/src/meldog_description/description/meldog_gazebo.urdf.xacro b/src/meldog_description/description/meldog_gazebo.urdf.xacro index 7d6b4c78..7912a27d 100644 --- a/src/meldog_description/description/meldog_gazebo.urdf.xacro +++ b/src/meldog_description/description/meldog_gazebo.urdf.xacro @@ -4,4 +4,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + gazebo_ros2_control/GazeboSystem + + + \ No newline at end of file From b68564688cffdcadef88738765d0e90427974e91 Mon Sep 17 00:00:00 2001 From: Bartek Date: Fri, 6 Sep 2024 14:41:56 +0200 Subject: [PATCH 12/23] Added ros2_control_gazebo urdf and changed locations of other xacro files --- .../{common => actuator}/actuator_macros.urdf.xacro | 0 .../{common => gazebo}/gazebo_macros.urdf.xacro | 0 .../description/meldog_core.urdf.xacro | 12 ++++++------ .../description/meldog_gazebo.urdf.xacro | 10 +--------- .../{ => meldog_links}/feet/feet.urdf.xacro | 0 .../{ => meldog_links}/hip/hip.urdf.xacro | 0 .../{ => meldog_links}/shank/shank.urdf.xacro | 0 .../{ => meldog_links}/thigh/thigh.urdf.xacro | 0 .../{ => meldog_links}/trunk/trunk.urdf.xacro | 0 .../ros2_control/ros2_control_gazebo.urdf.xacro | 12 ++++++++++++ .../transmission_macros.urdf.xacro | 0 11 files changed, 19 insertions(+), 15 deletions(-) rename src/meldog_description/description/{common => actuator}/actuator_macros.urdf.xacro (100%) rename src/meldog_description/description/{common => gazebo}/gazebo_macros.urdf.xacro (100%) rename src/meldog_description/description/{ => meldog_links}/feet/feet.urdf.xacro (100%) rename src/meldog_description/description/{ => meldog_links}/hip/hip.urdf.xacro (100%) rename src/meldog_description/description/{ => meldog_links}/shank/shank.urdf.xacro (100%) rename src/meldog_description/description/{ => meldog_links}/thigh/thigh.urdf.xacro (100%) rename src/meldog_description/description/{ => meldog_links}/trunk/trunk.urdf.xacro (100%) create mode 100644 src/meldog_description/description/ros2_control/ros2_control_gazebo.urdf.xacro rename src/meldog_description/description/{common => ros2_control}/transmission_macros.urdf.xacro (100%) diff --git a/src/meldog_description/description/common/actuator_macros.urdf.xacro b/src/meldog_description/description/actuator/actuator_macros.urdf.xacro similarity index 100% rename from src/meldog_description/description/common/actuator_macros.urdf.xacro rename to src/meldog_description/description/actuator/actuator_macros.urdf.xacro diff --git a/src/meldog_description/description/common/gazebo_macros.urdf.xacro b/src/meldog_description/description/gazebo/gazebo_macros.urdf.xacro similarity index 100% rename from src/meldog_description/description/common/gazebo_macros.urdf.xacro rename to src/meldog_description/description/gazebo/gazebo_macros.urdf.xacro diff --git a/src/meldog_description/description/meldog_core.urdf.xacro b/src/meldog_description/description/meldog_core.urdf.xacro index 196852f3..c343001d 100644 --- a/src/meldog_description/description/meldog_core.urdf.xacro +++ b/src/meldog_description/description/meldog_core.urdf.xacro @@ -5,24 +5,24 @@ - + - + - + - + @@ -30,7 +30,7 @@ - + @@ -38,7 +38,7 @@ - + diff --git a/src/meldog_description/description/meldog_gazebo.urdf.xacro b/src/meldog_description/description/meldog_gazebo.urdf.xacro index 7912a27d..1b108f24 100644 --- a/src/meldog_description/description/meldog_gazebo.urdf.xacro +++ b/src/meldog_description/description/meldog_gazebo.urdf.xacro @@ -2,7 +2,7 @@ - + @@ -52,12 +52,4 @@ - - - - - gazebo_ros2_control/GazeboSystem - - - \ No newline at end of file diff --git a/src/meldog_description/description/feet/feet.urdf.xacro b/src/meldog_description/description/meldog_links/feet/feet.urdf.xacro similarity index 100% rename from src/meldog_description/description/feet/feet.urdf.xacro rename to src/meldog_description/description/meldog_links/feet/feet.urdf.xacro diff --git a/src/meldog_description/description/hip/hip.urdf.xacro b/src/meldog_description/description/meldog_links/hip/hip.urdf.xacro similarity index 100% rename from src/meldog_description/description/hip/hip.urdf.xacro rename to src/meldog_description/description/meldog_links/hip/hip.urdf.xacro diff --git a/src/meldog_description/description/shank/shank.urdf.xacro b/src/meldog_description/description/meldog_links/shank/shank.urdf.xacro similarity index 100% rename from src/meldog_description/description/shank/shank.urdf.xacro rename to src/meldog_description/description/meldog_links/shank/shank.urdf.xacro diff --git a/src/meldog_description/description/thigh/thigh.urdf.xacro b/src/meldog_description/description/meldog_links/thigh/thigh.urdf.xacro similarity index 100% rename from src/meldog_description/description/thigh/thigh.urdf.xacro rename to src/meldog_description/description/meldog_links/thigh/thigh.urdf.xacro diff --git a/src/meldog_description/description/trunk/trunk.urdf.xacro b/src/meldog_description/description/meldog_links/trunk/trunk.urdf.xacro similarity index 100% rename from src/meldog_description/description/trunk/trunk.urdf.xacro rename to src/meldog_description/description/meldog_links/trunk/trunk.urdf.xacro diff --git a/src/meldog_description/description/ros2_control/ros2_control_gazebo.urdf.xacro b/src/meldog_description/description/ros2_control/ros2_control_gazebo.urdf.xacro new file mode 100644 index 00000000..92e82702 --- /dev/null +++ b/src/meldog_description/description/ros2_control/ros2_control_gazebo.urdf.xacro @@ -0,0 +1,12 @@ + + + + + + + gazebo_ros2_control/GazeboSystem + + + + + \ No newline at end of file diff --git a/src/meldog_description/description/common/transmission_macros.urdf.xacro b/src/meldog_description/description/ros2_control/transmission_macros.urdf.xacro similarity index 100% rename from src/meldog_description/description/common/transmission_macros.urdf.xacro rename to src/meldog_description/description/ros2_control/transmission_macros.urdf.xacro From bc8a7d0b802367e00afa587c7f4fd9a27c600463 Mon Sep 17 00:00:00 2001 From: Bartek Date: Sat, 7 Sep 2024 20:51:07 +0200 Subject: [PATCH 13/23] Succesfully run meldog urdf in gazebo classic --- .../gazebo/gazebo_macros.urdf.xacro | 40 ++++----- .../description/meldog_gazebo.urdf.xacro | 37 +++++---- .../meldog_links/shank/shank.urdf.xacro | 2 +- .../meldog_links/thigh/thigh.urdf.xacro | 2 +- .../launch/gazebo.launch.py | 33 ++++++++ .../launch/meldog_gazebo.launch.py | 83 +++++++++++++++++++ ...ualize.launch.py => meldog_rviz.launch.py} | 0 7 files changed, 158 insertions(+), 39 deletions(-) create mode 100644 src/meldog_description/launch/gazebo.launch.py create mode 100644 src/meldog_description/launch/meldog_gazebo.launch.py rename src/meldog_description/launch/{robot_visualize.launch.py => meldog_rviz.launch.py} (100%) diff --git a/src/meldog_description/description/gazebo/gazebo_macros.urdf.xacro b/src/meldog_description/description/gazebo/gazebo_macros.urdf.xacro index 485b476a..d3e11bf6 100644 --- a/src/meldog_description/description/gazebo/gazebo_macros.urdf.xacro +++ b/src/meldog_description/description/gazebo/gazebo_macros.urdf.xacro @@ -4,37 +4,37 @@ - - - - - + + + + + Gazebo/${color} - - - - - - - ${selfCollide_value} + + + + + + + - - - - - + + + + + - - ${Damper_value} - ${springstiffness_value} + + ${implicitSpringDamper_value} + ${springStiffness_value} ${springReference_value} ${stopErp_value} ${stopCfm_value} diff --git a/src/meldog_description/description/meldog_gazebo.urdf.xacro b/src/meldog_description/description/meldog_gazebo.urdf.xacro index 1b108f24..6c9d5e6a 100644 --- a/src/meldog_description/description/meldog_gazebo.urdf.xacro +++ b/src/meldog_description/description/meldog_gazebo.urdf.xacro @@ -1,36 +1,39 @@ + + + - + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + diff --git a/src/meldog_description/description/meldog_links/shank/shank.urdf.xacro b/src/meldog_description/description/meldog_links/shank/shank.urdf.xacro index 370e5eeb..f0b0d301 100644 --- a/src/meldog_description/description/meldog_links/shank/shank.urdf.xacro +++ b/src/meldog_description/description/meldog_links/shank/shank.urdf.xacro @@ -27,7 +27,7 @@ - + diff --git a/src/meldog_description/description/meldog_links/thigh/thigh.urdf.xacro b/src/meldog_description/description/meldog_links/thigh/thigh.urdf.xacro index 21e0b5e2..5e81f7d6 100644 --- a/src/meldog_description/description/meldog_links/thigh/thigh.urdf.xacro +++ b/src/meldog_description/description/meldog_links/thigh/thigh.urdf.xacro @@ -27,7 +27,7 @@ - + diff --git a/src/meldog_description/launch/gazebo.launch.py b/src/meldog_description/launch/gazebo.launch.py new file mode 100644 index 00000000..b99c9610 --- /dev/null +++ b/src/meldog_description/launch/gazebo.launch.py @@ -0,0 +1,33 @@ +import os +from ament_index_python.packages import get_package_share_directory +from launch import LaunchDescription +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource +from launch import LaunchDescription +from launch.actions import DeclareLaunchArgument, RegisterEventHandler +from launch.conditions import IfCondition +from launch.event_handlers import OnProcessExit +from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution + +from launch_ros.actions import Node +from launch_ros.substitutions import FindPackageShare + +from launch_ros.parameter_descriptions import ParameterValue + +from launch_ros.actions import Node + + +def generate_launch_description(): + + gazebo = IncludeLaunchDescription( + PythonLaunchDescriptionSource([os.path.join( + get_package_share_directory('gazebo_ros'), 'launch'), '/gazebo.launch.py']), + ) + + + + # Nodes + nodes = [ + gazebo, + ] + return LaunchDescription(nodes) \ No newline at end of file diff --git a/src/meldog_description/launch/meldog_gazebo.launch.py b/src/meldog_description/launch/meldog_gazebo.launch.py new file mode 100644 index 00000000..bc589667 --- /dev/null +++ b/src/meldog_description/launch/meldog_gazebo.launch.py @@ -0,0 +1,83 @@ +import os +from ament_index_python.packages import get_package_share_directory +from launch import LaunchDescription +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource +from launch import LaunchDescription +from launch.actions import DeclareLaunchArgument, RegisterEventHandler +from launch.conditions import IfCondition +from launch.event_handlers import OnProcessExit +from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution + +from launch_ros.actions import Node +from launch_ros.substitutions import FindPackageShare + +from launch_ros.parameter_descriptions import ParameterValue + +from launch_ros.actions import Node + + +def generate_launch_description(): + + # Declare arguments + declared_arguments = [] + + declared_arguments.append( + DeclareLaunchArgument( + "package", + default_value="meldog_description", + ) + ) + + declared_arguments.append( + DeclareLaunchArgument( + "urdf_file", + default_value="meldog_gazebo.urdf.xacro", + ) + ) + # Initialize Arguments + package_name = LaunchConfiguration("package") + urdf_file = LaunchConfiguration("urdf_file") + + # Get URDF via xacro + robot_description_content = ParameterValue( + Command( + [ + PathJoinSubstitution([FindExecutable(name="xacro")]), + " ", + PathJoinSubstitution( + [ + FindPackageShare(package_name), + "description", + urdf_file, + ] + ), + ] + ), value_type=str) + robot_description = {"robot_description": robot_description_content} + use_sim_time = {"use_sim_time": True} + + robot_state_pub_node = Node( + package="robot_state_publisher", + executable="robot_state_publisher", + output="both", + parameters=[robot_description, use_sim_time], + ) + + + spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py', + arguments=['-topic', 'robot_description', + '-entity', 'Meldog'], + output='screen') + + + + + + + # Nodes + nodes = [ + robot_state_pub_node, + spawn_entity, + ] + return LaunchDescription(declared_arguments + nodes) \ No newline at end of file diff --git a/src/meldog_description/launch/robot_visualize.launch.py b/src/meldog_description/launch/meldog_rviz.launch.py similarity index 100% rename from src/meldog_description/launch/robot_visualize.launch.py rename to src/meldog_description/launch/meldog_rviz.launch.py From c15ec4c2c5f3e2ea4fff0ed35eb564bf451dc34a Mon Sep 17 00:00:00 2001 From: Bartek Date: Sun, 8 Sep 2024 20:30:40 +0200 Subject: [PATCH 14/23] Meldog succesfully run on gazebo sim --- .../launch/gazebo_sim.launch.py | 39 +++++++++ .../launch/meldog_gazebo_sim.launch.py | 83 +++++++++++++++++++ src/meldog_description/package.xml | 3 + src/meldog_description/worlds/empty.world | 73 ++++++++++++++++ 4 files changed, 198 insertions(+) create mode 100644 src/meldog_description/launch/gazebo_sim.launch.py create mode 100644 src/meldog_description/launch/meldog_gazebo_sim.launch.py create mode 100644 src/meldog_description/worlds/empty.world diff --git a/src/meldog_description/launch/gazebo_sim.launch.py b/src/meldog_description/launch/gazebo_sim.launch.py new file mode 100644 index 00000000..e9435ffe --- /dev/null +++ b/src/meldog_description/launch/gazebo_sim.launch.py @@ -0,0 +1,39 @@ +import os +from ament_index_python.packages import get_package_share_directory +from launch import LaunchDescription +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource +from launch import LaunchDescription +from launch.actions import DeclareLaunchArgument, RegisterEventHandler +from launch.conditions import IfCondition +from launch.event_handlers import OnProcessExit +from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution + +from launch_ros.actions import Node +from launch_ros.substitutions import FindPackageShare + +from launch_ros.parameter_descriptions import ParameterValue + +from launch_ros.actions import Node + + +def generate_launch_description(): + + world = os.path.join( + get_package_share_directory('meldog_description'), + 'worlds', + 'empty.world' + ) + gazebo_sim = IncludeLaunchDescription( + PythonLaunchDescriptionSource([os.path.join( + get_package_share_directory('ros_gz_sim'), 'launch'), '/gz_sim.launch.py']), + launch_arguments={'gz_args': [world], 'on_exit_shutdown': 'true'}.items() + ) + + + + # Nodes + nodes = [ + gazebo_sim, + ] + return LaunchDescription(nodes) \ No newline at end of file diff --git a/src/meldog_description/launch/meldog_gazebo_sim.launch.py b/src/meldog_description/launch/meldog_gazebo_sim.launch.py new file mode 100644 index 00000000..ec60d7c7 --- /dev/null +++ b/src/meldog_description/launch/meldog_gazebo_sim.launch.py @@ -0,0 +1,83 @@ +import os +from ament_index_python.packages import get_package_share_directory +from launch import LaunchDescription +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource +from launch import LaunchDescription +from launch.actions import DeclareLaunchArgument, RegisterEventHandler +from launch.conditions import IfCondition +from launch.event_handlers import OnProcessExit +from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution + +from launch_ros.actions import Node +from launch_ros.substitutions import FindPackageShare + +from launch_ros.parameter_descriptions import ParameterValue + +from launch_ros.actions import Node + + +def generate_launch_description(): + + # Declare arguments + declared_arguments = [] + + declared_arguments.append( + DeclareLaunchArgument( + "package", + default_value="meldog_description", + ) + ) + + declared_arguments.append( + DeclareLaunchArgument( + "urdf_file", + default_value="meldog_gazebo.urdf.xacro", + ) + ) + # Initialize Arguments + package_name = LaunchConfiguration("package") + urdf_file = LaunchConfiguration("urdf_file") + + # Get URDF via xacro + robot_description_content = ParameterValue( + Command( + [ + PathJoinSubstitution([FindExecutable(name="xacro")]), + " ", + PathJoinSubstitution( + [ + FindPackageShare(package_name), + "description", + urdf_file, + ] + ), + ] + ), value_type=str) + robot_description = {"robot_description": robot_description_content} + use_sim_time = {"use_sim_time": True} + + robot_state_pub_node = Node( + package="robot_state_publisher", + executable="robot_state_publisher", + output="both", + parameters=[robot_description, use_sim_time], + ) + + + spawn_entity = Node(package='ros_gz_sim', executable='create', + arguments=['-topic', 'robot_description', + '-name', 'Meldog'], + output='screen') + + + + + + + # Nodes + nodes = [ + robot_state_pub_node, + spawn_entity, + ] + return LaunchDescription(declared_arguments + nodes) \ No newline at end of file diff --git a/src/meldog_description/package.xml b/src/meldog_description/package.xml index 1c26018a..4edd9184 100644 --- a/src/meldog_description/package.xml +++ b/src/meldog_description/package.xml @@ -15,6 +15,9 @@ xacro joint_state_publisher_gui robot_state_publisher + ros_gz_bridge + ros_gz_image + ros_gz_sim ament_lint_auto ament_lint_common diff --git a/src/meldog_description/worlds/empty.world b/src/meldog_description/worlds/empty.world new file mode 100644 index 00000000..9794ad0a --- /dev/null +++ b/src/meldog_description/worlds/empty.world @@ -0,0 +1,73 @@ + + + + + + + + https://fuel.gazebosim.org/1.0/OpenRobotics/models/Ground Plane + + + + + + https://fuel.gazebosim.org/1.0/OpenRobotics/models/Sun + + + + + false + + + + + + 0.319654 -0.235002 9.29441 0 1.5138 0.009599 + orbit + perspective + + + + + 2000.0 + 0.001 + 1 + + + quick + 150 + 0 + 1.400000 + 1 + + + 0.00001 + 0.2 + 2000.000000 + 0.01000 + + + + + + \ No newline at end of file From 19f6a3e769ecd7c92cbdf722cdbe54116bfbbe6d Mon Sep 17 00:00:00 2001 From: Bartek Date: Mon, 9 Sep 2024 22:30:33 +0200 Subject: [PATCH 15/23] Renamed 'meldog_description' to 'meldog_simple_description' --- .../CMakeLists.txt | 2 +- src/{meldog_description => meldog_simple_description}/LICENSE | 0 .../description/actuator/actuator_macros.urdf.xacro | 0 .../description/gazebo/gazebo_macros.urdf.xacro | 0 .../description/meldog_core.urdf.xacro | 2 +- .../description/meldog_gazebo.urdf.xacro | 2 +- .../description/meldog_links/feet/feet.urdf.xacro | 0 .../description/meldog_links/hip/hip.urdf.xacro | 0 .../description/meldog_links/shank/shank.urdf.xacro | 0 .../description/meldog_links/thigh/thigh.urdf.xacro | 0 .../description/meldog_links/trunk/trunk.urdf.xacro | 0 .../description/ros2_control/ros2_control_gazebo.urdf.xacro | 0 .../description/ros2_control/transmission_macros.urdf.xacro | 0 .../launch/gazebo.launch.py | 0 .../launch/gazebo_sim.launch.py | 0 .../launch/meldog_gazebo.launch.py | 0 .../launch/meldog_gazebo_sim.launch.py | 0 .../launch/meldog_rviz.launch.py | 0 .../package.xml | 2 +- .../worlds/empty.world | 0 20 files changed, 4 insertions(+), 4 deletions(-) rename src/{meldog_description => meldog_simple_description}/CMakeLists.txt (96%) rename src/{meldog_description => meldog_simple_description}/LICENSE (100%) rename src/{meldog_description => meldog_simple_description}/description/actuator/actuator_macros.urdf.xacro (100%) rename src/{meldog_description => meldog_simple_description}/description/gazebo/gazebo_macros.urdf.xacro (100%) rename src/{meldog_description => meldog_simple_description}/description/meldog_core.urdf.xacro (99%) rename src/{meldog_description => meldog_simple_description}/description/meldog_gazebo.urdf.xacro (99%) rename src/{meldog_description => meldog_simple_description}/description/meldog_links/feet/feet.urdf.xacro (100%) rename src/{meldog_description => meldog_simple_description}/description/meldog_links/hip/hip.urdf.xacro (100%) rename src/{meldog_description => meldog_simple_description}/description/meldog_links/shank/shank.urdf.xacro (100%) rename src/{meldog_description => meldog_simple_description}/description/meldog_links/thigh/thigh.urdf.xacro (100%) rename src/{meldog_description => meldog_simple_description}/description/meldog_links/trunk/trunk.urdf.xacro (100%) rename src/{meldog_description => meldog_simple_description}/description/ros2_control/ros2_control_gazebo.urdf.xacro (100%) rename src/{meldog_description => meldog_simple_description}/description/ros2_control/transmission_macros.urdf.xacro (100%) rename src/{meldog_description => meldog_simple_description}/launch/gazebo.launch.py (100%) rename src/{meldog_description => meldog_simple_description}/launch/gazebo_sim.launch.py (100%) rename src/{meldog_description => meldog_simple_description}/launch/meldog_gazebo.launch.py (100%) rename src/{meldog_description => meldog_simple_description}/launch/meldog_gazebo_sim.launch.py (100%) rename src/{meldog_description => meldog_simple_description}/launch/meldog_rviz.launch.py (100%) rename src/{meldog_description => meldog_simple_description}/package.xml (95%) rename src/{meldog_description => meldog_simple_description}/worlds/empty.world (100%) diff --git a/src/meldog_description/CMakeLists.txt b/src/meldog_simple_description/CMakeLists.txt similarity index 96% rename from src/meldog_description/CMakeLists.txt rename to src/meldog_simple_description/CMakeLists.txt index 29752e11..4ed9caf2 100644 --- a/src/meldog_description/CMakeLists.txt +++ b/src/meldog_simple_description/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(meldog_description) +project(meldog_simple_description) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wall -Wextra -Wpedantic) diff --git a/src/meldog_description/LICENSE b/src/meldog_simple_description/LICENSE similarity index 100% rename from src/meldog_description/LICENSE rename to src/meldog_simple_description/LICENSE diff --git a/src/meldog_description/description/actuator/actuator_macros.urdf.xacro b/src/meldog_simple_description/description/actuator/actuator_macros.urdf.xacro similarity index 100% rename from src/meldog_description/description/actuator/actuator_macros.urdf.xacro rename to src/meldog_simple_description/description/actuator/actuator_macros.urdf.xacro diff --git a/src/meldog_description/description/gazebo/gazebo_macros.urdf.xacro b/src/meldog_simple_description/description/gazebo/gazebo_macros.urdf.xacro similarity index 100% rename from src/meldog_description/description/gazebo/gazebo_macros.urdf.xacro rename to src/meldog_simple_description/description/gazebo/gazebo_macros.urdf.xacro diff --git a/src/meldog_description/description/meldog_core.urdf.xacro b/src/meldog_simple_description/description/meldog_core.urdf.xacro similarity index 99% rename from src/meldog_description/description/meldog_core.urdf.xacro rename to src/meldog_simple_description/description/meldog_core.urdf.xacro index c343001d..4f1c9703 100644 --- a/src/meldog_description/description/meldog_core.urdf.xacro +++ b/src/meldog_simple_description/description/meldog_core.urdf.xacro @@ -1,5 +1,5 @@ - + diff --git a/src/meldog_description/description/meldog_gazebo.urdf.xacro b/src/meldog_simple_description/description/meldog_gazebo.urdf.xacro similarity index 99% rename from src/meldog_description/description/meldog_gazebo.urdf.xacro rename to src/meldog_simple_description/description/meldog_gazebo.urdf.xacro index 6c9d5e6a..d5c8ea0c 100644 --- a/src/meldog_description/description/meldog_gazebo.urdf.xacro +++ b/src/meldog_simple_description/description/meldog_gazebo.urdf.xacro @@ -1,5 +1,5 @@ - + diff --git a/src/meldog_description/description/meldog_links/feet/feet.urdf.xacro b/src/meldog_simple_description/description/meldog_links/feet/feet.urdf.xacro similarity index 100% rename from src/meldog_description/description/meldog_links/feet/feet.urdf.xacro rename to src/meldog_simple_description/description/meldog_links/feet/feet.urdf.xacro diff --git a/src/meldog_description/description/meldog_links/hip/hip.urdf.xacro b/src/meldog_simple_description/description/meldog_links/hip/hip.urdf.xacro similarity index 100% rename from src/meldog_description/description/meldog_links/hip/hip.urdf.xacro rename to src/meldog_simple_description/description/meldog_links/hip/hip.urdf.xacro diff --git a/src/meldog_description/description/meldog_links/shank/shank.urdf.xacro b/src/meldog_simple_description/description/meldog_links/shank/shank.urdf.xacro similarity index 100% rename from src/meldog_description/description/meldog_links/shank/shank.urdf.xacro rename to src/meldog_simple_description/description/meldog_links/shank/shank.urdf.xacro diff --git a/src/meldog_description/description/meldog_links/thigh/thigh.urdf.xacro b/src/meldog_simple_description/description/meldog_links/thigh/thigh.urdf.xacro similarity index 100% rename from src/meldog_description/description/meldog_links/thigh/thigh.urdf.xacro rename to src/meldog_simple_description/description/meldog_links/thigh/thigh.urdf.xacro diff --git a/src/meldog_description/description/meldog_links/trunk/trunk.urdf.xacro b/src/meldog_simple_description/description/meldog_links/trunk/trunk.urdf.xacro similarity index 100% rename from src/meldog_description/description/meldog_links/trunk/trunk.urdf.xacro rename to src/meldog_simple_description/description/meldog_links/trunk/trunk.urdf.xacro diff --git a/src/meldog_description/description/ros2_control/ros2_control_gazebo.urdf.xacro b/src/meldog_simple_description/description/ros2_control/ros2_control_gazebo.urdf.xacro similarity index 100% rename from src/meldog_description/description/ros2_control/ros2_control_gazebo.urdf.xacro rename to src/meldog_simple_description/description/ros2_control/ros2_control_gazebo.urdf.xacro diff --git a/src/meldog_description/description/ros2_control/transmission_macros.urdf.xacro b/src/meldog_simple_description/description/ros2_control/transmission_macros.urdf.xacro similarity index 100% rename from src/meldog_description/description/ros2_control/transmission_macros.urdf.xacro rename to src/meldog_simple_description/description/ros2_control/transmission_macros.urdf.xacro diff --git a/src/meldog_description/launch/gazebo.launch.py b/src/meldog_simple_description/launch/gazebo.launch.py similarity index 100% rename from src/meldog_description/launch/gazebo.launch.py rename to src/meldog_simple_description/launch/gazebo.launch.py diff --git a/src/meldog_description/launch/gazebo_sim.launch.py b/src/meldog_simple_description/launch/gazebo_sim.launch.py similarity index 100% rename from src/meldog_description/launch/gazebo_sim.launch.py rename to src/meldog_simple_description/launch/gazebo_sim.launch.py diff --git a/src/meldog_description/launch/meldog_gazebo.launch.py b/src/meldog_simple_description/launch/meldog_gazebo.launch.py similarity index 100% rename from src/meldog_description/launch/meldog_gazebo.launch.py rename to src/meldog_simple_description/launch/meldog_gazebo.launch.py diff --git a/src/meldog_description/launch/meldog_gazebo_sim.launch.py b/src/meldog_simple_description/launch/meldog_gazebo_sim.launch.py similarity index 100% rename from src/meldog_description/launch/meldog_gazebo_sim.launch.py rename to src/meldog_simple_description/launch/meldog_gazebo_sim.launch.py diff --git a/src/meldog_description/launch/meldog_rviz.launch.py b/src/meldog_simple_description/launch/meldog_rviz.launch.py similarity index 100% rename from src/meldog_description/launch/meldog_rviz.launch.py rename to src/meldog_simple_description/launch/meldog_rviz.launch.py diff --git a/src/meldog_description/package.xml b/src/meldog_simple_description/package.xml similarity index 95% rename from src/meldog_description/package.xml rename to src/meldog_simple_description/package.xml index 4edd9184..18acb8bb 100644 --- a/src/meldog_description/package.xml +++ b/src/meldog_simple_description/package.xml @@ -1,7 +1,7 @@ - meldog_description + meldog_simple_description 0.0.0 TODO: Package description bartek diff --git a/src/meldog_description/worlds/empty.world b/src/meldog_simple_description/worlds/empty.world similarity index 100% rename from src/meldog_description/worlds/empty.world rename to src/meldog_simple_description/worlds/empty.world From bacf74c77bbf67e9a2800f3974e0a1b4319da6c9 Mon Sep 17 00:00:00 2001 From: Bartek Date: Tue, 10 Sep 2024 19:49:22 +0200 Subject: [PATCH 16/23] Added ros2_control macro for joints --- .../ros2_control_joint_macros.urdf.xacro | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/meldog_simple_description/description/ros2_control/ros2_control_joint_macros.urdf.xacro diff --git a/src/meldog_simple_description/description/ros2_control/ros2_control_joint_macros.urdf.xacro b/src/meldog_simple_description/description/ros2_control/ros2_control_joint_macros.urdf.xacro new file mode 100644 index 00000000..8263dbdc --- /dev/null +++ b/src/meldog_simple_description/description/ros2_control/ros2_control_joint_macros.urdf.xacro @@ -0,0 +1,27 @@ + + + + + + + + + ${lower} + ${upper} + + + -${actuator_max_velocity} + ${actuator_max_velocity} + + + + -${actuator_max_torque} + ${actuator_max_torque} + + + + + + + + \ No newline at end of file From 41336a1c045377bef3d3a9decaa32dcf3d05629f Mon Sep 17 00:00:00 2001 From: Bartek Date: Wed, 11 Sep 2024 20:18:42 +0200 Subject: [PATCH 17/23] Added joint trajectory controller for tests and joint hardware interface for gazebo sim --- .../ros2_control_gazebo.urdf.xacro | 33 +++- .../joint_trajectory_controller_test.yaml | 143 ++++++++++++++++++ 2 files changed, 174 insertions(+), 2 deletions(-) create mode 100644 src/meldog_simple_description/test_controllers/joint_trajectory_controller_test.yaml diff --git a/src/meldog_simple_description/description/ros2_control/ros2_control_gazebo.urdf.xacro b/src/meldog_simple_description/description/ros2_control/ros2_control_gazebo.urdf.xacro index 92e82702..509198fb 100644 --- a/src/meldog_simple_description/description/ros2_control/ros2_control_gazebo.urdf.xacro +++ b/src/meldog_simple_description/description/ros2_control/ros2_control_gazebo.urdf.xacro @@ -4,9 +4,38 @@ - gazebo_ros2_control/GazeboSystem + ign_ros2_control/IgnitionSystem + - + + + + + + + + + + + + + + + + + + + + + + + + + + + $(find meldog_simple_description)/test_controllers/joint_trajectory_controller_test.yaml + + \ No newline at end of file diff --git a/src/meldog_simple_description/test_controllers/joint_trajectory_controller_test.yaml b/src/meldog_simple_description/test_controllers/joint_trajectory_controller_test.yaml new file mode 100644 index 00000000..ec3c6145 --- /dev/null +++ b/src/meldog_simple_description/test_controllers/joint_trajectory_controller_test.yaml @@ -0,0 +1,143 @@ +controller_manager: + ros__parameters: + update_rate: 200.0 # Hz + use_sim_time: true + + joint_trajectory_controller: + type: joint_trajectory_controller/JointTrajectoryController + + joint_state_broadcaster: + type: joint_state_broadcaster/JointStateBroadcaster + +# imu_sensor_broadcaster: +# type: imu_sensor_broadcaster/IMUSensorBroadcaster # TODO: DODAJ IMU + +# imu_sensor_broadcaster: +# ros__parameters: +# sensor_name: MPU6050sensor +# frame_id: imu + +joint_trajectory_controller: + ros__parameters: + joints: + - FLH_joint + - FRH_joint + - BLH_joint + - BRH_joint + - FLT_joint + - FRT_joint + - BLT_joint + - BRT_joint + - FLS_joint + - FRS_joint + - BLS_joint + - BRS_joint + + command_joints: + - FLH_joint + - FRH_joint + - BLH_joint + - BRH_joint + - FLT_joint + - FRT_joint + - BLT_joint + - BRT_joint + - FLS_joint + - FRS_joint + - BLS_joint + - BRS_joint + + command_interfaces: + - effort + state_interfaces: + - position + - velocity + action_monitor_rate: 200.0 + state_publish_rate: 200.0 # Hz + allow_nonzero_velocity_at_trajectory_end: false + + gains: + FLH_joint: + angle_wraparound: false + d: 0.1 + ff_velocity_scale: 0.0 + i: 0.0 + i_clamp: 0.0 + p: 5.0 + FRH_joint: + angle_wraparound: false + d: 0.1 + ff_velocity_scale: 0.0 + i: 0.0 + i_clamp: 0.0 + p: 5.0 + BLH_joint: + angle_wraparound: false + d: 0.1 + ff_velocity_scale: 0.0 + i: 0.0 + i_clamp: 0.0 + p: 5.0 + BRH_joint: + angle_wraparound: false + d: 0.1 + ff_velocity_scale: 0.0 + i: 0.0 + i_clamp: 0.0 + p: 5.0 + FLT_joint: + angle_wraparound: false + d: 0.1 + ff_velocity_scale: 0.0 + i: 0.0 + i_clamp: 0.0 + p: 5.0 + FRT_joint: + angle_wraparound: false + d: 0.1 + ff_velocity_scale: 0.0 + i: 0.0 + i_clamp: 0.0 + p: 5.0 + BLT_joint: + angle_wraparound: false + d: 0.1 + ff_velocity_scale: 0.0 + i: 0.0 + i_clamp: 0.0 + p: 5.0 + BRT_joint: + angle_wraparound: false + d: 0.1 + ff_velocity_scale: 0.0 + i: 0.0 + i_clamp: 0.0 + p: 5.0 + FLS_joint: + angle_wraparound: false + d: 0.1 + ff_velocity_scale: 0.0 + i: 0.0 + i_clamp: 0.0 + p: 5.0 + FRS_joint: + angle_wraparound: false + d: 0.1 + ff_velocity_scale: 0.0 + i: 0.0 + i_clamp: 0.0 + p: 5.0 + BLS_joint: + angle_wraparound: false + d: 0.1 + ff_velocity_scale: 0.0 + i: 0.0 + i_clamp: 0.0 + p: 5.0 + BRS_joint: + angle_wraparound: false + d: 0.1 + ff_velocity_scale: 0.0 + i: 0.0 + i_clamp: 0.0 + p: 5.0 \ No newline at end of file From f9e3e92beda90746742672dc475ea1595bbbd481 Mon Sep 17 00:00:00 2001 From: Bartek Date: Sat, 14 Sep 2024 17:25:38 +0200 Subject: [PATCH 18/23] Succesfully runned simulation with ros2 control plugin and controllers --- .../description/meldog_gazebo.urdf.xacro | 2 + .../ros2_control_gazebo.urdf.xacro | 28 ++-- .../ros2_control_joint_macros.urdf.xacro | 13 +- .../transmission_macros.urdf.xacro | 14 +- .../meldog_gazebo_sim_ros2_control.launch.py | 157 ++++++++++++++++++ .../joint_trajectory_controller_test.yaml | 78 +++------ 6 files changed, 213 insertions(+), 79 deletions(-) create mode 100644 src/meldog_simple_description/launch/meldog_gazebo_sim_ros2_control.launch.py diff --git a/src/meldog_simple_description/description/meldog_gazebo.urdf.xacro b/src/meldog_simple_description/description/meldog_gazebo.urdf.xacro index d5c8ea0c..af40456f 100644 --- a/src/meldog_simple_description/description/meldog_gazebo.urdf.xacro +++ b/src/meldog_simple_description/description/meldog_gazebo.urdf.xacro @@ -55,4 +55,6 @@ + + \ No newline at end of file diff --git a/src/meldog_simple_description/description/ros2_control/ros2_control_gazebo.urdf.xacro b/src/meldog_simple_description/description/ros2_control/ros2_control_gazebo.urdf.xacro index 509198fb..b142bbfa 100644 --- a/src/meldog_simple_description/description/ros2_control/ros2_control_gazebo.urdf.xacro +++ b/src/meldog_simple_description/description/ros2_control/ros2_control_gazebo.urdf.xacro @@ -7,29 +7,29 @@ ign_ros2_control/IgnitionSystem - + - + - - - - + + + + - - - - + + + + - - - - + + + + diff --git a/src/meldog_simple_description/description/ros2_control/ros2_control_joint_macros.urdf.xacro b/src/meldog_simple_description/description/ros2_control/ros2_control_joint_macros.urdf.xacro index 8263dbdc..734c0903 100644 --- a/src/meldog_simple_description/description/ros2_control/ros2_control_joint_macros.urdf.xacro +++ b/src/meldog_simple_description/description/ros2_control/ros2_control_joint_macros.urdf.xacro @@ -1,9 +1,9 @@ - + - + ${lower} @@ -13,11 +13,10 @@ -${actuator_max_velocity} ${actuator_max_velocity} - - - -${actuator_max_torque} - ${actuator_max_torque} - + + -${actuator_max_torque} + ${actuator_max_torque} + diff --git a/src/meldog_simple_description/description/ros2_control/transmission_macros.urdf.xacro b/src/meldog_simple_description/description/ros2_control/transmission_macros.urdf.xacro index 6e9a2104..8ffc223f 100644 --- a/src/meldog_simple_description/description/ros2_control/transmission_macros.urdf.xacro +++ b/src/meldog_simple_description/description/ros2_control/transmission_macros.urdf.xacro @@ -2,7 +2,7 @@ - + transmission_interface/SimpleTransmission @@ -14,8 +14,8 @@ - - + + transmission_interface/FourBarLinkageTransmission ${reduction} @@ -43,9 +43,9 @@ - - - - + + + + \ No newline at end of file diff --git a/src/meldog_simple_description/launch/meldog_gazebo_sim_ros2_control.launch.py b/src/meldog_simple_description/launch/meldog_gazebo_sim_ros2_control.launch.py new file mode 100644 index 00000000..070949ce --- /dev/null +++ b/src/meldog_simple_description/launch/meldog_gazebo_sim_ros2_control.launch.py @@ -0,0 +1,157 @@ +# Copyright 2020 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +from ament_index_python.packages import get_package_share_directory +from launch import LaunchDescription +from launch.actions import IncludeLaunchDescription, ExecuteProcess +from launch.launch_description_sources import PythonLaunchDescriptionSource +from launch import LaunchDescription +from launch.actions import DeclareLaunchArgument, RegisterEventHandler +from launch.conditions import IfCondition +from launch.event_handlers import OnProcessExit, OnProcessStart +from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution + +from launch_ros.actions import Node +from launch_ros.substitutions import FindPackageShare + +from launch_ros.parameter_descriptions import ParameterValue + +from launch_ros.actions import Node + + +def generate_launch_description(): + + # Declare arguments + declared_arguments = [] + + declared_arguments.append( + DeclareLaunchArgument( + "package", + default_value="meldog_simple_description", + ) + ) + + declared_arguments.append( + DeclareLaunchArgument( + "urdf_file", + default_value="meldog_gazebo.urdf.xacro", + ) + ) + + declared_arguments.append( + DeclareLaunchArgument( + "controller_type_file", + default_value="joint_trajectory_controller_test.yaml", + ) + ) + + declared_arguments.append( + DeclareLaunchArgument( + "controller_type", + default_value="joint_trajectory_controller", + ) + ) + + # Initialize Arguments + package_name = LaunchConfiguration("package") + urdf_file = LaunchConfiguration("urdf_file") + controller_file = LaunchConfiguration("controller_type_file") + controller_type = LaunchConfiguration("controller_type") + + + # Get URDF via xacro + robot_description_content = ParameterValue( + Command( + [ + PathJoinSubstitution([FindExecutable(name="xacro")]), + " ", + PathJoinSubstitution( + [ + FindPackageShare(package_name), + "description", + urdf_file, + ] + ), + ] + ), value_type=str) + + # Set up dictionary parameters: + robot_description = {"robot_description": robot_description_content} + use_sim_time = {"use_sim_time": True} + + # Load world for gazebo sim + world = PathJoinSubstitution( + [ + FindPackageShare(package_name), + "worlds", + 'empty.world' + ] + ) + + # robot_state_publisher node: + robot_state_pub_node = Node( + package="robot_state_publisher", + executable="robot_state_publisher", + output="both", + parameters=[robot_description, use_sim_time], + ) + + # Spawn Meldog: + spawn_entity = Node(package='ros_gz_sim', executable='create', + arguments=['-topic', 'robot_description', + '-name', 'Meldog'], + output='screen') + + # Load joint_state_broadcaster + load_joint_state_broadcaster = ExecuteProcess( + cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', + 'joint_state_broadcaster'], + output='screen' + ) + + # Load joint_trajectory_controller + load_joint_effort_controller = ExecuteProcess( + cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', controller_type], + output='screen' + ) + + # Bridge between ros2 and Ignition Gazebo + ros2_gazebo_sim_bridge = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + [os.path.join(get_package_share_directory('ros_ign_gazebo'), + 'launch', 'ign_gazebo.launch.py')]), + launch_arguments=[('gz_args', [' -r -v 4 empty.sdf'])]) + + nodes = [ + ros2_gazebo_sim_bridge, + + RegisterEventHandler( + event_handler=OnProcessExit( + target_action=spawn_entity, + on_exit=[load_joint_state_broadcaster], + ) + ), + + RegisterEventHandler( + event_handler=OnProcessExit( + target_action= load_joint_state_broadcaster, + on_exit=[load_joint_effort_controller], + ) + ), + + robot_state_pub_node, + spawn_entity, + ] + return LaunchDescription(declared_arguments + nodes) \ No newline at end of file diff --git a/src/meldog_simple_description/test_controllers/joint_trajectory_controller_test.yaml b/src/meldog_simple_description/test_controllers/joint_trajectory_controller_test.yaml index ec3c6145..48b75918 100644 --- a/src/meldog_simple_description/test_controllers/joint_trajectory_controller_test.yaml +++ b/src/meldog_simple_description/test_controllers/joint_trajectory_controller_test.yaml @@ -1,6 +1,6 @@ controller_manager: ros__parameters: - update_rate: 200.0 # Hz + update_rate: 1000 # Hz use_sim_time: true joint_trajectory_controller: @@ -52,92 +52,68 @@ joint_trajectory_controller: state_interfaces: - position - velocity - action_monitor_rate: 200.0 - state_publish_rate: 200.0 # Hz + action_monitor_rate: 1000.0 + state_publish_rate: 1000.0 # Hz allow_nonzero_velocity_at_trajectory_end: false gains: FLH_joint: - angle_wraparound: false - d: 0.1 - ff_velocity_scale: 0.0 + d: 2.5 i: 0.0 i_clamp: 0.0 - p: 5.0 + p: 350.0 FRH_joint: - angle_wraparound: false - d: 0.1 - ff_velocity_scale: 0.0 + d: 2.5 i: 0.0 i_clamp: 0.0 - p: 5.0 + p: 350.0 BLH_joint: - angle_wraparound: false - d: 0.1 - ff_velocity_scale: 0.0 + d: 2.5 i: 0.0 i_clamp: 0.0 - p: 5.0 + p: 350.0 BRH_joint: - angle_wraparound: false - d: 0.1 - ff_velocity_scale: 0.0 + d: 2.5 i: 0.0 i_clamp: 0.0 - p: 5.0 + p: 350.0 FLT_joint: - angle_wraparound: false - d: 0.1 - ff_velocity_scale: 0.0 + d: 2.5 i: 0.0 i_clamp: 0.0 - p: 5.0 + p: 350.0 FRT_joint: - angle_wraparound: false - d: 0.1 - ff_velocity_scale: 0.0 + d: 2.5 i: 0.0 i_clamp: 0.0 - p: 5.0 + p: 350.0 BLT_joint: - angle_wraparound: false - d: 0.1 - ff_velocity_scale: 0.0 + d: 2.5 i: 0.0 i_clamp: 0.0 - p: 5.0 + p: 350.0 BRT_joint: - angle_wraparound: false - d: 0.1 - ff_velocity_scale: 0.0 + d: 2.5 i: 0.0 i_clamp: 0.0 - p: 5.0 + p: 350.0 FLS_joint: - angle_wraparound: false - d: 0.1 - ff_velocity_scale: 0.0 + d: 2.5 i: 0.0 i_clamp: 0.0 - p: 5.0 + p: 350.0 FRS_joint: - angle_wraparound: false - d: 0.1 - ff_velocity_scale: 0.0 + d: 2.5 i: 0.0 i_clamp: 0.0 - p: 5.0 + p: 350.0 BLS_joint: - angle_wraparound: false - d: 0.1 - ff_velocity_scale: 0.0 + d: 2.5 i: 0.0 i_clamp: 0.0 - p: 5.0 + p: 350.0 BRS_joint: - angle_wraparound: false - d: 0.1 - ff_velocity_scale: 0.0 + d: 2.5 i: 0.0 i_clamp: 0.0 - p: 5.0 \ No newline at end of file + p: 350.0 \ No newline at end of file From bb27e4c0fa98a33b21fd9be3effa03cc6e72e84f Mon Sep 17 00:00:00 2001 From: Bartek Date: Sun, 15 Sep 2024 20:36:46 +0200 Subject: [PATCH 19/23] Successfully launched meldog in custom world in gazebo sim with ros2 control --- .../gazebo/gazebo_macros.urdf.xacro | 4 +- .../description/meldog_core.urdf.xacro | 8 ++-- .../ros2_control_gazebo.urdf.xacro | 8 ++-- .../meldog_gazebo_sim_ros2_control.launch.py | 17 ++++--- .../joint_trajectory_controller_test.yaml | 48 +++++++++---------- .../worlds/empty.world | 6 +-- 6 files changed, 48 insertions(+), 43 deletions(-) diff --git a/src/meldog_simple_description/description/gazebo/gazebo_macros.urdf.xacro b/src/meldog_simple_description/description/gazebo/gazebo_macros.urdf.xacro index d3e11bf6..02a7170c 100644 --- a/src/meldog_simple_description/description/gazebo/gazebo_macros.urdf.xacro +++ b/src/meldog_simple_description/description/gazebo/gazebo_macros.urdf.xacro @@ -5,8 +5,8 @@ - - + + diff --git a/src/meldog_simple_description/description/meldog_core.urdf.xacro b/src/meldog_simple_description/description/meldog_core.urdf.xacro index 4f1c9703..5bee4280 100644 --- a/src/meldog_simple_description/description/meldog_core.urdf.xacro +++ b/src/meldog_simple_description/description/meldog_core.urdf.xacro @@ -134,7 +134,7 @@ - + @@ -143,7 +143,7 @@ - + @@ -152,7 +152,7 @@ - + @@ -161,7 +161,7 @@ - + diff --git a/src/meldog_simple_description/description/ros2_control/ros2_control_gazebo.urdf.xacro b/src/meldog_simple_description/description/ros2_control/ros2_control_gazebo.urdf.xacro index b142bbfa..1cfc9926 100644 --- a/src/meldog_simple_description/description/ros2_control/ros2_control_gazebo.urdf.xacro +++ b/src/meldog_simple_description/description/ros2_control/ros2_control_gazebo.urdf.xacro @@ -26,10 +26,10 @@ - - - - + + + + diff --git a/src/meldog_simple_description/launch/meldog_gazebo_sim_ros2_control.launch.py b/src/meldog_simple_description/launch/meldog_gazebo_sim_ros2_control.launch.py index 070949ce..1fde7048 100644 --- a/src/meldog_simple_description/launch/meldog_gazebo_sim_ros2_control.launch.py +++ b/src/meldog_simple_description/launch/meldog_gazebo_sim_ros2_control.launch.py @@ -128,14 +128,19 @@ def generate_launch_description(): ) # Bridge between ros2 and Ignition Gazebo - ros2_gazebo_sim_bridge = IncludeLaunchDescription( - PythonLaunchDescriptionSource( - [os.path.join(get_package_share_directory('ros_ign_gazebo'), - 'launch', 'ign_gazebo.launch.py')]), - launch_arguments=[('gz_args', [' -r -v 4 empty.sdf'])]) + # ros2_gazebo_sim_bridge = IncludeLaunchDescription( + # PythonLaunchDescriptionSource( + # [os.path.join(get_package_share_directory('ros_ign_gazebo'), + # 'launch', 'ign_gazebo.launch.py')]), + # launch_arguments=[('gz_args', [' -r -v 4 empty.sdf'])]) + gazebo_sim_bridge = IncludeLaunchDescription( + PythonLaunchDescriptionSource([os.path.join( + get_package_share_directory('ros_gz_sim'), 'launch'), '/gz_sim.launch.py']), + launch_arguments={'gz_args': ['-r -v -v4 ', world], 'on_exit_shutdown': 'true'}.items() + ) nodes = [ - ros2_gazebo_sim_bridge, + gazebo_sim_bridge, RegisterEventHandler( event_handler=OnProcessExit( diff --git a/src/meldog_simple_description/test_controllers/joint_trajectory_controller_test.yaml b/src/meldog_simple_description/test_controllers/joint_trajectory_controller_test.yaml index 48b75918..c8e730c1 100644 --- a/src/meldog_simple_description/test_controllers/joint_trajectory_controller_test.yaml +++ b/src/meldog_simple_description/test_controllers/joint_trajectory_controller_test.yaml @@ -58,62 +58,62 @@ joint_trajectory_controller: gains: FLH_joint: - d: 2.5 + d: 100.0 i: 0.0 i_clamp: 0.0 - p: 350.0 + p: 1500.0 FRH_joint: - d: 2.5 + d: 100.0 i: 0.0 i_clamp: 0.0 - p: 350.0 + p: 1500.0 BLH_joint: - d: 2.5 + d: 100.0 i: 0.0 i_clamp: 0.0 - p: 350.0 + p: 1500.0 BRH_joint: - d: 2.5 + d: 100.0 i: 0.0 i_clamp: 0.0 - p: 350.0 + p: 1500.0 FLT_joint: - d: 2.5 + d: 100.0 i: 0.0 i_clamp: 0.0 - p: 350.0 + p: 1500.0 FRT_joint: - d: 2.5 + d: 100.0 i: 0.0 i_clamp: 0.0 - p: 350.0 + p: 1500.0 BLT_joint: - d: 2.5 + d: 100.0 i: 0.0 i_clamp: 0.0 - p: 350.0 + p: 1500.0 BRT_joint: - d: 2.5 + d: 100.0 i: 0.0 i_clamp: 0.0 - p: 350.0 + p: 1500.0 FLS_joint: - d: 2.5 + d: 100.0 i: 0.0 i_clamp: 0.0 - p: 350.0 + p: 1500.0 FRS_joint: - d: 2.5 + d: 100.0 i: 0.0 i_clamp: 0.0 - p: 350.0 + p: 1500.0 BLS_joint: - d: 2.5 + d: 100.0 i: 0.0 i_clamp: 0.0 - p: 350.0 + p: 1500.0 BRS_joint: - d: 2.5 + d: 100.0 i: 0.0 i_clamp: 0.0 - p: 350.0 \ No newline at end of file + p: 1500.0 \ No newline at end of file diff --git a/src/meldog_simple_description/worlds/empty.world b/src/meldog_simple_description/worlds/empty.world index 9794ad0a..4abcd714 100644 --- a/src/meldog_simple_description/worlds/empty.world +++ b/src/meldog_simple_description/worlds/empty.world @@ -49,13 +49,13 @@ - 2000.0 - 0.001 + 2500.0 + 0.0005 1 quick - 150 + 200 0 1.400000 1 From ddd5b83ada700944b55ebe5c95036d5623c06958 Mon Sep 17 00:00:00 2001 From: Bartek Date: Sun, 15 Sep 2024 20:38:04 +0200 Subject: [PATCH 20/23] Added example commands for joint_trajectory_controller --- .../joint_trajectory_example.txt | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/meldog_simple_description/simple_commands/joint_trajectory_example.txt diff --git a/src/meldog_simple_description/simple_commands/joint_trajectory_example.txt b/src/meldog_simple_description/simple_commands/joint_trajectory_example.txt new file mode 100644 index 00000000..f66b9e64 --- /dev/null +++ b/src/meldog_simple_description/simple_commands/joint_trajectory_example.txt @@ -0,0 +1,24 @@ + POZYCJA STARTOWA: + + ros2 action send_goal /joint_trajectory_controller/follow_joint_trajectory control_msgs/action/FollowJointTrajectory -f "{ + trajectory: { + joint_names: ['FLH_joint', 'FRH_joint', 'BLH_joint', 'BRH_joint', 'FLT_joint', 'FRT_joint', 'BLT_joint', 'BRT_joint', 'FLS_joint', 'FRS_joint', 'BLS_joint', 'BRS_joint'], + points: [ + { positions: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], time_from_start: { sec: 1 } }, + { positions: [0.0, 0.0, 0.0, 0.0, -0.78539, -0.78539, -0.78539, -0.78539, 1.5707, 1.5707, 1.5707, 1.5707], time_from_start: { sec: 6 } } ] + } + }" + + + +PRZYSIAD: + + ros2 action send_goal /joint_trajectory_controller/follow_joint_trajectory control_msgs/action/FollowJointTrajectory -f "{ + trajectory: { + joint_names: ['FLH_joint', 'FRH_joint', 'BLH_joint', 'BRH_joint', 'FLT_joint', 'FRT_joint', 'BLT_joint', 'BRT_joint', 'FLS_joint', 'FRS_joint', 'BLS_joint', 'BRS_joint'], + points: [ + { positions: [0.0, 0.0, 0.0, 0.0, -0.78539, -0.78539, -0.78539, -0.78539, 1.5707, 1.5707, 1.5707, 1.5707], time_from_start: { sec: 3 } }, + { positions: [0.0, 0.0, 0.0, 0.0, -1.04719, -1.04719, -1.04719, -1.04719, 2.094, 2.094, 2.094, 2.094], time_from_start: { sec: 6 } }, + { positions: [0.0, 0.0, 0.0, 0.0, -0.78539, -0.78539, -0.78539, -0.78539, 1.5707, 1.5707, 1.5707, 1.5707], time_from_start: { sec: 9 } } ] + } + }" From bee690e2ab480cad8fbfe0053a9416e2e53157d8 Mon Sep 17 00:00:00 2001 From: Bartek Date: Mon, 16 Sep 2024 20:19:47 +0200 Subject: [PATCH 21/23] Cleaned up code, added new macros and properties --- .../actuator/actuator_macros.urdf.xacro | 16 ------- .../joints/joint_macros.urdf.xacro | 9 ++++ .../joints/joint_properties.urdf.xacro | 20 +++++++++ .../feet/feet.urdf.xacro | 0 .../hip/hip.urdf.xacro | 0 .../shank/shank.urdf.xacro | 0 .../thigh/thigh.urdf.xacro | 0 .../trunk/trunk.urdf.xacro | 0 .../description/meldog_core.urdf.xacro | 45 ++++++++++--------- .../joint_hardware_macros.urdf.xacro} | 14 +++--- .../joint_hardware_properties.urdf.xacro | 14 ++++++ .../ros2_control/ros2_control_core.urdf.xacro | 31 +++++++++++++ .../ros2_control_gazebo.urdf.xacro | 27 ++--------- .../transmission_macros.urdf.xacro | 20 ++++----- .../joint_trajectory_example.txt | 11 +++++ 15 files changed, 127 insertions(+), 80 deletions(-) delete mode 100644 src/meldog_simple_description/description/actuator/actuator_macros.urdf.xacro create mode 100644 src/meldog_simple_description/description/joints/joint_macros.urdf.xacro create mode 100644 src/meldog_simple_description/description/joints/joint_properties.urdf.xacro rename src/meldog_simple_description/description/{meldog_links => links}/feet/feet.urdf.xacro (100%) rename src/meldog_simple_description/description/{meldog_links => links}/hip/hip.urdf.xacro (100%) rename src/meldog_simple_description/description/{meldog_links => links}/shank/shank.urdf.xacro (100%) rename src/meldog_simple_description/description/{meldog_links => links}/thigh/thigh.urdf.xacro (100%) rename src/meldog_simple_description/description/{meldog_links => links}/trunk/trunk.urdf.xacro (100%) rename src/meldog_simple_description/description/ros2_control/{ros2_control_joint_macros.urdf.xacro => joints_hardware/joint_hardware_macros.urdf.xacro} (54%) create mode 100644 src/meldog_simple_description/description/ros2_control/joints_hardware/joint_hardware_properties.urdf.xacro create mode 100644 src/meldog_simple_description/description/ros2_control/ros2_control_core.urdf.xacro rename src/meldog_simple_description/description/ros2_control/{ => transmission}/transmission_macros.urdf.xacro (71%) diff --git a/src/meldog_simple_description/description/actuator/actuator_macros.urdf.xacro b/src/meldog_simple_description/description/actuator/actuator_macros.urdf.xacro deleted file mode 100644 index 0000542b..00000000 --- a/src/meldog_simple_description/description/actuator/actuator_macros.urdf.xacro +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/meldog_simple_description/description/joints/joint_macros.urdf.xacro b/src/meldog_simple_description/description/joints/joint_macros.urdf.xacro new file mode 100644 index 00000000..caed7cfd --- /dev/null +++ b/src/meldog_simple_description/description/joints/joint_macros.urdf.xacro @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/meldog_simple_description/description/joints/joint_properties.urdf.xacro b/src/meldog_simple_description/description/joints/joint_properties.urdf.xacro new file mode 100644 index 00000000..8320b567 --- /dev/null +++ b/src/meldog_simple_description/description/joints/joint_properties.urdf.xacro @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/meldog_simple_description/description/meldog_links/feet/feet.urdf.xacro b/src/meldog_simple_description/description/links/feet/feet.urdf.xacro similarity index 100% rename from src/meldog_simple_description/description/meldog_links/feet/feet.urdf.xacro rename to src/meldog_simple_description/description/links/feet/feet.urdf.xacro diff --git a/src/meldog_simple_description/description/meldog_links/hip/hip.urdf.xacro b/src/meldog_simple_description/description/links/hip/hip.urdf.xacro similarity index 100% rename from src/meldog_simple_description/description/meldog_links/hip/hip.urdf.xacro rename to src/meldog_simple_description/description/links/hip/hip.urdf.xacro diff --git a/src/meldog_simple_description/description/meldog_links/shank/shank.urdf.xacro b/src/meldog_simple_description/description/links/shank/shank.urdf.xacro similarity index 100% rename from src/meldog_simple_description/description/meldog_links/shank/shank.urdf.xacro rename to src/meldog_simple_description/description/links/shank/shank.urdf.xacro diff --git a/src/meldog_simple_description/description/meldog_links/thigh/thigh.urdf.xacro b/src/meldog_simple_description/description/links/thigh/thigh.urdf.xacro similarity index 100% rename from src/meldog_simple_description/description/meldog_links/thigh/thigh.urdf.xacro rename to src/meldog_simple_description/description/links/thigh/thigh.urdf.xacro diff --git a/src/meldog_simple_description/description/meldog_links/trunk/trunk.urdf.xacro b/src/meldog_simple_description/description/links/trunk/trunk.urdf.xacro similarity index 100% rename from src/meldog_simple_description/description/meldog_links/trunk/trunk.urdf.xacro rename to src/meldog_simple_description/description/links/trunk/trunk.urdf.xacro diff --git a/src/meldog_simple_description/description/meldog_core.urdf.xacro b/src/meldog_simple_description/description/meldog_core.urdf.xacro index 5bee4280..b33e2089 100644 --- a/src/meldog_simple_description/description/meldog_core.urdf.xacro +++ b/src/meldog_simple_description/description/meldog_core.urdf.xacro @@ -4,25 +4,26 @@ - - + + + - + - + - + @@ -30,7 +31,7 @@ - + @@ -38,19 +39,19 @@ - + - + + - - + @@ -60,7 +61,7 @@ - + @@ -69,7 +70,7 @@ - + @@ -78,7 +79,7 @@ - + @@ -87,7 +88,7 @@ - + @@ -97,7 +98,7 @@ - + @@ -106,7 +107,7 @@ - + @@ -115,7 +116,7 @@ - + @@ -124,7 +125,7 @@ - + @@ -134,7 +135,7 @@ - + @@ -143,7 +144,7 @@ - + @@ -152,7 +153,7 @@ - + @@ -161,7 +162,7 @@ - + diff --git a/src/meldog_simple_description/description/ros2_control/ros2_control_joint_macros.urdf.xacro b/src/meldog_simple_description/description/ros2_control/joints_hardware/joint_hardware_macros.urdf.xacro similarity index 54% rename from src/meldog_simple_description/description/ros2_control/ros2_control_joint_macros.urdf.xacro rename to src/meldog_simple_description/description/ros2_control/joints_hardware/joint_hardware_macros.urdf.xacro index 734c0903..3c2d1d91 100644 --- a/src/meldog_simple_description/description/ros2_control/ros2_control_joint_macros.urdf.xacro +++ b/src/meldog_simple_description/description/ros2_control/joints_hardware/joint_hardware_macros.urdf.xacro @@ -1,21 +1,19 @@ - + - - - + ${lower} ${upper} - -${actuator_max_velocity} - ${actuator_max_velocity} + -${motor_max_velocity} + ${motor_max_velocity} - -${actuator_max_torque} - ${actuator_max_torque} + -${motor_max_torque} + ${motor_max_torque} diff --git a/src/meldog_simple_description/description/ros2_control/joints_hardware/joint_hardware_properties.urdf.xacro b/src/meldog_simple_description/description/ros2_control/joints_hardware/joint_hardware_properties.urdf.xacro new file mode 100644 index 00000000..05affec9 --- /dev/null +++ b/src/meldog_simple_description/description/ros2_control/joints_hardware/joint_hardware_properties.urdf.xacro @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/meldog_simple_description/description/ros2_control/ros2_control_core.urdf.xacro b/src/meldog_simple_description/description/ros2_control/ros2_control_core.urdf.xacro new file mode 100644 index 00000000..b5126c82 --- /dev/null +++ b/src/meldog_simple_description/description/ros2_control/ros2_control_core.urdf.xacro @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/meldog_simple_description/description/ros2_control/ros2_control_gazebo.urdf.xacro b/src/meldog_simple_description/description/ros2_control/ros2_control_gazebo.urdf.xacro index 1cfc9926..5507615d 100644 --- a/src/meldog_simple_description/description/ros2_control/ros2_control_gazebo.urdf.xacro +++ b/src/meldog_simple_description/description/ros2_control/ros2_control_gazebo.urdf.xacro @@ -1,35 +1,14 @@ - + ign_ros2_control/IgnitionSystem - - - - - - - - - - - - - - - - - - - - - - - + + diff --git a/src/meldog_simple_description/description/ros2_control/transmission_macros.urdf.xacro b/src/meldog_simple_description/description/ros2_control/transmission/transmission_macros.urdf.xacro similarity index 71% rename from src/meldog_simple_description/description/ros2_control/transmission_macros.urdf.xacro rename to src/meldog_simple_description/description/ros2_control/transmission/transmission_macros.urdf.xacro index 8ffc223f..7505125c 100644 --- a/src/meldog_simple_description/description/ros2_control/transmission_macros.urdf.xacro +++ b/src/meldog_simple_description/description/ros2_control/transmission/transmission_macros.urdf.xacro @@ -36,16 +36,16 @@ - - - - - + + + + + - - - - - + + + + + \ No newline at end of file diff --git a/src/meldog_simple_description/simple_commands/joint_trajectory_example.txt b/src/meldog_simple_description/simple_commands/joint_trajectory_example.txt index f66b9e64..1a3431d6 100644 --- a/src/meldog_simple_description/simple_commands/joint_trajectory_example.txt +++ b/src/meldog_simple_description/simple_commands/joint_trajectory_example.txt @@ -22,3 +22,14 @@ PRZYSIAD: { positions: [0.0, 0.0, 0.0, 0.0, -0.78539, -0.78539, -0.78539, -0.78539, 1.5707, 1.5707, 1.5707, 1.5707], time_from_start: { sec: 9 } } ] } }" + + WYPROSTOWANIE: + + ros2 action send_goal /joint_trajectory_controller/follow_joint_trajectory control_msgs/action/FollowJointTrajectory -f "{ + trajectory: { + joint_names: ['FLH_joint', 'FRH_joint', 'BLH_joint', 'BRH_joint', 'FLT_joint', 'FRT_joint', 'BLT_joint', 'BRT_joint', 'FLS_joint', 'FRS_joint', 'BLS_joint', 'BRS_joint'], + points: [ + { positions: [0.0, 0.0, 0.0, 0.0, -0.78539, -0.78539, -0.78539, -0.78539, 1.5707, 1.5707, 1.5707, 1.5707], time_from_start: { sec: 1 } }, + { positions: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], time_from_start: { sec: 6 } } ] + } + }" From 7a62db4560cae6f3072637af8293e4fb76301a78 Mon Sep 17 00:00:00 2001 From: Bartek Date: Mon, 16 Sep 2024 20:21:20 +0200 Subject: [PATCH 22/23] Removed test launch files --- .../launch/gazebo.launch.py | 33 -------- .../launch/gazebo_sim.launch.py | 39 --------- .../launch/meldog_gazebo.launch.py | 83 ------------------- .../launch/meldog_gazebo_sim.launch.py | 83 ------------------- 4 files changed, 238 deletions(-) delete mode 100644 src/meldog_simple_description/launch/gazebo.launch.py delete mode 100644 src/meldog_simple_description/launch/gazebo_sim.launch.py delete mode 100644 src/meldog_simple_description/launch/meldog_gazebo.launch.py delete mode 100644 src/meldog_simple_description/launch/meldog_gazebo_sim.launch.py diff --git a/src/meldog_simple_description/launch/gazebo.launch.py b/src/meldog_simple_description/launch/gazebo.launch.py deleted file mode 100644 index b99c9610..00000000 --- a/src/meldog_simple_description/launch/gazebo.launch.py +++ /dev/null @@ -1,33 +0,0 @@ -import os -from ament_index_python.packages import get_package_share_directory -from launch import LaunchDescription -from launch.actions import IncludeLaunchDescription -from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch import LaunchDescription -from launch.actions import DeclareLaunchArgument, RegisterEventHandler -from launch.conditions import IfCondition -from launch.event_handlers import OnProcessExit -from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution - -from launch_ros.actions import Node -from launch_ros.substitutions import FindPackageShare - -from launch_ros.parameter_descriptions import ParameterValue - -from launch_ros.actions import Node - - -def generate_launch_description(): - - gazebo = IncludeLaunchDescription( - PythonLaunchDescriptionSource([os.path.join( - get_package_share_directory('gazebo_ros'), 'launch'), '/gazebo.launch.py']), - ) - - - - # Nodes - nodes = [ - gazebo, - ] - return LaunchDescription(nodes) \ No newline at end of file diff --git a/src/meldog_simple_description/launch/gazebo_sim.launch.py b/src/meldog_simple_description/launch/gazebo_sim.launch.py deleted file mode 100644 index e9435ffe..00000000 --- a/src/meldog_simple_description/launch/gazebo_sim.launch.py +++ /dev/null @@ -1,39 +0,0 @@ -import os -from ament_index_python.packages import get_package_share_directory -from launch import LaunchDescription -from launch.actions import IncludeLaunchDescription -from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch import LaunchDescription -from launch.actions import DeclareLaunchArgument, RegisterEventHandler -from launch.conditions import IfCondition -from launch.event_handlers import OnProcessExit -from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution - -from launch_ros.actions import Node -from launch_ros.substitutions import FindPackageShare - -from launch_ros.parameter_descriptions import ParameterValue - -from launch_ros.actions import Node - - -def generate_launch_description(): - - world = os.path.join( - get_package_share_directory('meldog_description'), - 'worlds', - 'empty.world' - ) - gazebo_sim = IncludeLaunchDescription( - PythonLaunchDescriptionSource([os.path.join( - get_package_share_directory('ros_gz_sim'), 'launch'), '/gz_sim.launch.py']), - launch_arguments={'gz_args': [world], 'on_exit_shutdown': 'true'}.items() - ) - - - - # Nodes - nodes = [ - gazebo_sim, - ] - return LaunchDescription(nodes) \ No newline at end of file diff --git a/src/meldog_simple_description/launch/meldog_gazebo.launch.py b/src/meldog_simple_description/launch/meldog_gazebo.launch.py deleted file mode 100644 index bc589667..00000000 --- a/src/meldog_simple_description/launch/meldog_gazebo.launch.py +++ /dev/null @@ -1,83 +0,0 @@ -import os -from ament_index_python.packages import get_package_share_directory -from launch import LaunchDescription -from launch.actions import IncludeLaunchDescription -from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch import LaunchDescription -from launch.actions import DeclareLaunchArgument, RegisterEventHandler -from launch.conditions import IfCondition -from launch.event_handlers import OnProcessExit -from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution - -from launch_ros.actions import Node -from launch_ros.substitutions import FindPackageShare - -from launch_ros.parameter_descriptions import ParameterValue - -from launch_ros.actions import Node - - -def generate_launch_description(): - - # Declare arguments - declared_arguments = [] - - declared_arguments.append( - DeclareLaunchArgument( - "package", - default_value="meldog_description", - ) - ) - - declared_arguments.append( - DeclareLaunchArgument( - "urdf_file", - default_value="meldog_gazebo.urdf.xacro", - ) - ) - # Initialize Arguments - package_name = LaunchConfiguration("package") - urdf_file = LaunchConfiguration("urdf_file") - - # Get URDF via xacro - robot_description_content = ParameterValue( - Command( - [ - PathJoinSubstitution([FindExecutable(name="xacro")]), - " ", - PathJoinSubstitution( - [ - FindPackageShare(package_name), - "description", - urdf_file, - ] - ), - ] - ), value_type=str) - robot_description = {"robot_description": robot_description_content} - use_sim_time = {"use_sim_time": True} - - robot_state_pub_node = Node( - package="robot_state_publisher", - executable="robot_state_publisher", - output="both", - parameters=[robot_description, use_sim_time], - ) - - - spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py', - arguments=['-topic', 'robot_description', - '-entity', 'Meldog'], - output='screen') - - - - - - - # Nodes - nodes = [ - robot_state_pub_node, - spawn_entity, - ] - return LaunchDescription(declared_arguments + nodes) \ No newline at end of file diff --git a/src/meldog_simple_description/launch/meldog_gazebo_sim.launch.py b/src/meldog_simple_description/launch/meldog_gazebo_sim.launch.py deleted file mode 100644 index ec60d7c7..00000000 --- a/src/meldog_simple_description/launch/meldog_gazebo_sim.launch.py +++ /dev/null @@ -1,83 +0,0 @@ -import os -from ament_index_python.packages import get_package_share_directory -from launch import LaunchDescription -from launch.actions import IncludeLaunchDescription -from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch import LaunchDescription -from launch.actions import DeclareLaunchArgument, RegisterEventHandler -from launch.conditions import IfCondition -from launch.event_handlers import OnProcessExit -from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution - -from launch_ros.actions import Node -from launch_ros.substitutions import FindPackageShare - -from launch_ros.parameter_descriptions import ParameterValue - -from launch_ros.actions import Node - - -def generate_launch_description(): - - # Declare arguments - declared_arguments = [] - - declared_arguments.append( - DeclareLaunchArgument( - "package", - default_value="meldog_description", - ) - ) - - declared_arguments.append( - DeclareLaunchArgument( - "urdf_file", - default_value="meldog_gazebo.urdf.xacro", - ) - ) - # Initialize Arguments - package_name = LaunchConfiguration("package") - urdf_file = LaunchConfiguration("urdf_file") - - # Get URDF via xacro - robot_description_content = ParameterValue( - Command( - [ - PathJoinSubstitution([FindExecutable(name="xacro")]), - " ", - PathJoinSubstitution( - [ - FindPackageShare(package_name), - "description", - urdf_file, - ] - ), - ] - ), value_type=str) - robot_description = {"robot_description": robot_description_content} - use_sim_time = {"use_sim_time": True} - - robot_state_pub_node = Node( - package="robot_state_publisher", - executable="robot_state_publisher", - output="both", - parameters=[robot_description, use_sim_time], - ) - - - spawn_entity = Node(package='ros_gz_sim', executable='create', - arguments=['-topic', 'robot_description', - '-name', 'Meldog'], - output='screen') - - - - - - - # Nodes - nodes = [ - robot_state_pub_node, - spawn_entity, - ] - return LaunchDescription(declared_arguments + nodes) \ No newline at end of file From 165e3498eb78181941b7a965a11179217da86d71 Mon Sep 17 00:00:00 2001 From: Bartek Date: Tue, 17 Sep 2024 20:28:41 +0200 Subject: [PATCH 23/23] Added/edited comments --- .../description/joints/joint_macros.urdf.xacro | 1 + .../description/joints/joint_properties.urdf.xacro | 4 ++-- .../description/links/feet/feet.urdf.xacro | 6 +++--- .../description/links/hip/hip.urdf.xacro | 3 +-- .../description/links/shank/shank.urdf.xacro | 2 +- .../description/links/thigh/thigh.urdf.xacro | 2 +- .../description/links/trunk/trunk.urdf.xacro | 1 + .../description/meldog_core.urdf.xacro | 6 +++--- .../description/meldog_gazebo.urdf.xacro | 4 ++-- .../joints_hardware/joint_hardware_macros.urdf.xacro | 1 + .../joints_hardware/joint_hardware_properties.urdf.xacro | 2 +- .../description/ros2_control/ros2_control_core.urdf.xacro | 6 +++--- .../description/ros2_control/ros2_control_gazebo.urdf.xacro | 4 ++-- .../transmission/transmission_macros.urdf.xacro | 6 +++--- 14 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/meldog_simple_description/description/joints/joint_macros.urdf.xacro b/src/meldog_simple_description/description/joints/joint_macros.urdf.xacro index caed7cfd..604c8032 100644 --- a/src/meldog_simple_description/description/joints/joint_macros.urdf.xacro +++ b/src/meldog_simple_description/description/joints/joint_macros.urdf.xacro @@ -1,6 +1,7 @@ + diff --git a/src/meldog_simple_description/description/joints/joint_properties.urdf.xacro b/src/meldog_simple_description/description/joints/joint_properties.urdf.xacro index 8320b567..122e1de5 100644 --- a/src/meldog_simple_description/description/joints/joint_properties.urdf.xacro +++ b/src/meldog_simple_description/description/joints/joint_properties.urdf.xacro @@ -1,7 +1,7 @@ - + @@ -13,7 +13,7 @@ - + diff --git a/src/meldog_simple_description/description/links/feet/feet.urdf.xacro b/src/meldog_simple_description/description/links/feet/feet.urdf.xacro index a7512e53..29b4263a 100644 --- a/src/meldog_simple_description/description/links/feet/feet.urdf.xacro +++ b/src/meldog_simple_description/description/links/feet/feet.urdf.xacro @@ -1,9 +1,9 @@ - - - + + + diff --git a/src/meldog_simple_description/description/links/hip/hip.urdf.xacro b/src/meldog_simple_description/description/links/hip/hip.urdf.xacro index 487a65de..02b47890 100644 --- a/src/meldog_simple_description/description/links/hip/hip.urdf.xacro +++ b/src/meldog_simple_description/description/links/hip/hip.urdf.xacro @@ -2,11 +2,10 @@ - + - diff --git a/src/meldog_simple_description/description/links/shank/shank.urdf.xacro b/src/meldog_simple_description/description/links/shank/shank.urdf.xacro index f0b0d301..a430226c 100644 --- a/src/meldog_simple_description/description/links/shank/shank.urdf.xacro +++ b/src/meldog_simple_description/description/links/shank/shank.urdf.xacro @@ -1,9 +1,9 @@ + - diff --git a/src/meldog_simple_description/description/links/thigh/thigh.urdf.xacro b/src/meldog_simple_description/description/links/thigh/thigh.urdf.xacro index 5e81f7d6..f4620406 100644 --- a/src/meldog_simple_description/description/links/thigh/thigh.urdf.xacro +++ b/src/meldog_simple_description/description/links/thigh/thigh.urdf.xacro @@ -1,9 +1,9 @@ + - diff --git a/src/meldog_simple_description/description/links/trunk/trunk.urdf.xacro b/src/meldog_simple_description/description/links/trunk/trunk.urdf.xacro index 34b2dfba..3b92d811 100644 --- a/src/meldog_simple_description/description/links/trunk/trunk.urdf.xacro +++ b/src/meldog_simple_description/description/links/trunk/trunk.urdf.xacro @@ -1,6 +1,7 @@ + diff --git a/src/meldog_simple_description/description/meldog_core.urdf.xacro b/src/meldog_simple_description/description/meldog_core.urdf.xacro index b33e2089..383f566e 100644 --- a/src/meldog_simple_description/description/meldog_core.urdf.xacro +++ b/src/meldog_simple_description/description/meldog_core.urdf.xacro @@ -4,11 +4,11 @@ - + - + @@ -45,7 +45,7 @@ - + diff --git a/src/meldog_simple_description/description/meldog_gazebo.urdf.xacro b/src/meldog_simple_description/description/meldog_gazebo.urdf.xacro index af40456f..9c8b37b7 100644 --- a/src/meldog_simple_description/description/meldog_gazebo.urdf.xacro +++ b/src/meldog_simple_description/description/meldog_gazebo.urdf.xacro @@ -7,7 +7,7 @@ - + @@ -36,7 +36,7 @@ - + diff --git a/src/meldog_simple_description/description/ros2_control/joints_hardware/joint_hardware_macros.urdf.xacro b/src/meldog_simple_description/description/ros2_control/joints_hardware/joint_hardware_macros.urdf.xacro index 3c2d1d91..ac32c422 100644 --- a/src/meldog_simple_description/description/ros2_control/joints_hardware/joint_hardware_macros.urdf.xacro +++ b/src/meldog_simple_description/description/ros2_control/joints_hardware/joint_hardware_macros.urdf.xacro @@ -1,6 +1,7 @@ + diff --git a/src/meldog_simple_description/description/ros2_control/joints_hardware/joint_hardware_properties.urdf.xacro b/src/meldog_simple_description/description/ros2_control/joints_hardware/joint_hardware_properties.urdf.xacro index 05affec9..f2c9b8f6 100644 --- a/src/meldog_simple_description/description/ros2_control/joints_hardware/joint_hardware_properties.urdf.xacro +++ b/src/meldog_simple_description/description/ros2_control/joints_hardware/joint_hardware_properties.urdf.xacro @@ -1,7 +1,7 @@ - + diff --git a/src/meldog_simple_description/description/ros2_control/ros2_control_core.urdf.xacro b/src/meldog_simple_description/description/ros2_control/ros2_control_core.urdf.xacro index b5126c82..0862edaf 100644 --- a/src/meldog_simple_description/description/ros2_control/ros2_control_core.urdf.xacro +++ b/src/meldog_simple_description/description/ros2_control/ros2_control_core.urdf.xacro @@ -1,14 +1,14 @@ - + - + - + diff --git a/src/meldog_simple_description/description/ros2_control/ros2_control_gazebo.urdf.xacro b/src/meldog_simple_description/description/ros2_control/ros2_control_gazebo.urdf.xacro index 5507615d..5c9ec2ea 100644 --- a/src/meldog_simple_description/description/ros2_control/ros2_control_gazebo.urdf.xacro +++ b/src/meldog_simple_description/description/ros2_control/ros2_control_gazebo.urdf.xacro @@ -1,13 +1,13 @@ - + ign_ros2_control/IgnitionSystem - + diff --git a/src/meldog_simple_description/description/ros2_control/transmission/transmission_macros.urdf.xacro b/src/meldog_simple_description/description/ros2_control/transmission/transmission_macros.urdf.xacro index 7505125c..71cab3f9 100644 --- a/src/meldog_simple_description/description/ros2_control/transmission/transmission_macros.urdf.xacro +++ b/src/meldog_simple_description/description/ros2_control/transmission/transmission_macros.urdf.xacro @@ -34,15 +34,15 @@ - + - + - +