Spawn Atlas into a custom world - modulabs/gazebo-tutorial GitHub Wiki

Overview

์ด๋ฒˆ ์žฅ์—์„œ๋Š” Gazebo world๋ฅผ ์–ด๋–ป๊ฒŒ ์ƒ์„ฑํ•˜๊ณ  ๊ฑฐ๊ธฐ์— Atlas ๋กœ๋ด‡์„ ์ถ”๊ฐ€ ํ•  ์ˆ˜ ์žˆ๋Š”์ง€์— ๋Œ€ํ•ด์„œ ์„ค๋ช…ํ•ฉ๋‹ˆ๋‹ค.

Create package

๋‹ค์Œ๊ณผ ๊ฐ™์ด ํŒจํ‚ค์ง€๋ฅผ ์ƒ์„ฑํ•œ๋‹ค.

cd ~/catkin_ws/src
catkin_create_pkg world_create_tutorial drcsim_gazebo
cd world_create_tutorial
mkdir worlds launch

์ด์ œ ๋‹ค์Œ์˜ launch ํŒŒ์ผ here์„ ๋‹ค์šด ๋ฐ›์•„์„œ ~/catkin_ws/src/world_create_tutorial/launch/atlas.launch ์ด ๊ฒฝ๋กœ์— ์ €์žฅ์„ ํ•œ๋‹ค.

<launch>

  <arg name="gzname" default="gazebo"/>
  <arg name="gzworld" default="$(find world_create_tutorial)/worlds/myworld.world"/>
  <arg name="hand_suffix" default=""/>
  <arg name="extra_gazebo_args" default="-q" />
  <arg name="model_args" default="" />
  <arg name="inertia_args" default="" /> <!-- _with_v1_inertia -->

  <param name="/atlas/time_to_unpin" type="double" value="1.0"/>
  <param name="/atlas/startup_mode" type="string" value="bdi_stand"/>

  <!-- start gazebo with the Atlas -->
  <include file="$(find drcsim_gazebo)/launch/atlas_no_controllers.launch">
    <arg name="gzname" value="$(arg gzname)"/>
    <arg name="gzworld" value="$(arg gzworld)"/>
    <arg name="extra_gazebo_args" value="$(arg extra_gazebo_args)"/>
  </include>

  <!-- to trigger synchronization delay, set
       atlas_msgs::AtlasCommand::desired_controller_period_ms to non-zero -->
  <param name="/atlas/delay_window_size" type="double" value="5.0"/>
  <param name="/atlas/delay_max_per_window" type="double" value="0.25"/>
  <param name="/atlas/delay_max_per_step" type="double" value="0.025"/>

  <!-- Robot Description -->
  <param name="robot_description" command="$(find xacro)/xacro.py '$(find atlas_description)/robots/atlas$(arg model_args)$(arg inertia_args)$(arg hand_suffix).urdf.xacro'" />
  <param name="robot_initial_pose/x"     value="0" type="double"/>
  <param name="robot_initial_pose/y"     value="0" type="double"/>
  <param name="robot_initial_pose/z"     value="0.90" type="double"/>
  <param name="robot_initial_pose/roll"  value="0" type="double"/>
  <param name="robot_initial_pose/pitch" value="0" type="double"/>
  <param name="robot_initial_pose/yaw"   value="0" type="double"/>

  <include file="$(find drcsim_gazebo)/launch/atlas$(arg hand_suffix)_bringup.launch">
    <arg name="model_args" value="$(arg model_args)"/>
  </include>
</launch>

๋งŒ์•ฝ ๋‹น์‹  Atlas ๋กœ๋ด‡์˜ ์ดˆ๊ธฐ ์œ„์น˜๋ฅผ ๋‹ค๋ฅธ ์œ„์น˜์— ๋†“๊ธฐ๋ฅผ ์›ํ•œ๋‹ค๋ฉด robot_initial_pose/x ์™€ robot_initial_pose/y๋ฅผ ๋ฐ”๊พธ๋ฉด ๋œ๋‹ค.

Modify an empty world

๊ฐ€์ œ๋ณด๋ฅผ ์‹คํ–‰ํ•˜์—ฌ๋ผ.

