๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

์นดํ…Œ๊ณ ๋ฆฌ ์—†์Œ

14. ์œ ์šฉํ•œ ROS ํˆด ์†Œ๊ฐœ

๐ŸŒŽ

14. ์œ ์šฉํ•œ ROS ํˆด ์†Œ๊ฐœ

์ด๋ฒˆ ์‹œ๊ฐ„์—๋Š” rviz, rqt์™€ ๊ฐ™์ด ROS์—์„œ ์ œ๊ณตํ•˜๋Š” ์—ฌ๋Ÿฌ ํˆด๋“ค์„ ์†Œ๊ฐœํ•˜๊ณ ์ž ํ•ฉ๋‹ˆ๋‹ค.

๋‹ค์‹œ ๋Œ์•„์˜จ Gazebo


$ roslaunch gcamp_gazebo gazebo_world.launch

์ด๋ฒˆ์—๋Š” gazebo๊ฐ€ ์•„๋‹Œ, rviz๋ฅผ ์ง‘์ค‘์ ์œผ๋กœ ์‚ดํŽด๋ด…์‹œ๋‹ค!! ๐Ÿ™ˆ

view ์ „ํ™˜


rviz๋Š” gazebo์™€๋Š” ๋‹ค๋ฅด๊ฒŒ ๋งˆ์šฐ์Šค ํœ  ํด๋ฆญ์œผ๋กœ ํ‰ํ–‰์ด๋™, ์™ผ์ชฝ ํด๋ฆญ์œผ๋กœ ํšŒ์ „์ด๋™์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

๋”๋ถˆ์–ด, ์šฐ์ธก ์ƒ๋‹จ์˜ view๋ฅผ ํ†ตํ•ด ์‹œ์ ์„ ๋ฐ”๊ฟ€ ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

Orbit์ด ๊ธฐ๋ณธ์ด๋ฉฐ, ์ œ ๊ฒฝํ—˜์—์„œ๋Š” TopDownOrtho ์ •๋„๊ฐ€ ์“ฐ์ด๋Š” ๊ฒƒ์„ ๋ณด์•˜์Šต๋‹ˆ๋‹ค.

Create, Add Visualization


์ขŒ์ธก Displays ํŒจ๋„์„ ๋ณด์‹œ๋ฉด ์—ฌ๋Ÿฌ ํ•ญ๋ชฉ๋“ค์ด ๋ณด์ด์ง€์š”?

์ฒดํฌ๋ฐ•์Šค๋“ค์„ ํ† ๊ธ€ํ•˜๋ฉด์„œ ์–ด๋–ค ํ•ญ๋ชฉ์ธ์ง€ ์‚ดํŽด๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

  • RobotModel
  • LaserScan
  • PoseArray
  • Camera

  • ์ด๋Ÿฐ ํ† ๊ธ€ ๊ธฐํ˜ธ๋ฅผ ํด๋ฆญํ•˜์—ฌ ์ˆจ๊ฒจ์ง„ ํ•ญ๋ชฉ๋“ค์„ ์‚ดํŽด๋ด…๋‹ˆ๋‹ค.

    ์ต์ˆ™ํ•œ ๊ฒƒ์ด ๋ณด์ด๋Š”๋ฐ์š” Topic /scan?!!

    • ๋งž์Šต๋‹ˆ๋‹ค. publish ๋˜๊ณ  ์žˆ๋Š” lidar ๋ฐ์ดํ„ฐ ํ† ํ”ฝ ์ด๋ฆ„์ž…๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ๋ฐ์ดํ„ฐ ํ˜•์‹๊ณผ ํ† ํ”ฝ ์ด๋ฆ„์ด ๋งคํ•‘๋˜์–ด ์‹œ๊ฐํ™”ํ•ด์ฃผ๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.
    • ํ•ด๋‹น ํ˜•์‹์˜ ํ† ํ”ฝ์ด ๋‹ค์ˆ˜ ์กด์žฌํ•œ๋‹ค๋ฉด, ์•„๋ž˜ ๋ฐฉํ–ฅ ํ™”์‚ดํ‘œ๋ฅผ ๋ˆŒ๋Ÿฌ ํ† ํ”ฝ๊ฐ„ ์ „ํ™˜์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

LaserScan์˜ Size ์†์„ฑ์„ ๋ฐ”๊ฟ”๋ณด์„ธ์š”!!

์•„๋ž˜์™€ ๊ฐ™์ด point๋“ค์˜ ํฌ๊ธฐ๊ฐ€ ๋ฐ”๋€Œ๋Š” ๊ฒƒ์ด ๋ณด์ž…๋‹ˆ๋‹ค.

์ƒˆ๋กœ์šด display ์ถ”๊ฐ€


์œ„์™€ ๊ฐ™์€ ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ display๋ฅผ ์ถ”๊ฐ€, ์ œ๊ฑฐ, ๋ณต์‚ฌ, ์ด๋ฆ„ ๋ณ€๊ฒฝ์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

odom ์ถ”๊ฐ€ํ•ด๋ณด๊ธฐ

  • add โ‡’ by topic โ‡’ odom โ‡’ odometry ์ˆœ์œผ๋กœ ํ† ํ”ฝ์„ ์„ ํƒํ•ด์„œ ์ถ”๊ฐ€ํ•ด ๋ณด์„ธ์š” ๐Ÿ˜‰

๋นจ๊ฐ„ ํ™”์‚ดํ‘œ๊ฐ€ ๋ฒกํ„ฐ๋ฅผ ์˜๋ฏธํ•˜๋Š”๋ฐ์š”, ๋กœ๋ด‡์˜ ์œ„์น˜์™€ ๋ฐฉํ–ฅ์„ ํ‘œํ˜„ํ•œ๋‹ค๊ณ  ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋…ธ๋ž€ ๋ถ€๋ถ„์€ covariance๋กœ odom์˜ ์‹ ๋ขฐ๋„๋ฅผ ํ‘œ์‹œํ•œ๋‹ค๊ณ  ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ž‘์„์ˆ˜๋ก ์ข‹์€ ๊ฐ’์ž…๋‹ˆ๋‹ค.

๐Ÿ’ก
remove๋กœ odom display๋ฅผ ์ œ๊ฑฐํ•ด๋ณด์„ธ์š”

rviz์—๋Š” By display type / By Topic์˜ ๋‘๊ฐ€์ง€ add option์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

๐Ÿ’ก
display type์—์„œ tf๋ฅผ ์ถ”๊ฐ€ํ•ด ๋ณด์„ธ์š”!

tf๋Š” tranformation์˜ ์•ฝ์ž๋กœ ๋กœ๋ด‡์˜ ๊ฐ ๋ถ€๋ถ„๋“ค์ด ์—ฐ๊ฒฐ๋œ joint๋“ค์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ต๋‹ˆ๋‹ค.

roslaunch๋กœ rviz ์‹คํ–‰ํ•˜๊ธฐ


rviz ๋˜ํ•œ ros node์ž…๋‹ˆ๋‹ค. ๊ทธ๋ ‡๊ธฐ์— ๋‹ค์Œ๊ณผ ๊ฐ™์ด rosnode list ์‹คํ–‰ ์‹œ ์กฐํšŒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

$ rosnode list
/gazebo
/gazebo_gui
/joint_state_publisher
/robot_state_publisher
/rosout
/rviz_1611581303228680334

๋‹น์—ฐํžˆ ๋‹ค์Œ๊ณผ ๊ฐ™์ด rosrun์œผ๋กœ ์‹คํ–‰ ์‹œํ‚ฌ ์ˆ˜๋„ ์žˆ์ง€์š”, ์ถ”๊ฐ€์ ์œผ๋กœ rviz๋ผ๊ณ ๋งŒ ์ž…๋ ฅํ•ด๋„ ์‹คํ–‰๋ฉ๋‹ˆ๋‹ค.

$ rosrun rviz rviz
or
$ rviz

์ฒ˜์Œ ์˜ˆ์ œ์—์„œ roslaunch ์‹คํ–‰ ์‹œ rviz๋„ ๊ฐ™์ด ์‹คํ–‰๋˜์—ˆ๋Š”๋ฐ์š”, ๋‹ค์Œ๊ณผ ๊ฐ™์ด launch ํŒŒ์ผ์— ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์—ฌ๊ธฐ ๋“ค์–ด๊ฐ€๋Š” .rviz ํŒŒ์ผ์€ ์„ค์ •์„ ๋ชจ๋‘ ์ €์žฅํ•œ ํŒŒ์ผ์ž…๋‹ˆ๋‹ค.

	<!-- Spawn My Robot -->
  <node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen" 
        args="-urdf -param robot_description -model $(arg model_name) 
              -x $(arg x) -y $(arg y) -z $(arg z)
              -R $(arg roll) -P $(arg pitch) -Y $(arg yaw)"/>

  <!--launch rviz-->
  <node pkg="rviz" type="rviz" name="rviz" args="-d $(arg dollar)$(arg path)/rviz/tinybot.rviz"/>

</launch>

  • tinybot.rviz (yaml์˜ ํ˜•์‹์„ ๊ฐ–์Šต๋‹ˆ๋‹ค.)
Panels:
  - Class: rviz/Displays
    Help Height: 78
    Name: Displays
    Property Tree Widget:
      Expanded:
        - /Global Options1
        - /Status1
      Splitter Ratio: 0.5
    Tree Height: 155
  - Class: rviz/Selection
    Name: Selection
  - Class: rviz/Tool Properties
    Expanded:
      - /2D Pose Estimate1
      - /2D Nav Goal1
      - /Publish Point1
    Name: Tool Properties
    Splitter Ratio: 0.5886790156364441

rqt


rqt๋Š” ๋‹ค์–‘ํ•œ gui ํ”„๋กœ๊ทธ๋žจ๋“ค์˜ ์ง‘ํ•ฉ์ž…๋‹ˆ๋‹ค. ๊ฐ€์žฅ ๋จผ์ €, ์ด์ „์— ์‚ฌ์šฉํ•ด๋ณด์•˜๋˜ rqt_graph๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.

์ด๋ฒˆ์—๋Š” ๊ทธ๋ƒฅ rqt๋ฅผ ์ž…๋ ฅํ•ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

๐Ÿ’ก
์ €์™€ ๊ฐ™์€ ํ™”๋ฉด์ด ๋‚˜์˜ค์ง€ ์•Š์„ ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

์ƒ๋‹จ์— pulgins๋ฅผ ์„ ํƒํ•˜๋ฉด, ์ˆ˜๋งŽ์€ rqt ๋„๊ตฌ๋“ค์ด ๋ณด์ด๋Š”๋ฐ์š”. ๋ชจ๋‘ ๋‹ค๋ฃจ์ง€๋Š” ์•Š๊ณ , topic publisher ์™€ topic monitor์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

๊ฐ•์˜๋ฅผ ๋”ฐ๋ผ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ํ™”๋ฉด์„ ๊ตฌ์„ฑํ•ด ์ฃผ์„ธ์š”!

  • pulgins โ‡’ topics โ‡’ Message Publisher
  • pulgins โ‡’ topics โ‡’ Topic Monitor

์ฝ”๋”ฉ ์—†์ด Message Publisher๋กœ cmd_vel์„ ์ง€์ •ํ•˜์—ฌ publish ํ•ด๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค!!

๐Ÿ’ก
์ฒดํฌ๋ฐ•์Šค๋ฅผ ๊ผญ ๋ˆŒ๋Ÿฌ์ฃผ์…”์•ผ ํ•ฉ๋‹ˆ๋‹ค.

์ด์ œ ์‹œ๋ฎฌ๋ ˆ์ด์…˜์„ ๊บผ๋ณด๊ณ , topic Monitor๋ฅผ ์‚ดํ”ผ๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

์ด๋ ‡๊ฒŒ ์ฝ”๋”ฉ ์—†์ด rqt๋ฅผ ์‚ฌ์šฉํ•ด์„œ topic publish, monitoring์„ ํ•  ์ˆ˜ ์žˆ๋‹ต๋‹ˆ๋‹ค ๐Ÿ˜‰

rqt_plot


์ˆ˜์น˜ ๋ฐ์ดํ„ฐ๋ฅผ ๊ทธ๋ž˜ํ”„๋กœ ๋ณด๊ณ ์‹ถ์€ ๊ฒฝ์šฐ rqt_plot์ด ์œ ์šฉํ•˜๊ฒŒ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.

plugin โ‡’ visualization โ‡’ plot

/cmd_vel/linear๋ฅผ ๊ฐ€์ง€๊ณ  ๊ทธ๋ž˜ํ”„๋ฅผ ๊ทธ๋ ค๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. ๐Ÿ˜‰

๊ฐ€๋กœ, ์„ธ๋กœ ๋ฒ”์œ„๋ฅผ ์ž˜ ์ง€์ •ํ•ด์ฃผ์–ด์•ผ ๊ทธ๋ž˜ํ”„๊ฐ€ ๋ณด๊ธฐ ์‰ฝ์Šต๋‹ˆ๋‹ค. ์ด๊ฒƒ์€ Figure Option์—์„œ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๊ทธ ๋ฐ–์—๋„ ์ˆ˜๋งŽ์€ rqt ๋„๊ตฌ๋“ค์ด ์žˆ๋Š”๋ฐ์š”, ๋ชจ๋‘ ์‚ดํŽด๋ณด๋Š” ๋Œ€์‹  ๋งํฌ๋กœ ๋Œ€์ฒดํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

Wiki
New in Groovy (also builds against fuerte) rqt is a software framework of ROS that implements the various GUI tools in the form of plugins. One can run all the existing GUI tools as dockable windows within rqt!
http://wiki.ros.org/rqt

์œ ์šฉํ•œ ํˆด๋“ค์ด ์ •๋ง ๋งŽ์€๋ฐ, ๋ชจ๋‘ ์†Œ๊ฐœ์‹œ์ผœ๋“œ๋ฆฌ์ง€ ๋ชปํ•ด์„œ ์•„์‰ฌ์šธ ์ •๋„๋„ค์š” ๐Ÿ˜ข ์•ž์œผ๋กœ ์˜คํ”ˆ์†Œ์Šค ํŒจํ‚ค์ง€๋“ค์„ ๋ถ„์„ํ•˜๋ฉด์„œ, rqt์˜ ๊ฐ•๋ ฅํ•œ ์‹œ๊ฐํ™” ๋„๊ตฌ๋“ค์„ ์ ๊ทน ์‚ฌ์šฉํ•˜๊ธฐ์‹ค ๊ถŒ์žฅํ•ฉ๋‹ˆ๋‹ค.