cd ~/catkin_ws/src/testbot_description/urdf
vim testbot_homework.urdf
urdf파일을 작성하고 아래의 코드를 실행시킨다.
$ roslaunch testbot_description testbot_homework.launch
roslaunch를 실행시킨 상황에서 새 터미널로 rviz를 실행함.
베이스 링크
실린터형으로 만들고 바닥에 반이 묻히는 것을 방지하기 위해 Yaw를 0.1 만큼 높여주었다.(원점이 length의 반절부에 있기 때문에)
<link name="base">
<visual>
<geometry>
<cylinder length="0.2" radius="0.7"/>
</geometry>
<origin rpy="0 0 0" xyz="0 0 0.1"/>
<material name="yellow">
<color rgba="1 1 0 1"/>
</material>
</visual>
<collision>
<geometry>
<cylinder length="0.2" radius="0.7"/>
</geometry>
<origin rpy="0 0 0" xyz="0 0 0.1"/>
</collision>
<inertial>
<mass value="1"/>
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial>
</link>
joint1
revolute와의 차이점을 찾기위해 continuous를 선택해서 만들었지만 큰 차이는 없었다.
<joint name="joint1" type="continuous">
<parent link="base"/>
<child link="link1"/>
<origin xyz="0 0 1" rpy="0 0 0"/>
<axis xyz="0 0 1"/>
<limit effort="30" lower="-2.617" upper="2.617" velocity="1.571"/>
</joint>
link1
원통형 링크1을 사용, 마찬가지로 yaw를 주었다.
<link name="link1">
<collision>
<origin xyz="0 0 0.7" rpy="0 0 0"/>
<geometry>
<cylinder length="3" radius="0.07"/>
</geometry>
</collision>
<visual>
<origin xyz="0 0 0.7" rpy="0 0 0"/>
<geometry>
<cylinder length="3" radius="0.15"/>
</geometry>
<material name="black"/>
</visual>
<inertial>
<origin xyz="0 0 0" rpy="0 0 0"/>
<mass value="1"/>
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
</inertial>
</link>
link1과 link2의 joint는 움직이지 않기를 바라여 fix를 사용했다.
<joint name="fixed" type="fixed">
<parent link="link1"/>
<child link="link2"/>
</joint>
link2
link2는 박스형이다.
박스의 형태를 잡는것과 약간 비대칭으로 만드는것을 안해보고서 수치만 넣으려니 애매했다.
위치때문에 수정을 조금 했음.
<link name="link2">
<collision>
<origin xyz="0.2 0 1" rpy="0 0 0"/>
<geometry>
<box size="1.2 0.7 0.3"/>
</geometry>
</collision>
<visual>
<origin xyz="0.2 0 1" rpy="0 0 0"/>
<geometry>
<box size="1.2 0.7 0.3"/>
</geometry>
<material name="orange"/>
</visual>
<inertial>
<origin xyz="0 0 0" rpy="0 0 0"/>
<mass value="1"/>
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
</inertial>
</link>
joint2
롤 피치 요의 개념을 항공에서 많이 배웠기에 다 아는내용이라고 생각을 했는데 혼란이 조금 있었다.
그리고 limit 설정을 할 때에도 수치와 RVis를 잘 보고 조절하도록 하자.
<joint name="joint2" type="prismatic">
<parent link="link2"/>
<child link="link3"/>
<origin xyz="0 0 0" rpy="0 0 0"/>
<axis xyz="1 0 0"/>
<limit effort="30" lower="-1.317" upper="1.687" velocity="1.571"/>
</joint>
link3
누워있는 원통형을 만드는게 많이 혼란스러웠다.
이해가 잘 안갔어서 그랬는지는 몰라도 link3에서 시간이 제일 많이 걸렸다.
<link name="link3">
<collision>
<origin xyz="0 0 1" rpy="0 1.57 0"/>
<geometry>
<cylinder length="2" radius="0.1"/>
</geometry>
</collision>
<visual>
<origin xyz="0 0 1" rpy= "0 1.57 0"/>
<geometry>
<cylinder length="2" radius="0.1"/>
</geometry>
<material name="red">
<color rgba="1 0 0 1"/>
</material>
</visual>
<inertial>
<origin xyz="0 0 0" rpy="0 0 0"/>
<mass value="1"/>
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
</inertial>
</link>
전체코드
<?xml version="1.0" ?>
<robot name="testbot">
<material name="black">
<color rgba="0.0 0.0 0.0 1.0"/>
</material>
<material name="orange">
<color rgba="1.0 0.4 0.0 1.0"/>
</material>
<link name="base">
<visual>
<geometry>
<cylinder length="0.2" radius="0.7"/>
</geometry>
<origin rpy="0 0 0" xyz="0 0 0.1"/>
<material name="yellow">
<color rgba="1 1 0 1"/>
</material>
</visual>
<collision>
<geometry>
<cylinder length="0.2" radius="0.7"/>
</geometry>
<origin rpy="0 0 0" xyz="0 0 0.1"/>
</collision>
<inertial>
<mass value="1"/>
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/> </inertial>
</link>
<joint name="joint1" type="continuous">
<parent link="base"/>
<child link="link1"/>
<origin xyz="0 0 1" rpy="0 0 0"/>
<axis xyz="0 0 1"/>
<limit effort="30" lower="-2.617" upper="2.617" velocity="1.571"/>
</joint>
<link name="link1">
<collision>
<origin xyz="0 0 0.7" rpy="0 0 0"/>
<geometry>
<cylinder length="3" radius="0.07"/>
</geometry>
</collision>
<visual>
<origin xyz="0 0 0.7" rpy="0 0 0"/>
<geometry>
<cylinder length="3" radius="0.15"/>
</geometry>
<material name="black"/>
</visual>
<inertial>
<origin xyz="0 0 0" rpy="0 0 0"/>
<mass value="1"/>
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
</inertial>
</link>
<joint name="fixed" type="fixed">
<parent link="link1"/>
<child link="link2"/>
</joint>
<link name="link2">
<collision>
<origin xyz="0.2 0 1" rpy="0 0 0"/>
<geometry>
<box size="1.2 0.7 0.3"/>
</geometry>
</collision>
<visual>
<origin xyz="0.2 0 1" rpy="0 0 0"/>
<geometry>
<box size="1.2 0.7 0.3"/>
</geometry>
<material name="orange"/>
</visual>
<inertial>
<origin xyz="0 0 0" rpy="0 0 0"/>
<mass value="1"/>
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
</inertial>
</link>
<joint name="joint2" type="prismatic">
<parent link="link2"/>
<child link="link3"/>
<origin xyz="0 0 0" rpy="0 0 0"/>
<axis xyz="1 0 0"/>
<limit effort="30" lower="-1.317" upper="1.687" velocity="1.571"/>
</joint>
<link name="link3">
<collision>
<origin xyz="0 0 1" rpy="0 1.57 0"/>
<geometry>
<cylinder length="2" radius="0.1"/>
</geometry>
</collision>
<visual>
<origin xyz="0 0 1" rpy= "0 1.57 0"/>
<geometry>
<cylinder length="2" radius="0.1"/>
</geometry>
<material name="red">
<color rgba="1 0 0 1"/>
</material>
</visual>
<inertial>
<origin xyz="0 0 0" rpy="0 0 0"/>
<mass value="1"/>
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
</inertial>
</link>
</robot>
urdf_to_graphiz testbot_homework.urdf
참고
http://wiki.ros.org/urdf/XML/link
'ROS(drone포함)' 카테고리의 다른 글
ROS topic 통신 (0) | 2021.06.15 |
---|---|
urdf를 이용하여 로봇청소기 만들기 (0) | 2021.06.04 |
Manipulator 모델링 (0) | 2021.06.03 |
Manipulator (0) | 2021.06.03 |
로봇의 활용 분야 (0) | 2021.06.02 |