gazebo

๋‹น์‹ ์€ ๋นˆ ์„ธ๊ณ„๋ฅผ ๋ณผ ์ˆ˜ ์žˆ๋‹ค.

์ด์ œ ํˆด๋ฐ”์—์„œ์˜ ์•„์ด์ฝ˜๋“ค์„ ํ™œ์šฉํ•˜์—ฌ ๊ฐ„๋‹จํ•œ ํ˜•ํƒœ์˜ ๋ชจ๋ธ๋“ค์„ ์ถ”๊ฐ€ ํ•ด๋ณด์•„๋ผ. ๋ฐ•์Šค์™€ ๊ตฌ ์‹ค๋ฆฐ๋”๋ฅผ ์ถ”๊ฐ€ ํ•  ์ˆ˜ ์žˆ๋‹ค.

"Insert Models" tab์— ์žˆ๋Š” ํ™˜๊ฒฝ๋“ค ๋˜ํ•œ ์ถ”๊ฐ€ ํ•  ์ˆ˜ ์žˆ๋‹ค.

์œ„์˜ ์ž‘์—…์„ ๋๋‚ด๊ณ  world๋ฅผ ์ €์žฅํ•˜๊ธฐ ์œ„ํ•ด์„œ "File"์— "Save World As"๋ฅผ ํด๋ฆญํ•˜์—ฌ๋ผ. ํ˜น์€ ๋‹จ์ถ•ํ‚ค CTRL-SHIFT-S๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋œ๋‹ค. ์ดํ›„ `~/catkin_ws/src/world_create_tutorial/worlds'์— 'myworld.world'์˜ ์ด๋ฆ„์œผ๋กœ ์ €์žฅํ•˜๊ณ  Gazebo๋ฅผ ๋น ์ ธ ๋‚˜์˜ค๋ฉด ๋œ๋‹ค.

Add Atlas to the .world

์ด์ œ 'myworld.world'๋ฅผ ์—ด๊ณ  ๋‹ค์Œ์˜ ๋‚ด์šฉ์„ ํŒŒ์ผ์— ์‚ฝ์ž…ํ•˜๊ณ  ์ €์žฅํ•˜์—ฌ๋ผ. ์ด๋•Œ <world></world> tag ๋‚ด๋ถ€์— ์‚ฝ์ž… ํ•˜์—ฌ์•ผ ํ•œ๋‹ค.

<plugin filename="libVRCPlugin.so" name="vrc_plugin">
  <atlas>
    <model_name>atlas</model_name>
    <pin_link>utorso</pin_link>
  </atlas>
  <drc_vehicle>
    <model_name>golf_cart</model_name>
    <seat_link>chassis</seat_link>
  </drc_vehicle>
  <drc_fire_hose>
    <fire_hose_model>fire_hose</fire_hose_model>
    <coupling_link>coupling</coupling_link>
    <standpipe_model>standpipe</standpipe_model>
    <spout_link>standpipe</spout_link>
    <thread_pitch>-1000</thread_pitch>
    <coupling_relative_pose>1.17038e-05 -0.125623 0.35 -0.0412152 -1.57078 1.61199</coupling_relative_pose>
  </drc_fire_hose>
</plugin>

์ด plugin ์š”์†Œ๋Š” Atlas ๋กœ๋ด‡์„ ๋ถˆ๋Ÿฌ์˜จ๋‹ค. VRCPlugin์€ ๋กœ๋ด‡์˜ ์ž์„ธ ์ปจํŠธ๋กค๋Ÿฌ, ์ปจํŠธ๋กค๋Ÿฌ ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ๊ด€๋ฆฌํ•œ๋‹ค.

๋‹ค์Œ์„ ํ†ตํ•ด ์ž๊ธฐ๊ฐ€ ๋งŒ๋“  ์ƒˆ๋กœ์šด world์— Atlas ๋กœ๋ด‡์„ ๋ถˆ๋Ÿฌ์˜ค๊ฒŒ ๋œ๋‹ค.

roslaunch world_create_tutorial atlas.launch

โš ๏ธ **GitHub.com Fallback** โš ๏ธ