ソースを参照

将guguji_ros2原始内容移植到ros2系统下可以正常启动的软件包,其中在rviz和gazebo中都可以正常打开

corvin_zhang 1 週間 前
コミット
2eb219f295
27 ファイル変更576 行追加905 行削除
  1. 11 0
      .gitignore
  2. 56 1
      README.md
  3. 0 14
      guguji_ros2/CMakeLists.txt
  4. 0 1
      guguji_ros2/config/joint_names_guguji.yaml
  5. 0 780
      guguji_ros2/export.log
  6. 0 20
      guguji_ros2/launch/display.launch
  7. 0 20
      guguji_ros2/launch/gazebo.launch
  8. 0 21
      guguji_ros2/package.xml
  9. 0 10
      guguji_ros2/urdf/guguji.csv
  10. 21 0
      guguji_ros2_ws/src/guguji_ros2/CMakeLists.txt
  11. 9 0
      guguji_ros2_ws/src/guguji_ros2/config/joint_names_guguji.yaml
  12. 76 0
      guguji_ros2_ws/src/guguji_ros2/launch/display.launch.py
  13. 152 0
      guguji_ros2_ws/src/guguji_ros2/launch/gazebo.launch.py
  14. 0 0
      guguji_ros2_ws/src/guguji_ros2/meshes/base_link.STL
  15. 0 0
      guguji_ros2_ws/src/guguji_ros2/meshes/left_ankle_pitch_link.STL
  16. 0 0
      guguji_ros2_ws/src/guguji_ros2/meshes/left_foot_link.STL
  17. 0 0
      guguji_ros2_ws/src/guguji_ros2/meshes/left_hip_pitch_link.STL
  18. 0 0
      guguji_ros2_ws/src/guguji_ros2/meshes/left_knee_pitch_link.STL
  19. 0 0
      guguji_ros2_ws/src/guguji_ros2/meshes/right_ankle_pitch_link.STL
  20. 0 0
      guguji_ros2_ws/src/guguji_ros2/meshes/right_foot_link.STL
  21. 0 0
      guguji_ros2_ws/src/guguji_ros2/meshes/right_hip_pitch_link.STL
  22. 0 0
      guguji_ros2_ws/src/guguji_ros2/meshes/right_knee_pitch_link.STL
  23. 25 0
      guguji_ros2_ws/src/guguji_ros2/package.xml
  24. 158 0
      guguji_ros2_ws/src/guguji_ros2/rviz/guguji.rviz
  25. 10 0
      guguji_ros2_ws/src/guguji_ros2/urdf/guguji.csv
  26. 47 38
      guguji_ros2_ws/src/guguji_ros2/urdf/guguji.urdf
  27. 11 0
      guguji_ros2_ws/src/guguji_ros2/worlds/empty.world

+ 11 - 0
.gitignore

@@ -0,0 +1,11 @@
+# ROS 2 工作空间编译产物
+/guguji_ros2_ws/build/
+/guguji_ros2_ws/install/
+/guguji_ros2_ws/log/
+
+# colcon/ament 常见缓存
+/guguji_ros2_ws/.colcon/
+
+# Python 运行缓存
+__pycache__/
+*.pyc

+ 56 - 1
README.md

@@ -1,3 +1,58 @@
 # guguji_simulation
 
-guguji的仿真环境
+guguji 的 ROS 2 Humble 仿真环境。
+
+## 当前结构
+
+`guguji_ros2` 是已经整理好的 ROS 2 软件包,包含:
+
+- `urdf/`:机器人模型
+- `meshes/`:网格模型
+- `launch/`:ROS 2 启动文件
+- `worlds/`:Gazebo world 文件
+- `config/`:关节配置
+
+## 依赖安装
+
+在 Ubuntu 22.04 + ROS 2 Humble 环境中,至少需要安装:
+
+```bash
+sudo apt update
+sudo apt install \
+  ros-humble-joint-state-publisher \
+  ros-humble-joint-state-publisher-gui \
+  ros-humble-robot-state-publisher \
+  ros-humble-rviz2 \
+  ros-humble-xacro \
+  ros-humble-gazebo-ros-pkgs
+```
+
+## 构建
+
+在仓库根目录执行:
+
+```bash
+source /opt/ros/humble/setup.bash
+colcon build --packages-select guguji_ros2
+source install/setup.bash
+```
+
+## 启动方式
+
+仅查看模型与 TF:
+
+```bash
+ros2 launch guguji_ros2 display.launch.py
+```
+
+启动 Gazebo 仿真:
+
+```bash
+ros2 launch guguji_ros2 gazebo.launch.py
+```
+
+如果你在无图形界面的环境中调试,可以关闭 Gazebo GUI:
+
+```bash
+ros2 launch guguji_ros2 gazebo.launch.py gui:=false
+```

+ 0 - 14
guguji_ros2/CMakeLists.txt

@@ -1,14 +0,0 @@
-cmake_minimum_required(VERSION 2.8.3)
-
-project(guguji)
-
-find_package(catkin REQUIRED)
-
-catkin_package()
-
-find_package(roslaunch)
-
-foreach(dir config launch meshes urdf)
-	install(DIRECTORY ${dir}/
-		DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/${dir})
-endforeach(dir)

+ 0 - 1
guguji_ros2/config/joint_names_guguji.yaml

@@ -1 +0,0 @@
-controller_joint_names: ['', 'eft_hip_pitch_joint', 'left_knee_pitch_joint', 'left_ankle_pitch_joint', 'left_ankle_joint', 'right_hip_pitch_joint', 'right_knee_pitch_joint', 'right_ankle_pitch_joint', 'right_ankle_joint', ]

ファイルの差分が大きいため隠しています
+ 0 - 780
guguji_ros2/export.log


+ 0 - 20
guguji_ros2/launch/display.launch

@@ -1,20 +0,0 @@
-<launch>
-  <arg
-    name="model" />
-  <param
-    name="robot_description"
-    textfile="$(find guguji)/urdf/guguji.urdf" />
-  <node
-    name="joint_state_publisher_gui"
-    pkg="joint_state_publisher_gui"
-    type="joint_state_publisher_gui" />
-  <node
-    name="robot_state_publisher"
-    pkg="robot_state_publisher"
-    type="robot_state_publisher" />
-  <node
-    name="rviz"
-    pkg="rviz"
-    type="rviz"
-    args="-d $(find guguji)/urdf.rviz" />
-</launch>

+ 0 - 20
guguji_ros2/launch/gazebo.launch

@@ -1,20 +0,0 @@
-<launch>
-  <include
-    file="$(find gazebo_ros)/launch/empty_world.launch" />
-  <node
-    name="tf_footprint_base"
-    pkg="tf"
-    type="static_transform_publisher"
-    args="0 0 0 0 0 0 base_link base_footprint 40" />
-  <node
-    name="spawn_model"
-    pkg="gazebo_ros"
-    type="spawn_model"
-    args="-file $(find guguji)/urdf/guguji.urdf -urdf -model guguji"
-    output="screen" />
-  <node
-    name="fake_joint_calibration"
-    pkg="rostopic"
-    type="rostopic"
-    args="pub /calibrated std_msgs/Bool true" />
-</launch>

+ 0 - 21
guguji_ros2/package.xml

@@ -1,21 +0,0 @@
-<package format="2">
-  <name>guguji</name>
-  <version>1.0.0</version>
-  <description>
-    <p>URDF Description package for guguji</p>
-    <p>This package contains configuration data, 3D models and launch files
-for guguji robot</p>
-  </description>
-  <author>TODO</author>
-  <maintainer email="TODO@email.com" />
-  <license>BSD</license>
-  <buildtool_depend>catkin</buildtool_depend>
-  <depend>roslaunch</depend>
-  <depend>robot_state_publisher</depend>
-  <depend>rviz</depend>
-  <depend>joint_state_publisher_gui</depend>
-  <depend>gazebo</depend>
-  <export>
-    <architecture_independent />
-  </export>
-</package>

+ 0 - 10
guguji_ros2/urdf/guguji.csv

@@ -1,10 +0,0 @@
-Link Name,Center of Mass X,Center of Mass Y,Center of Mass Z,Center of Mass Roll,Center of Mass Pitch,Center of Mass Yaw,Mass,Moment Ixx,Moment Ixy,Moment Ixz,Moment Iyy,Moment Iyz,Moment Izz,Visual X,Visual Y,Visual Z,Visual Roll,Visual Pitch,Visual Yaw,Mesh Filename,Color Red,Color Green,Color Blue,Color Alpha,Collision X,Collision Y,Collision Z,Collision Roll,Collision Pitch,Collision Yaw,Collision Mesh Filename,Material Name,SW Components,Coordinate System,Axis Name,Joint Name,Joint Type,Joint Origin X,Joint Origin Y,Joint Origin Z,Joint Origin Roll,Joint Origin Pitch,Joint Origin Yaw,Parent,Joint Axis X,Joint Axis Y,Joint Axis Z,Limit Effort,Limit Velocity,Limit Lower,Limit Upper,Calibration rising,Calibration falling,Dynamics Damping,Dynamics Friction,Safety Soft Upper,Safety Soft Lower,Safety K Position,Safety K Velocity
-base_link,-0.01311,4.4564E-15,-0.038387,0,0,0,0.79357,0.00242,-5.1575E-18,-4.465E-06,0.0007494,-1.1414E-08,0.0022891,0,0,0,0,0,0,package://guguji/meshes/base_link.STL,0.79216,0.81961,0.93333,1,0,0,0,0,0,0,package://guguji/meshes/base_link.STL,,PLA00_ASM_1-1/PLAAC-1_1-1;PLA00_ASM_1-1/PLA00-1;RS00_ASM-5;RS00_ASM-1,base,,,,0,0,0,0,0,0,,0,0,0,,,,,,,,,,,,
-left_hip_pitch_link,-0.020507,0.056794,-0.042649,0,0,0,0.36126,0.00033468,2.8388E-06,-1.7075E-06,0.00033343,4.5382E-05,0.00029074,0,0,0,0,0,0,package://guguji/meshes/left_hip_pitch_link.STL,0.79216,0.81961,0.93333,1,0,0,0,0,0,0,package://guguji/meshes/left_hip_pitch_link.STL,,PLA00_ASM_1-1/PLALF_ASM_1-1/PLAAC-2_1-1;RS00_ASM-2,left_hip_pitch,left_hip_pitch-z,eft_hip_pitch_joint,revolute,0.0212,0.075,-0.045,0,0,0,base_link,-1,0,-8.3367E-05,0,0,0,0,,,,,,,,
-left_knee_pitch_link,-0.079749,-0.02485,-0.05519,0,0,0,0.30699,0.00018914,-9.6861E-06,-0.00012324,0.00045996,-7.9583E-06,0.00036515,0,0,0,0,0,0,package://guguji/meshes/left_knee_pitch_link.STL,0.79216,0.81961,0.93333,1,0,0,0,0,0,0,package://guguji/meshes/left_knee_pitch_link.STL,,PLA00_ASM_1-1/PLALF_ASM_1-1/PLAAC-3_1-1;RS00_ASM-3,left_knee_pitch,left_knee_pitch-z,left_knee_pitch_joint,revolute,-0.0207,0.086,-0.065,0,-8.3367E-05,0,left_hip_pitch_link,0,-1,0,0,0,0,0,,,,,,,,
-left_ankle_pitch_link,0.025229,0.041641,-0.055333,0,0,0,0.16139,0.00032566,-6.0329E-07,7.4777E-05,0.00022706,1.0258E-06,0.00019522,0,0,0,0,0,0,package://guguji/meshes/left_ankle_pitch_link.STL,0.79216,0.81961,0.93333,1,0,0,0,0,0,0,package://guguji/meshes/left_ankle_pitch_link.STL,,PLA00_ASM_1-1/PLALF_ASM_1-1/PLAAC-4_1-1,left_ankle_pitch,left_ankle-z,left_ankle_pitch_joint,revolute,-0.10001,-0.068602,-0.064992,0,0,0,left_knee_pitch_link,0,-1,0,0,0,0,0,,,,,,,,
-left_foot_link,0.00086189,-0.028039,-0.012007,0,0,0,0.52086,0.00034206,6.9489E-06,1.2323E-05,0.0011393,2.4066E-06,0.0013288,0,0,0,0,0,0,package://guguji/meshes/left_foot_link.STL,0.79216,0.81961,0.93333,1,0,0,0,0,0,0,package://guguji/meshes/left_foot_link.STL,,LF44-1;RS00_ASM-9;RS00_ASM-4,left_ankl,left_ankle-z,left_ankle_joint,revolute,0.04999,0.068602,-0.115,0,0,0,left_ankle_pitch_link,0,-1,0,0,0,0,0,,,,,,,,
-right_hip_pitch_link,-0.020511,-0.056935,-0.042647,0,0,0,0.36126,0.00033468,-2.8417E-06,-1.6994E-06,0.00033343,-4.5381E-05,0.00029074,0,0,0,0,0,0,package://guguji/meshes/right_hip_pitch_link.STL,0.79216,0.81961,0.93333,1,0,0,0,0,0,0,package://guguji/meshes/right_hip_pitch_link.STL,,PLA00_ASM_1-1/PLARF_ASM_1-1/PLAAC-2_MIR_1-1;RS00_ASM-6,right_hip_pitch,right_hip_pitch-z,right_hip_pitch_joint,revolute,0.0212,-0.075,-0.045,0,-8.3367E-05,0,base_link,1,0,0,0,0,0,0,,,,,,,,
-right_knee_pitch_link,-0.079749,0.025083,-0.05519,0,0,0,0.30699,0.00018914,9.6861E-06,-0.00012325,0.00045996,7.9583E-06,0.00036515,0,0,0,0,0,0,package://guguji/meshes/right_knee_pitch_link.STL,0.79216,0.81961,0.93333,1,0,0,0,0,0,0,package://guguji/meshes/right_knee_pitch_link.STL,,PLA00_ASM_1-1/PLARF_ASM_1-1/PLAAC-3_MIR_1-1;RS00_ASM-7,right_knee_pitch,right_knee-z,right_knee_pitch_joint,revolute,-0.020705,-0.0864,-0.064998,0,0,0,right_hip_pitch_link,0,1,0,0,0,0,0,,,,,,,,
-right_ankle_pitch_link,0.025229,-0.041641,-0.055333,0,0,0,0.16139,0.00032566,6.0329E-07,7.4777E-05,0.00022706,-1.0258E-06,0.00019522,0,0,0,0,0,0,package://guguji/meshes/right_ankle_pitch_link.STL,0.79216,0.81961,0.93333,1,0,0,0,0,0,0,package://guguji/meshes/right_ankle_pitch_link.STL,,PLA00_ASM_1-1/PLARF_ASM_1-1/PLAAC-4_MIR_1-1,right_ankle_pitch,right_ankle_pitch-z,right_ankle_pitch_joint,continuous,-0.10001,0.069002,-0.064992,0,0,0,right_knee_pitch_link,0,1,0,,,,,,,,,,,,
-right_foot_link,0.0011206,0.029513,-0.015613,0,0,0,0.40057,0.00029071,-6.947E-06,1.2318E-05,0.0010904,-2.4067E-06,0.0012771,0,0,0,0,0,0,package://guguji/meshes/right_foot_link.STL,0.79216,0.81961,0.93333,1,0,0,0,0,0,0,package://guguji/meshes/right_foot_link.STL,,LF44Z-1;RS00_ASM-8;LF-43-1,right_ankle,right_ankle-z,right_ankle_joint,revolute,0.04999,-0.069002,-0.115,0,0,0,right_ankle_pitch_link,0,1,0,0,0,0,0,,,,,,,,

+ 21 - 0
guguji_ros2_ws/src/guguji_ros2/CMakeLists.txt

@@ -0,0 +1,21 @@
+cmake_minimum_required(VERSION 3.10)
+
+project(guguji_ros2)
+
+find_package(ament_cmake REQUIRED)
+
+# 这是一个纯描述/仿真资源包,不编译节点源码,
+# 只需要把 launch、URDF、mesh、world 等资源安装到 share 目录即可。
+install(
+  DIRECTORY
+    config
+    launch
+    meshes
+    rviz
+    textures
+    urdf
+    worlds
+  DESTINATION share/${PROJECT_NAME}
+)
+
+ament_package()

+ 9 - 0
guguji_ros2_ws/src/guguji_ros2/config/joint_names_guguji.yaml

@@ -0,0 +1,9 @@
+controller_joint_names:
+  - left_hip_pitch_joint
+  - left_knee_pitch_joint
+  - left_ankle_pitch_joint
+  - left_ankle_joint
+  - right_hip_pitch_joint
+  - right_knee_pitch_joint
+  - right_ankle_pitch_joint
+  - right_ankle_joint

+ 76 - 0
guguji_ros2_ws/src/guguji_ros2/launch/display.launch.py

@@ -0,0 +1,76 @@
+import os
+
+from ament_index_python.packages import get_package_share_directory
+from launch import LaunchDescription
+from launch.actions import DeclareLaunchArgument
+from launch.conditions import IfCondition, UnlessCondition
+from launch.substitutions import LaunchConfiguration
+from launch_ros.actions import Node
+
+
+def generate_launch_description():
+    package_name = 'guguji_ros2'
+    package_share = get_package_share_directory(package_name)
+    urdf_path = os.path.join(package_share, 'urdf', 'guguji.urdf')
+    rviz_config_path = os.path.join(package_share, 'rviz', 'guguji.rviz')
+
+    # 直接读取 URDF 文件内容,并分别注入到状态发布节点中。
+    # 在 ROS 2 中参数是节点私有的,不能像 ROS 1 那样依赖全局参数服务器。
+    with open(urdf_path, 'r', encoding='utf-8') as urdf_file:
+        robot_description = urdf_file.read()
+
+    use_joint_state_gui = LaunchConfiguration('use_joint_state_gui')
+    use_rviz = LaunchConfiguration('use_rviz')
+
+    return LaunchDescription([
+        DeclareLaunchArgument(
+            'use_joint_state_gui',
+            default_value='true',
+            description='是否启动带滑块的 joint_state_publisher_gui'
+        ),
+        DeclareLaunchArgument(
+            'use_rviz',
+            default_value='true',
+            description='是否启动 RViz2'
+        ),
+        Node(
+            package='robot_state_publisher',
+            executable='robot_state_publisher',
+            name='robot_state_publisher',
+            output='screen',
+            parameters=[{
+                'robot_description': robot_description,
+                'use_sim_time': False,
+            }],
+        ),
+        Node(
+            package='joint_state_publisher_gui',
+            executable='joint_state_publisher_gui',
+            name='joint_state_publisher_gui',
+            condition=IfCondition(use_joint_state_gui),
+            output='screen',
+            parameters=[{
+                'robot_description': robot_description,
+                'use_sim_time': False,
+            }],
+        ),
+        Node(
+            package='joint_state_publisher',
+            executable='joint_state_publisher',
+            name='joint_state_publisher',
+            condition=UnlessCondition(use_joint_state_gui),
+            output='screen',
+            parameters=[{
+                'robot_description': robot_description,
+                'use_sim_time': False,
+            }],
+        ),
+        Node(
+            package='rviz2',
+            executable='rviz2',
+            name='rviz2',
+            condition=IfCondition(use_rviz),
+            output='screen',
+            arguments=['-d', rviz_config_path],
+        ),
+    ])

+ 152 - 0
guguji_ros2_ws/src/guguji_ros2/launch/gazebo.launch.py

@@ -0,0 +1,152 @@
+import os
+
+from ament_index_python.packages import get_package_share_directory
+from launch import LaunchDescription
+from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription
+from launch.conditions import IfCondition
+from launch.launch_description_sources import PythonLaunchDescriptionSource
+from launch.substitutions import LaunchConfiguration, PathJoinSubstitution
+from launch_ros.actions import Node
+from launch_ros.substitutions import FindPackageShare
+
+
+def generate_launch_description():
+    package_name = 'guguji_ros2'
+    package_share = get_package_share_directory(package_name)
+    urdf_path = os.path.join(package_share, 'urdf', 'guguji.urdf')
+    default_world = os.path.join(package_share, 'worlds', 'empty.world')
+
+    # 这里继续保留 robot_state_publisher + joint_state_publisher 的组合,
+    # 这样即使暂时还没有接入 ros2_control,也能先把 TF 树和基础模型显示跑起来。
+    with open(urdf_path, 'r', encoding='utf-8') as urdf_file:
+        robot_description = urdf_file.read()
+
+    world = LaunchConfiguration('world')
+    use_sim_time = LaunchConfiguration('use_sim_time')
+    gui = LaunchConfiguration('gui')
+    pause = LaunchConfiguration('pause')
+    verbose = LaunchConfiguration('verbose')
+    publish_joint_state = LaunchConfiguration('publish_joint_state')
+    x_pose = LaunchConfiguration('x_pose')
+    y_pose = LaunchConfiguration('y_pose')
+    z_pose = LaunchConfiguration('z_pose')
+    roll = LaunchConfiguration('roll')
+    pitch = LaunchConfiguration('pitch')
+    yaw = LaunchConfiguration('yaw')
+
+    gazebo_launch = IncludeLaunchDescription(
+        PythonLaunchDescriptionSource(
+            PathJoinSubstitution([
+                FindPackageShare('gazebo_ros'),
+                'launch',
+                'gazebo.launch.py',
+            ])
+        ),
+        launch_arguments={
+            'world': world,
+            'gui': gui,
+            'pause': pause,
+            'verbose': verbose,
+        }.items(),
+    )
+
+    return LaunchDescription([
+        DeclareLaunchArgument(
+            'world',
+            default_value=default_world,
+            description='Gazebo 启动时使用的 world 文件路径'
+        ),
+        DeclareLaunchArgument(
+            'use_sim_time',
+            default_value='true',
+            description='是否使用仿真时钟'
+        ),
+        DeclareLaunchArgument(
+            'gui',
+            default_value='true',
+            description='是否启动 Gazebo 图形界面'
+        ),
+        DeclareLaunchArgument(
+            'pause',
+            default_value='false',
+            description='Gazebo 启动后是否暂停'
+        ),
+        DeclareLaunchArgument(
+            'verbose',
+            default_value='false',
+            description='是否输出 Gazebo 详细日志'
+        ),
+        DeclareLaunchArgument(
+            'publish_joint_state',
+            default_value='true',
+            description='未接入控制器前,是否用 joint_state_publisher 发布默认关节角'
+        ),
+        DeclareLaunchArgument(
+            'x_pose',
+            default_value='0.0',
+            description='模型生成时的 X 坐标'
+        ),
+        DeclareLaunchArgument(
+            'y_pose',
+            default_value='0.0',
+            description='模型生成时的 Y 坐标'
+        ),
+        DeclareLaunchArgument(
+            'z_pose',
+            default_value='0.35',
+            description='模型生成时的 Z 坐标,适当抬高可以避免初始穿地'
+        ),
+        DeclareLaunchArgument(
+            'roll',
+            default_value='0.0',
+            description='模型生成时的 Roll 角'
+        ),
+        DeclareLaunchArgument(
+            'pitch',
+            default_value='0.0',
+            description='模型生成时的 Pitch 角'
+        ),
+        DeclareLaunchArgument(
+            'yaw',
+            default_value='0.0',
+            description='模型生成时的 Yaw 角'
+        ),
+        gazebo_launch,
+        Node(
+            package='robot_state_publisher',
+            executable='robot_state_publisher',
+            name='robot_state_publisher',
+            output='screen',
+            parameters=[{
+                'robot_description': robot_description,
+                'use_sim_time': use_sim_time,
+            }],
+        ),
+        Node(
+            package='joint_state_publisher',
+            executable='joint_state_publisher',
+            name='joint_state_publisher',
+            condition=IfCondition(publish_joint_state),
+            output='screen',
+            parameters=[{
+                'robot_description': robot_description,
+                'use_sim_time': use_sim_time,
+            }],
+        ),
+        Node(
+            package='gazebo_ros',
+            executable='spawn_entity.py',
+            name='spawn_guguji',
+            output='screen',
+            arguments=[
+                '-entity', 'guguji',
+                '-file', urdf_path,
+                '-x', x_pose,
+                '-y', y_pose,
+                '-z', z_pose,
+                '-R', roll,
+                '-P', pitch,
+                '-Y', yaw,
+            ],
+        ),
+    ])

+ 0 - 0
guguji_ros2/meshes/base_link.STL → guguji_ros2_ws/src/guguji_ros2/meshes/base_link.STL


+ 0 - 0
guguji_ros2/meshes/left_ankle_pitch_link.STL → guguji_ros2_ws/src/guguji_ros2/meshes/left_ankle_pitch_link.STL


+ 0 - 0
guguji_ros2/meshes/left_foot_link.STL → guguji_ros2_ws/src/guguji_ros2/meshes/left_foot_link.STL


+ 0 - 0
guguji_ros2/meshes/left_hip_pitch_link.STL → guguji_ros2_ws/src/guguji_ros2/meshes/left_hip_pitch_link.STL


+ 0 - 0
guguji_ros2/meshes/left_knee_pitch_link.STL → guguji_ros2_ws/src/guguji_ros2/meshes/left_knee_pitch_link.STL


+ 0 - 0
guguji_ros2/meshes/right_ankle_pitch_link.STL → guguji_ros2_ws/src/guguji_ros2/meshes/right_ankle_pitch_link.STL


+ 0 - 0
guguji_ros2/meshes/right_foot_link.STL → guguji_ros2_ws/src/guguji_ros2/meshes/right_foot_link.STL


+ 0 - 0
guguji_ros2/meshes/right_hip_pitch_link.STL → guguji_ros2_ws/src/guguji_ros2/meshes/right_hip_pitch_link.STL


+ 0 - 0
guguji_ros2/meshes/right_knee_pitch_link.STL → guguji_ros2_ws/src/guguji_ros2/meshes/right_knee_pitch_link.STL


+ 25 - 0
guguji_ros2_ws/src/guguji_ros2/package.xml

@@ -0,0 +1,25 @@
+<package format="3">
+  <name>guguji_ros2</name>
+  <version>1.0.0</version>
+  <description>guguji 机器人在 ROS 2 Humble 下的模型描述与 Gazebo 仿真软件包</description>
+  <maintainer email="corvin@example.com">corvin</maintainer>
+  <license>BSD-3-Clause</license>
+
+  <buildtool_depend>ament_cmake</buildtool_depend>
+
+  <exec_depend>ament_index_python</exec_depend>
+  <exec_depend>gazebo_ros</exec_depend>
+  <exec_depend>joint_state_publisher</exec_depend>
+  <exec_depend>joint_state_publisher_gui</exec_depend>
+  <exec_depend>launch</exec_depend>
+  <exec_depend>launch_ros</exec_depend>
+  <exec_depend>robot_state_publisher</exec_depend>
+  <exec_depend>ros2launch</exec_depend>
+  <exec_depend>rviz2</exec_depend>
+  <exec_depend>urdf</exec_depend>
+  <exec_depend>xacro</exec_depend>
+
+  <export>
+    <build_type>ament_cmake</build_type>
+  </export>
+</package>

+ 158 - 0
guguji_ros2_ws/src/guguji_ros2/rviz/guguji.rviz

@@ -0,0 +1,158 @@
+Panels:
+  - Class: rviz_common/Displays
+    Help Height: 0
+    Name: Displays
+    Property Tree Widget:
+      Expanded:
+        - /Global Options1
+        - /RobotModel1/Description Topic1
+      Splitter Ratio: 0.5
+    Tree Height: 650
+  - Class: rviz_common/Selection
+    Name: Selection
+  - Class: rviz_common/Tool Properties
+    Expanded:
+      - /Publish Point1
+    Name: Tool Properties
+    Splitter Ratio: 0.58
+  - Class: rviz_common/Views
+    Expanded:
+      - /Current View1
+    Name: Views
+    Splitter Ratio: 0.5
+Visualization Manager:
+  Class: ""
+  Displays:
+    - Alpha: 0.5
+      Cell Size: 1
+      Class: rviz_default_plugins/Grid
+      Color: 160; 160; 164
+      Enabled: true
+      Line Style:
+        Line Width: 0.03
+        Value: Lines
+      Name: Grid
+      Normal Cell Count: 0
+      Offset:
+        X: 0
+        Y: 0
+        Z: 0
+      Plane: XY
+      Plane Cell Count: 20
+      Reference Frame: <Fixed Frame>
+      Value: true
+    - Alpha: 1
+      Class: rviz_default_plugins/RobotModel
+      Collision Enabled: false
+      Description File: ""
+      Description Source: Topic
+      Description Topic:
+        Depth: 5
+        Durability Policy: Volatile
+        History Policy: Keep Last
+        Reliability Policy: Reliable
+        Value: /robot_description
+      Enabled: true
+      Links:
+        All Links Enabled: true
+        Expand Joint Details: false
+        Expand Link Details: false
+        Expand Tree: false
+        Link Tree Style: Links in Alphabetic Order
+      Name: RobotModel
+      TF Prefix: ""
+      Update Interval: 0
+      Value: true
+      Visual Enabled: true
+    - Class: rviz_default_plugins/TF
+      Enabled: true
+      Frame Timeout: 15
+      Frames:
+        All Enabled: true
+      Marker Alpha: 1
+      Marker Scale: 0.4
+      Name: TF
+      Show Arrows: true
+      Show Axes: true
+      Show Names: true
+      Tree:
+        {}
+      Update Interval: 0
+      Value: true
+  Enabled: true
+  Global Options:
+    Background Color: 235; 235; 235
+    Fixed Frame: base_link
+    Frame Rate: 30
+  Name: root
+  Tools:
+    - Class: rviz_default_plugins/MoveCamera
+    - Class: rviz_default_plugins/Select
+    - Class: rviz_default_plugins/FocusCamera
+    - Class: rviz_default_plugins/Measure
+      Line color: 128; 128; 0
+    - Class: rviz_default_plugins/SetInitialPose
+      Topic:
+        Depth: 5
+        Durability Policy: Volatile
+        History Policy: Keep Last
+        Reliability Policy: Reliable
+        Value: /initialpose
+    - Class: rviz_default_plugins/SetGoal
+      Topic:
+        Depth: 5
+        Durability Policy: Volatile
+        History Policy: Keep Last
+        Reliability Policy: Reliable
+        Value: /goal_pose
+    - Class: rviz_default_plugins/PublishPoint
+      Single click: true
+      Topic:
+        Depth: 5
+        Durability Policy: Volatile
+        History Policy: Keep Last
+        Reliability Policy: Reliable
+        Value: /clicked_point
+  Transformation:
+    Current:
+      Class: rviz_default_plugins/TF
+  Value: true
+  Views:
+    Current:
+      Class: rviz_default_plugins/Orbit
+      Distance: 1.2
+      Enable Stereo Rendering:
+        Stereo Eye Separation: 0.06
+        Stereo Focal Distance: 1
+        Swap Stereo Eyes: false
+        Value: false
+      Focal Point:
+        X: 0.0
+        Y: 0.0
+        Z: -0.15
+      Focal Shape Fixed Size: true
+      Focal Shape Size: 0.05
+      Invert Z Axis: false
+      Name: Current View
+      Near Clip Distance: 0.01
+      Pitch: 0.6
+      Target Frame: base_link
+      Value: Orbit (rviz)
+      Yaw: 2.3
+    Saved: ~
+Window Geometry:
+  Displays:
+    collapsed: false
+  Height: 900
+  Hide Left Dock: false
+  Hide Right Dock: false
+  QMainWindow State: 000000ff00000000fd00000004000000000000025600000320fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e3000000920000005b00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ef000001d500000185000000a3fb000000120056006900650077007300200054006f006f02000001df000001790000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003b00000320000000c700fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb0000001400570069006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f000002bcfc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000003b000002bc000000a000fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000475000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000003b00000003efc0100000002fb0000000800540069006d00650100000000000003b00000000000000000fb0000000800540069006d00650100000000000003b00000000000000000000001750000032000000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
+  Selection:
+    collapsed: false
+  Tool Properties:
+    collapsed: false
+  Views:
+    collapsed: false
+  Width: 950
+  X: 80
+  Y: 60

+ 10 - 0
guguji_ros2_ws/src/guguji_ros2/urdf/guguji.csv

@@ -0,0 +1,10 @@
+Link Name,Center of Mass X,Center of Mass Y,Center of Mass Z,Center of Mass Roll,Center of Mass Pitch,Center of Mass Yaw,Mass,Moment Ixx,Moment Ixy,Moment Ixz,Moment Iyy,Moment Iyz,Moment Izz,Visual X,Visual Y,Visual Z,Visual Roll,Visual Pitch,Visual Yaw,Mesh Filename,Color Red,Color Green,Color Blue,Color Alpha,Collision X,Collision Y,Collision Z,Collision Roll,Collision Pitch,Collision Yaw,Collision Mesh Filename,Material Name,SW Components,Coordinate System,Axis Name,Joint Name,Joint Type,Joint Origin X,Joint Origin Y,Joint Origin Z,Joint Origin Roll,Joint Origin Pitch,Joint Origin Yaw,Parent,Joint Axis X,Joint Axis Y,Joint Axis Z,Limit Effort,Limit Velocity,Limit Lower,Limit Upper,Calibration rising,Calibration falling,Dynamics Damping,Dynamics Friction,Safety Soft Upper,Safety Soft Lower,Safety K Position,Safety K Velocity
+base_link,-0.01311,4.4564E-15,-0.038387,0,0,0,0.79357,0.00242,-5.1575E-18,-4.465E-06,0.0007494,-1.1414E-08,0.0022891,0,0,0,0,0,0,package://guguji_ros2/meshes/base_link.STL,0.79216,0.81961,0.93333,1,0,0,0,0,0,0,package://guguji_ros2/meshes/base_link.STL,,PLA00_ASM_1-1/PLAAC-1_1-1;PLA00_ASM_1-1/PLA00-1;RS00_ASM-5;RS00_ASM-1,base,,,,0,0,0,0,0,0,,0,0,0,,,,,,,,,,,,
+left_hip_pitch_link,-0.020507,0.056794,-0.042649,0,0,0,0.36126,0.00033468,2.8388E-06,-1.7075E-06,0.00033343,4.5382E-05,0.00029074,0,0,0,0,0,0,package://guguji_ros2/meshes/left_hip_pitch_link.STL,0.79216,0.81961,0.93333,1,0,0,0,0,0,0,package://guguji_ros2/meshes/left_hip_pitch_link.STL,,PLA00_ASM_1-1/PLALF_ASM_1-1/PLAAC-2_1-1;RS00_ASM-2,left_hip_pitch,left_hip_pitch-z,left_hip_pitch_joint,revolute,0.0212,0.075,-0.045,0,0,0,base_link,-1,0,-8.3367E-05,0,0,0,0,,,,,,,,
+left_knee_pitch_link,-0.079749,-0.02485,-0.05519,0,0,0,0.30699,0.00018914,-9.6861E-06,-0.00012324,0.00045996,-7.9583E-06,0.00036515,0,0,0,0,0,0,package://guguji_ros2/meshes/left_knee_pitch_link.STL,0.79216,0.81961,0.93333,1,0,0,0,0,0,0,package://guguji_ros2/meshes/left_knee_pitch_link.STL,,PLA00_ASM_1-1/PLALF_ASM_1-1/PLAAC-3_1-1;RS00_ASM-3,left_knee_pitch,left_knee_pitch-z,left_knee_pitch_joint,revolute,-0.0207,0.086,-0.065,0,-8.3367E-05,0,left_hip_pitch_link,0,-1,0,0,0,0,0,,,,,,,,
+left_ankle_pitch_link,0.025229,0.041641,-0.055333,0,0,0,0.16139,0.00032566,-6.0329E-07,7.4777E-05,0.00022706,1.0258E-06,0.00019522,0,0,0,0,0,0,package://guguji_ros2/meshes/left_ankle_pitch_link.STL,0.79216,0.81961,0.93333,1,0,0,0,0,0,0,package://guguji_ros2/meshes/left_ankle_pitch_link.STL,,PLA00_ASM_1-1/PLALF_ASM_1-1/PLAAC-4_1-1,left_ankle_pitch,left_ankle-z,left_ankle_pitch_joint,revolute,-0.10001,-0.068602,-0.064992,0,0,0,left_knee_pitch_link,0,-1,0,0,0,0,0,,,,,,,,
+left_foot_link,0.00086189,-0.028039,-0.012007,0,0,0,0.52086,0.00034206,6.9489E-06,1.2323E-05,0.0011393,2.4066E-06,0.0013288,0,0,0,0,0,0,package://guguji_ros2/meshes/left_foot_link.STL,0.79216,0.81961,0.93333,1,0,0,0,0,0,0,package://guguji_ros2/meshes/left_foot_link.STL,,LF44-1;RS00_ASM-9;RS00_ASM-4,left_ankl,left_ankle-z,left_ankle_joint,revolute,0.04999,0.068602,-0.115,0,0,0,left_ankle_pitch_link,0,-1,0,0,0,0,0,,,,,,,,
+right_hip_pitch_link,-0.020511,-0.056935,-0.042647,0,0,0,0.36126,0.00033468,-2.8417E-06,-1.6994E-06,0.00033343,-4.5381E-05,0.00029074,0,0,0,0,0,0,package://guguji_ros2/meshes/right_hip_pitch_link.STL,0.79216,0.81961,0.93333,1,0,0,0,0,0,0,package://guguji_ros2/meshes/right_hip_pitch_link.STL,,PLA00_ASM_1-1/PLARF_ASM_1-1/PLAAC-2_MIR_1-1;RS00_ASM-6,right_hip_pitch,right_hip_pitch-z,right_hip_pitch_joint,revolute,0.0212,-0.075,-0.045,0,-8.3367E-05,0,base_link,1,0,0,0,0,0,0,,,,,,,,
+right_knee_pitch_link,-0.079749,0.025083,-0.05519,0,0,0,0.30699,0.00018914,9.6861E-06,-0.00012325,0.00045996,7.9583E-06,0.00036515,0,0,0,0,0,0,package://guguji_ros2/meshes/right_knee_pitch_link.STL,0.79216,0.81961,0.93333,1,0,0,0,0,0,0,package://guguji_ros2/meshes/right_knee_pitch_link.STL,,PLA00_ASM_1-1/PLARF_ASM_1-1/PLAAC-3_MIR_1-1;RS00_ASM-7,right_knee_pitch,right_knee-z,right_knee_pitch_joint,revolute,-0.020705,-0.0864,-0.064998,0,0,0,right_hip_pitch_link,0,1,0,0,0,0,0,,,,,,,,
+right_ankle_pitch_link,0.025229,-0.041641,-0.055333,0,0,0,0.16139,0.00032566,6.0329E-07,7.4777E-05,0.00022706,-1.0258E-06,0.00019522,0,0,0,0,0,0,package://guguji_ros2/meshes/right_ankle_pitch_link.STL,0.79216,0.81961,0.93333,1,0,0,0,0,0,0,package://guguji_ros2/meshes/right_ankle_pitch_link.STL,,PLA00_ASM_1-1/PLARF_ASM_1-1/PLAAC-4_MIR_1-1,right_ankle_pitch,right_ankle_pitch-z,right_ankle_pitch_joint,revolute,-0.10001,0.069002,-0.064992,0,0,0,right_knee_pitch_link,0,1,0,0,0,0,0,,,,,,,,
+right_foot_link,0.0011206,0.029513,-0.015613,0,0,0,0.40057,0.00029071,-6.947E-06,1.2318E-05,0.0010904,-2.4067E-06,0.0012771,0,0,0,0,0,0,package://guguji_ros2/meshes/right_foot_link.STL,0.79216,0.81961,0.93333,1,0,0,0,0,0,0,package://guguji_ros2/meshes/right_foot_link.STL,,LF44Z-1;RS00_ASM-8;LF-43-1,right_ankle,right_ankle-z,right_ankle_joint,revolute,0.04999,-0.069002,-0.115,0,0,0,right_ankle_pitch_link,0,1,0,0,0,0,0,,,,,,,,

+ 47 - 38
guguji_ros2/urdf/guguji.urdf → guguji_ros2_ws/src/guguji_ros2/urdf/guguji.urdf

@@ -1,9 +1,13 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- This URDF was automatically created by SolidWorks to URDF Exporter! Originally created by Stephen Brawner (brawner@gmail.com) 
-     Commit Version: 1.6.0-4-g7f85cfe  Build Version: 1.6.7995.38578
-     For more information, please see http://wiki.ros.org/sw_urdf_exporter -->
-<robot
-  name="guguji">
+<?xml version="1.0" encoding="utf-8"?>
+<!-- This URDF was automatically created by SolidWorks to URDF Exporter! Originally created by Stephen Brawner (brawner@gmail.com) 
+     Commit Version: 1.6.0-4-g7f85cfe  Build Version: 1.6.7995.38578
+     For more information, please see http://wiki.ros.org/sw_urdf_exporter -->
+<!-- 为了适配 ROS 2 Humble 仿真,这里仅对导出结果做了少量必要修正:
+     1. mesh 资源路径统一改到 guguji_ros2 包名下;
+     2. 修正左髋关节名拼写;
+     3. 将右踝俯仰关节改为与左侧一致的 revolute,避免仿真中单侧连续转动。 -->
+<robot
+  name="guguji">
   <link
     name="base_link">
     <inertial>
@@ -26,7 +30,7 @@
         rpy="0 0 0" />
       <geometry>
         <mesh
-          filename="package://guguji/meshes/base_link.STL" />
+          filename="package://guguji_ros2/meshes/base_link.STL" />
       </geometry>
       <material
         name="">
@@ -40,7 +44,7 @@
         rpy="0 0 0" />
       <geometry>
         <mesh
-          filename="package://guguji/meshes/base_link.STL" />
+          filename="package://guguji_ros2/meshes/base_link.STL" />
       </geometry>
     </collision>
   </link>
@@ -66,7 +70,7 @@
         rpy="0 0 0" />
       <geometry>
         <mesh
-          filename="package://guguji/meshes/left_hip_pitch_link.STL" />
+          filename="package://guguji_ros2/meshes/left_hip_pitch_link.STL" />
       </geometry>
       <material
         name="">
