๐ŸŽฎ

ROS URDF

Tags
ROS
ID matched
Created
Mar 30, 2023 12:37 PM
Last Updated
Last updated July 15, 2023
ย 
ย 

1. ๊ด€๋ จ ํŒจํ‚ค์ง€ ์„ค์น˜

sudo apt install liburdfdom-tools ros-melodic-joint-state-publisher-gui
ย 

2. ํŒจํ‚ค์ง€ ๋ฐ ์ž‘์—… ํด๋” ์ƒ์„ฑ

cd ~/${workspack_name}/src # cd ~/ros_ws/src catkin_create_pkg ${package_name} roscpp tf geometry_msgs urdf rviz xacro # catkin_create_pkg urdf_example roscpp tf geometry_msgs urdf rviz xacro cd ../ && catkin_make rospack find ${package_name} # rospack find urdf_example cd src/${package_name} # cd src/urdf_example mkdir urdf mkdir launch
ย 

3. urdf ํŒŒ์ผ ์ž‘์„ฑํ•˜๊ธฐ

  • cd urdf๋กœ ๊ฒฝ๋กœ๋ฅผ ์ด๋™ํ•œ๋‹ค
  • vi my_robot.urdf๋กœ ํŒŒ์ผ์„ ์˜คํ”ˆํ•œ ๋’ค, ์•„๋ž˜์˜ ๋‚ด์šฉ์„ ์ž‘์„ฑํ•œ๋‹ค
    • <robot name="test_robot"> <link name="link1" /> <link name="link2" /> <link name="link3" /> <link name="link4" /> <joint name="joint1" type="continuous"> <parent link="link1"/> <child link="link2"/> <origin xyz="5 3 0" rpy="0 0 0" /> <axis xyz="-0.9 0.15 0" /> </joint> <joint name="joint2" type="continuous"> <parent link="link1"/> <child link="link3"/> <origin xyz="-2 5 0" rpy="0 0 1.57" /> <axis xyz="-0.707 0.707 0" /> </joint> <joint name="joint3" type="continuous"> <parent link="link3"/> <child link="link4"/> <origin xyz="5 0 0" rpy="0 0 -1.57" /> <axis xyz="0.707 -0.707 0" /> </joint> </robot>
  • check_urdf my_robot.urdf๋กœ ํŒŒ์ผ ๋‚ด์šฉ์„ ๊ฒ€์ฆํ•œ๋‹ค
    • notion image
  • urdf_to_graphiz my_robot.urdf๋กœ pdf ํŒŒ์ผ์„ ์ƒ์„ฑํ•ด์„œ ๋‚ด์šฉ์„ ํ™•์ธํ•ด๋ณธ๋‹ค
    • notion image
      notion image
ย 
ย 

4. launch ํŒŒ์ผ ์ž‘์„ฑ ๋ฐ ์‹คํ–‰

  • cd ../launch ๊ฒฝ๋กœ๋กœ ์ด๋™ํ•œ๋‹ค
  • vi view_my_robot.launch๋กœ ํŒŒ์ผ์„ ์ƒ์„ฑํ•œ ๋’ค, ์•„๋ž˜์˜ ๋‚ด์šฉ์„ ์ž‘์„ฑํ•œ๋‹ค
    • <launch> <arg name="model" /> <param name="robot_description" textfile="$(find urdf_example)/urdf/my_robot.urdf" /> <param name="use_gui" value="true"/> <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" /> <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" /> <node name="rviz" pkg="rviz" type="rviz" args="-d $(find urdf_example)/urdf.rviz" required="True" /> </launch>
  • roslaunch urdf_example view_my_robot.launch๋กœ ์‹คํ–‰ํ•ด๋ณธ๋‹ค
    • notion image
ย 
ย 

5. RVIZ ์†์„ฑ ๋ณ€๊ฒฝ

  • Displays > Fixed Frame์„ map์—์„œ link4๋กœ ๋ณ€๊ฒฝํ•œ๋‹ค
    • notion image
  • RobotModel๊ณผ TF๋ฅผ ์ถ”๊ฐ€ํ•ด์ค€๋‹ค
    • notion image
      notion image
  • ์ž‘์—…์ด ์™„๋ฃŒ๋˜๋ฉด, link1, link2, link3, link4๊ฐ€ ํ™”๋ฉด์— ํ‘œ์ถœ๋œ๋‹ค
    • notion image
  • joint_state_publisher์˜ joint2์™€ joint3์˜ ๊ฐ’์„ ๋ณ€๊ฒฝํ•˜๋ฉด์„œ ์‹œ๋ฎฌ๋ ˆ์ดํ„ฐ๊ฐ€ ์›€์ง์ด๋Š”์ง€ ํ™•์ธํ•œ๋‹ค
    • notion image
ย 
ย 

6. ์ฐธ๊ณ