sphinxcontrib-ros紹介
第7回ROS勉強会@ドワンゴ
by otamachan
第7回ROS勉強会@ドワンゴ
by otamachan
(http://otamachan.github.io/slide-sphinxcontrib-ros/)
ドキュメント書いていたはずなのに、気づいたら、
- 音声認識で文書生成するプログラム書いてる
- Texのマクロいじってる
- Sphinxの拡張書いてる
ことが多々・・・
そんな私ですが、今日はROSのドキュメンテーションツールを紹介します。
すごいドキュメント
------------------
始めに
======
すごいドキュメントに関して記述します。
`リンク <http://www.ros.org>`_ を参考にしてください。
* リスト1
* リスト2
コード
======
.. code-block:: c
int main() {
printf("Hello World!\n");
}
参考文献
========
=========== ==================================
言語 本の名前
=========== ==================================
Ruby dRubyによる分散・Webプログラミング
Python 集合知プログラミング
=========== ==================================
SphinxでROSのドキュメンテーションをするための拡張
が書ける。
パッケージインストール
$ pip install sphinxcontrib-ros
設定ファイル(conf.py
)に追加
# 拡張の追加
extenstions += ['sphinxcontrib.ros']
# パッケージパスを指定
ros_base_path = ['../src']
シンタックスハイライト
======================
.. code-block:: rostype
# The joint trajectory to follow
trajectory_msgs/JointTrajectory trajectory
# Tolerances for the trajectory. If the measured joint values fall
# outside the tolerances the trajectory goal is aborted. Any
# tolerances that are not specified (by being omitted or set to 0) are
# set to the defaults for the action server (often taken from the
# parameter server).
# Tolerances applied to the joints as the trajectory is executed. If
# violated, the goal aborts with error_code set to
# PATH_TOLERANCE_VIOLATED.
JointTolerance[] path_tolerance
# To report success, the joints must be within goal_tolerance of the
# final trajectory value. The goal must be achieved by time the
# trajectory ends plus goal_time_tolerance. (goal_time_tolerance
# allows some leeway in time, so that the trajectory goal can still
# succeed even if the joints reach the goal some time after the
# precise end time of the trajectory).
#
# If the joints are not within goal_tolerance after "trajectory finish
# time" + goal_time_tolerance, the goal aborts with error_code set to
# GOAL_TOLERANCE_VIOLATED
JointTolerance[] goal_tolerance
すごいパッケージ
================
パッケージ概要
--------------
.. ros:package:: my_great_package
:version: 0.1.0
:author: Great Person
これはスゴイパッケージです。
こんな実装になっています。
他のセクション
--------------
実装は、 :ros:pkg:`my_great_package` を参考にしています。
<?xml version="1.0"?>
<package>
<name>my_great_package_auto</name>
<version>0.0.0</version>
<description>The is a great package</description>
<maintainer email="john@mail.com">John Smith</maintainer>
<license>BSD</license>
<url>http://google.com</url>
<author email="jane.doe@example.com">Jane Doe</author>
<build_depend>another_package</build_depend>
<buildtool_depend>package_x</buildtool_depend>
<run_depend>package_y</run_depend>
<test_depend>package_z</test_depend>
<export>
</export>
</package>
すごいパッケージ
================
パッケージ概要
--------------
.. ros:autopackage:: my_great_package_auto
他のセクション
--------------
実装は、 :ros:pkg:`my_great_package_auto` を参考にしています。
メッセージ一覧
==============
すごいメッセージ
----------------
.. ros:message:: my_great_package/GreatMessage
:field Header header: ヘッダ
:field float64 x: x座標
すごいメッセージです。
すごいアクション
----------------
.. ros:action:: my_great_package/GreatAction
# Message Description
Header header # header
float32 x # x position
float32 y # y position
my_great_package/GreatMessage field # great field
メッセージ一覧
==============
すごいメッセージ
----------------
.. ros:automessage:: my_great_package_auto/GreatAutoMessage
:field-comment: right1
すごいアクション
----------------
.. ros:action:: my_great_package/GreatAction
すごいノード
============
ノードAPI
---------
.. ros:node:: my_great_package/GreateNode
:pub geometry_msgs/Vector3 ~pos: position of the robot
:sub geometry_msgs/Twist ~vel: reference velocity
:srv std_srvs/Trigger ~trigger: trigger for start
:srv_called std_srvs/Empty ~beep: beep service
:action control_msgs/GripperCommand ~gripper: gripper action of the robot
:action_called moveit_msgs/Pickup ~pickup: pickup action
:param int32 clients: number of clients
:param-default clients: 10
:param_set int32 motors: number of motors
これはすごいノードです。
Indigo/Jadeの
を出力してみました。(TravisCI/Ubuntu14.04)
そんな時の sphinx.ext.intersphinx
conf.py
に
extensions += ['sphinx.ext.intersphinx']
intersphinx_mapping = {'ros':
('http://otamachan.github.io/sphinxros/indigo/', None)}
って書いておけば
sphinx.ext.intersphinx
=======================
参照
----
このパッケージは :ros:pkg:`actionlib` を参考にしています。
:ros:msg:`control_msgs/JointControllerState` の ``i_clamp`` には対応していません。
型定義
------
.. ros:message:: my_package/MyNewMessage
:field Header header: Header
:field geometry_msgs/Vector3 acc: Acceleration of the robot
Tシャツにつられてsphinxcontrib-rosを公開しました
conf.pyに以下を追加するだけ
extensions += ['sphinxconrib.ros', 'sphinx.ext.intersphinx']
ros_base_path = ['../src']
intersphinx_mapping = {'ros':
('http://otamachan.github.io/sphinxros/indigo/', None)}
かっこよくROSのドキュメントが書けちゃうかも
:ros:wiki:`package`
Roleの追加