ROS2 URDF rb10-1300
2024. 11. 8. 14:21ㆍROS2/URDF
launch 파일(gt3armsim.launch.py)
import os
from launch_ros.actions import Node
from launch import LaunchDescription
from launch.substitutions import Command
from launch.actions import ExecuteProcess
from ament_index_python.packages import get_package_share_directory
def generate_launch_description():
pkg_path = os.path.join(get_package_share_directory("urdf_tutorial"))
xacro_file = os.path.join(pkg_path, "urdf", "gt3control.xacro")
# Robot State Publisher
robot_state_publisher = Node(package ='robot_state_publisher',
executable ='robot_state_publisher',
name ='robot_state_publisher',
output ='both',
parameters =[{'robot_description': Command(['xacro', ' ', xacro_file])
}])
# Spawn the robot in Gazebo
spawn_entity_robot = Node(package ='gazebo_ros',
executable ='spawn_entity.py',
arguments = ["-topic", "robot_description", "-entity", "with_robot"],
output ='screen')
# Gazebo
world_file_name = 'my_empty_world.world'
world = os.path.join(get_package_share_directory('urdf_tutorial'), 'worlds', world_file_name)
gazebo_node = ExecuteProcess(cmd=['gazebo', '--verbose', world,'-s', 'libgazebo_ros_factory.so'], output='screen')
# load and START the controllers in launch file
load_joint_state_broadcaster = ExecuteProcess(
cmd=['ros2', 'control', 'load_controller', '--set-state', 'start','joint_state_broadcaster'],
output='screen')
load_joint_trajectory_controller = ExecuteProcess(
cmd=['ros2', 'control', 'load_controller', '--set-state', 'start', 'joint_trajectory_controller'],
output='screen')
return LaunchDescription([robot_state_publisher, spawn_entity_robot, gazebo_node, load_joint_state_broadcaster, load_joint_trajectory_controller ])
xacro 파일(rb10_1300.xacro)
<?xml version="1.0"?>
<robot xmlns:xacro="http://ros.org/wiki/xacro" name="rb10_1300e">
<!-- MACROS -->
<xacro:include filename="macros.xacro"/>
<xacro:include filename="$(find urdf_tutorial)/urdf/macro.gazebo_config_control.xacro" />
<xacro:include filename="$(find urdf_tutorial)/urdf/macro.transmission.xacro" />
<xacro:include filename="$(find urdf_tutorial)/urdf/macro.internal_config.xacro" />
<!-- Link Definitions -->
<link name="world"/>
<link name="base">
<visual>
<geometry>
<mesh filename="file://$(find urdf_tutorial)/visual/link0.dae"/>
</geometry>
</visual>
<collision>
<geometry>
<mesh filename="file://$(find urdf_tutorial)/collision/link0.stl"/>
</geometry>
</collision>
<inertial>
<origin rpy="0 0 0" xyz="0 0 0"/>
<mass value="1.0"/>
<inertia ixx="0.00166667" ixy="0.0" ixz="0.0" iyy="0.00166667" iyz="0.0" izz="0.00166667"/>
</inertial>
</link>
<link name="link1">
<visual>
<geometry>
<mesh filename="file://$(find urdf_tutorial)/visual/link1.dae"/>
</geometry>
</visual>
<collision>
<geometry>
<mesh filename="file://$(find urdf_tutorial)/collision/link1.stl"/>
</geometry>
</collision>
<inertial>
<origin rpy="0 0 0" xyz="0.000021 -0.007855 -0.042537"/>
<mass value="8.366"/>
<inertia ixx="0.027403652" ixy="-0.000005926" ixz="-0.000010119" iyy="0.027770573" iyz="0.003030512" izz="0.026140211"/>
</inertial>
</link>
<link name="link2">
<visual>
<geometry>
<mesh filename="file://$(find urdf_tutorial)/visual/link2.dae"/>
</geometry>
</visual>
<collision>
<geometry>
<mesh filename="file://$(find urdf_tutorial)/collision/link2.stl"/>
</geometry>
</collision>
<inertial>
<origin rpy="0 0 0" xyz="-0.000013 -0.155462 0.225241"/>
<mass value="15.61"/>
<inertia ixx="1.140650644" ixy="-0.000013042" ixz="-0.000067084" iyy="1.134398623" iyz="0.024507884" izz="0.050849068"/>
</inertial>
</link>
<link name="link3">
<visual>
<geometry>
<mesh filename="file://$(find urdf_tutorial)/visual/link3.dae"/>
</geometry>
</visual>
<collision>
<geometry>
<mesh filename="file://$(find urdf_tutorial)/collision/link3.stl"/>
</geometry>
</collision>
<inertial>
<origin rpy="0 0 0" xyz="-0.000048 -0.013885 0.325013"/>
<mass value="5.69"/>
<inertia ixx="0.312033029" ixy="0.000009298" ixz="0.000011690" iyy="0.311287646" iyz="0.005331552" izz="0.011397824"/>
</inertial>
</link>
<link name="link4">
<visual>
<geometry>
<mesh filename="file://$(find urdf_tutorial)/visual/link4.dae"/>
</geometry>
</visual>
<collision>
<geometry>
<mesh filename="file://$(find urdf_tutorial)/collision/link4.stl"/>
</geometry>
</collision>
<inertial>
<origin rpy="0 0 0" xyz="0.000093 -0.113949 0.026461"/>
<mass value="2.062"/>
<inertia ixx="0.0027111" ixy="-0.000008022" ixz="0.000011208" iyy="0.002715407" iyz="0.000144243" izz="0.002157043"/>
</inertial>
</link>
<link name="link5">
<visual>
<geometry>
<mesh filename="file://$(find urdf_tutorial)/visual/link5.dae"/>
</geometry>
</visual>
<collision>
<geometry>
<mesh filename="file://$(find urdf_tutorial)/collision/link5.stl"/>
</geometry>
</collision>
<inertial>
<origin rpy="0 0 0" xyz="-0.000093 -0.026434 -0.003233"/>
<mass value="2.061"/>
<inertia ixx="0.002706437" ixy="0.000011205" ixz="-0.000008016" iyy="0.002153592" iyz="0.000141528" izz="0.002712272"/>
</inertial>
</link>
<link name="link6">
<visual>
<geometry>
<mesh filename="file://$(find urdf_tutorial)/visual/link6.dae"/>
</geometry>
</visual>
<collision>
<geometry>
<mesh filename="file://$(find urdf_tutorial)/collision/link6.stl"/>
</geometry>
</collision>
<inertial>
<origin rpy="0 0 0" xyz="-0.000210 -0.092540 -0.000292"/>
<mass value="0.406"/>
<inertia ixx="0.000345314" ixy="0.000000573" ixz="0.000000661" iyy="0.000532873" iyz="-0.000000054" izz="0.000340021"/>
</inertial>
</link>
<link name="tcp"/>
<!-- Joint Definitions -->
<joint name="gt3" type="fixed">
<parent link="world"/>
<child link="base"/>
<origin rpy="0 0 0" xyz="0 0 0"/>
</joint>
<joint name="joint1" type="revolute">
<origin rpy="0 0 0" xyz="0 0 0.197"/>
<parent link="base"/>
<child link="link1"/>
<axis xyz="0 0 1"/>
<limit effort="10" lower="-3.14" upper="3.14" velocity="3.14"/>
<dynamics damping="60.0" friction="4.0" />
</joint>
<joint name="joint2" type="revolute">
<origin rpy="0 0 0" xyz="0 -0.1875 0"/>
<parent link="link1"/>
<child link="link2"/>
<axis xyz="0 1 0"/>
<limit effort="10" lower="-3.14" upper="3.14" velocity="3.14"/>
<dynamics damping="50.0" friction="3.0" />
</joint>
<joint name="joint3" type="revolute">
<origin rpy="0 0 0" xyz="0 0 0.6127"/>
<parent link="link2"/>
<child link="link3"/>
<axis xyz="0 1 0"/>
<limit effort="10" lower="-3.14" upper="3.14" velocity="3.14"/>
<dynamics damping="40.0" friction="2.0"/>
</joint>
<joint name="joint4" type="revolute">
<origin rpy="0 0 0" xyz="0 0.15 0.57015"/>
<parent link="link3"/>
<child link="link4"/>
<axis xyz="0 1 0"/>
<limit effort="10" lower="-3.14" upper="3.14" velocity="3.14"/>
<dynamics damping="20.0" friction="1.0" />
</joint>
<joint name="joint5" type="revolute">
<origin rpy="0 0 0" xyz="0 -0.11715 0"/>
<parent link="link4"/>
<child link="link5"/>
<axis xyz="0 0 1"/>
<limit effort="10" lower="-3.14" upper="3.14" velocity="3.14"/>
<dynamics damping="10.0" friction="1.0" />
</joint>
<joint name="joint6" type="revolute">
<origin rpy="0 0 0" xyz="0 0 0.11715"/>
<parent link="link5"/>
<child link="link6"/>
<axis xyz="0 1 0"/>
<limit effort="10" lower="-3.14" upper="3.14" velocity="3.14"/>
<dynamics damping="10.0" friction="1.0" />
</joint>
<joint name="tcp_joint" type="fixed">
<origin rpy="0 0 0" xyz="0 -0.1153 0"/>
<parent link="link6"/>
<child link="tcp"/>
</joint>
<xacro:config_ctr_gazebo />
<xacro:dsr_transmission />
<xacro:dsr_config_coeff />
</robot>
실행
cd ~/ch2_ws
colcon build --symlink-install
source install/setup.bash
'ROS2 > URDF' 카테고리의 다른 글
ROS2 URDF doosan robot arm (0) | 2024.11.08 |
---|---|
ROS2 URDF(4) (0) | 2024.10.04 |
ROS2 URDF(3) (0) | 2024.09.30 |
ROS2 6일차(2) URDF (0) | 2024.09.27 |
ROS2 6일차(1) URDF (0) | 2024.09.27 |