@@ -80,12 +84,12 @@
         rpy="0 0 0" />
       <geometry>
         <mesh
-          filename="package://guguji/meshes/left_hip_pitch_link.STL" />
+          filename="package://guguji_ros2/meshes/left_hip_pitch_link.STL" />
       </geometry>
     </collision>
   </link>
   <joint
-    name="eft_hip_pitch_joint"
+    name="left_hip_pitch_joint"
     type="revolute">
     <origin
       xyz="0.0212 0.075 -0.045"
@@ -124,7 +128,7 @@
         rpy="0 0 0" />
       <geometry>
         <mesh
-          filename="package://guguji/meshes/left_knee_pitch_link.STL" />
+          filename="package://guguji_ros2/meshes/left_knee_pitch_link.STL" />
       </geometry>
       <material
         name="">
@@ -138,7 +142,7 @@
         rpy="0 0 0" />
       <geometry>
         <mesh
-          filename="package://guguji/meshes/left_knee_pitch_link.STL" />
+          filename="package://guguji_ros2/meshes/left_knee_pitch_link.STL" />
       </geometry>
     </collision>
   </link>
@@ -182,7 +186,7 @@
         rpy="0 0 0" />
       <geometry>
         <mesh
-          filename="package://guguji/meshes/left_ankle_pitch_link.STL" />
+          filename="package://guguji_ros2/meshes/left_ankle_pitch_link.STL" />
       </geometry>
       <material
         name="">
@@ -196,7 +200,7 @@
         rpy="0 0 0" />
       <geometry>
         <mesh
-          filename="package://guguji/meshes/left_ankle_pitch_link.STL" />
+          filename="package://guguji_ros2/meshes/left_ankle_pitch_link.STL" />
       </geometry>
     </collision>
   </link>
@@ -240,7 +244,7 @@
         rpy="0 0 0" />
       <geometry>
         <mesh
-          filename="package://guguji/meshes/left_foot_link.STL" />
+          filename="package://guguji_ros2/meshes/left_foot_link.STL" />
       </geometry>
       <material
         name="">
@@ -254,7 +258,7 @@
         rpy="0 0 0" />
       <geometry>
         <mesh
-          filename="package://guguji/meshes/left_foot_link.STL" />
+          filename="package://guguji_ros2/meshes/left_foot_link.STL" />
       </geometry>
     </collision>
   </link>
@@ -298,7 +302,7 @@
         rpy="0 0 0" />
       <geometry>
         <mesh
-          filename="package://guguji/meshes/right_hip_pitch_link.STL" />
+          filename="package://guguji_ros2/meshes/right_hip_pitch_link.STL" />
       </geometry>
       <material
         name="">
@@ -312,7 +316,7 @@
         rpy="0 0 0" />
       <geometry>
         <mesh
-          filename="package://guguji/meshes/right_hip_pitch_link.STL" />
+          filename="package://guguji_ros2/meshes/right_hip_pitch_link.STL" />
       </geometry>
     </collision>
   </link>
@@ -356,7 +360,7 @@
         rpy="0 0 0" />
       <geometry>
         <mesh
-          filename="package://guguji/meshes/right_knee_pitch_link.STL" />
+          filename="package://guguji_ros2/meshes/right_knee_pitch_link.STL" />
       </geometry>
       <material
         name="">
@@ -370,7 +374,7 @@
         rpy="0 0 0" />
       <geometry>
         <mesh
-          filename="package://guguji/meshes/right_knee_pitch_link.STL" />
+          filename="package://guguji_ros2/meshes/right_knee_pitch_link.STL" />
       </geometry>
     </collision>
   </link>
@@ -414,7 +418,7 @@
         rpy="0 0 0" />
       <geometry>
         <mesh
-          filename="package://guguji/meshes/right_ankle_pitch_link.STL" />
+          filename="package://guguji_ros2/meshes/right_ankle_pitch_link.STL" />
       </geometry>
       <material
         name="">
@@ -428,23 +432,28 @@
         rpy="0 0 0" />
       <geometry>
         <mesh
-          filename="package://guguji/meshes/right_ankle_pitch_link.STL" />
+          filename="package://guguji_ros2/meshes/right_ankle_pitch_link.STL" />
       </geometry>
     </collision>
-  </link>
-  <joint
-    name="right_ankle_pitch_joint"
-    type="continuous">
-    <origin
-      xyz="-0.10001 0.069002 -0.064992"
-      rpy="0 0 0" />
+  </link>
+  <joint
+    name="right_ankle_pitch_joint"
+    type="revolute">
+    <origin
+      xyz="-0.10001 0.069002 -0.064992"
+      rpy="0 0 0" />
     <parent
       link="right_knee_pitch_link" />
-    <child
-      link="right_ankle_pitch_link" />
-    <axis
-      xyz="0 1 0" />
-  </joint>
+    <child
+      link="right_ankle_pitch_link" />
+    <axis
+      xyz="0 1 0" />
+    <limit
+      lower="0"
+      upper="0"
+      effort="0"
+      velocity="0" />
+  </joint>
   <link
     name="right_foot_link">
     <inertial>
@@ -467,7 +476,7 @@
         rpy="0 0 0" />
       <geometry>
         <mesh
-          filename="package://guguji/meshes/right_foot_link.STL" />
+          filename="package://guguji_ros2/meshes/right_foot_link.STL" />
       </geometry>
       <material
         name="">
@@ -481,7 +490,7 @@
         rpy="0 0 0" />
       <geometry>
         <mesh
-          filename="package://guguji/meshes/right_foot_link.STL" />
+          filename="package://guguji_ros2/meshes/right_foot_link.STL" />
       </geometry>
     </collision>
   </link>
@@ -503,4 +512,4 @@
       effort="0"
       velocity="0" />
   </joint>
-</robot>
+</robot>

+ 11 - 0
guguji_ros2_ws/src/guguji_ros2/worlds/empty.world

@@ -0,0 +1,11 @@
+<?xml version="1.0" ?>
+<sdf version="1.6">
+  <world name="default">
+    <include>
+      <uri>model://ground_plane</uri>
+    </include>
+    <include>
+      <uri>model://sun</uri>
+    </include>
+  </world>
+</sdf>

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません