Skip to content

Instantly share code, notes, and snippets.

@RyodoTanaka
Last active Sep 18, 2017
Embed
What would you like to do?
Gazebo + ROS で自分だけのロボットをつくる 4.URDFファイルをつくる ref: http://qiita.com/RyodoTanaka/items/174e82f06b10f9885265
<launch>
<arg name="model" />
<arg name="gui" default="False" />
<param name="robot_description" textfile="$(arg model)" />
<param name="use_gui" value="$(arg gui)"/>
<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_tutorial)/urdf.rviz" required="true" />
</launch>
<launch>
<!-- arguments -->
<arg name="model"/>
<arg name="gui" default="true" />
<!-- prameters -->
<param name="robot_description" command="$(find xacro)/xacro.py '$(arg model)'"/>
<param name="use_gui" value="$(arg gui)"/>
<!-- nodes -->
<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" />
</launch>
$ source <catkin_ws>/devel/setup.bash
$ roslaunch fourth_robot_description fourth_robot_description.launch
$ cd <catkin_ws>/src
$ catkin_create_pkg <robot_name>_description
$ cd <catkin_ws>/src/<robot_name>_description
$ mkdir mesh
$ mkdir urdf
$ mkdir robots
$ mkdir launch
test_robot_description
├── CMakeLists.txt
├── launch
├── meshes
├── package.xml
├── robots
└── urdf
test_robot_description
├── CMakeLists.txt
├── launch <- launchファイルを格納
├── meshes <- COLLADA or STLファイルを格納
├── package.xml
├── robots <- Xacroを使う際に、各マクロを組み合わせたXacroファイルを格納
└── urdf <- URDF or Xacroファイルを格納
$ roslaunch urdf_tutorial display.launch model:='$(find <robot_name>_description)/urdf/robot_name.urdf'
fourth_robot_description
├── CMakeLists.txt
├── launch
│   └── fourth_robot_description.launch <- display用のlaunchファイル
├── meshes <- CADデータを格納
│   ├── DAE <- COLLADAファイルを格納
│   └── STL <- STLファイルを格納
├── package.xml
├── robots
│   └── fourth_robot.urdf.xacro <- ロボットモデルのXacroファイル
└── urdf
├── common.xacro <- 円周率など、共通定義の記述用Xacro
├── base <- 胴体部分のXacroファイルを格納
│   ├── base.gazebo.xacro <- 胴体部分のGazeboに関する記述用Xacro
│   └── base.urdf.xacro <- 胴体部分の基本的な記述用Xacro
├── sensors <- センサ部分のXacroファイルを格納
│   ├── gim30 ┓
│   │   └── gim30.urdf.xacro  ┃
│   ├── gps ┃
│   │   └── gps.urdf.xacro ┣━ 各種センサのXacro
│   └── lrf ┃
│   ├── lrf.gazebo.xacro ┃
│   └── lrf.urdf.xacro ┛
└── wheel <- 車輪部分のXacroファイルを格納
├── wheel.gazebo.xacro <- 車輪部分のGazeboに関する記述用Xacro
├── wheel.transmission.xacro <- 車輪部分のTransmissionに関する記述用Xacro
└── wheel.urdf.xacro <- 車輪部分の基本的な記述用Xacro
$ source <catkin_ws>/devel/setup.bash
$ rosrun xacro xacro.py <robot_name>.xacro -> <output>.urdf
<?xml version="1.0"?>
<robot name="minimum_robot">
<link name="Link1"/>
<joint name="Joint1" type="fixed">
<parent link="Link1"/>
<child link="Link2"/>
</joint>
<link name="Link2"/>
<joint name="Joint2" type="fixed">
<parent link="Link1"/>
<child link="Link3"/>
</joint>
<link name="Link3"/>
<joint name="Joint3" type="fixed">
<parent link="Link3"/>
<child link="Link4"/>
</joint>
<link name="Link4"/>
</robot>
<robot name="minimum_visual_robot">
<link name="base_footprint"/>
<joint name="base_link_joint" type="fixed">
<origin xyz="0 0 0.5"/>
<parent link="base_footprint"/>
<child link="base_link"/>
</joint>
<link name="base_link">
<visual>
<geometry>
<mesh filename="package://minimum_visual_robot/meshes/DAE/base/base_link.dae"/>
</geometry>
</visual>
</link>
</robot>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment