@@ -2017,6 +2017,149 @@ \subsubsection{inverse-kinematicsのtarget-coordsに関数を指定する例}
20172017このように、拘束条件を踏まえて逆運動学を解きたい場合にはtarget-coordsを関数とし
20182018て扱うことが必要になる。
20192019
2020+ \subsubsection {重心位置を考慮したfullbody-inverse-kinematicsの例 }
2021+ \begin {figure }[htb]
2022+ \begin {center }
2023+ \includegraphics [width=0.49\columnwidth ]{fig/full-body-ik.png}
2024+ \caption {Example of InverseKinematics with root link virtual joint}
2025+ \labfig {full-body-ik}
2026+ \end {center }
2027+ \end {figure }
2028+ :fullbody-inverse-kinematicsはロボットの関節に加えてベースリンク仮想ジョイントを駆動した
2029+ 逆運動学を解く関数である。以下に示すプログラムは、両足を地面に固定し、重心を両足の上に
2030+ 位置させた状態で、左手を目標に到達させる動作を行うものである。
2031+ {\baselineskip =10pt
2032+ \begin {verbatim }
2033+ (load "irteus/demo/sample-robot-model.l")
2034+ (setq *robot* (instance sample-robot :init))
2035+ (send *robot* :reset-pose)
2036+ (setq *obj* (make-cylinder 10 600))
2037+ (send *obj* :rotate pi :x)
2038+ (send *obj* :set-color #f(1 1 0))
2039+ (objects (list *robot* *obj*))
2040+
2041+ (let* ((rleg-coords (send *robot* :rleg :end-coords :copy-worldcoords))
2042+ (lleg-coords (send *robot* :lleg :end-coords :copy-worldcoords)))
2043+ (send *robot* :fullbody-inverse-kinematics
2044+ (list rleg-coords
2045+ lleg-coords
2046+ (make-coords :pos (float-vector 400 100 -600)))
2047+ :move-target
2048+ (list (send *robot* :rleg :end-coords)
2049+ (send *robot* :lleg :end-coords)
2050+ (send *robot* :larm :end-coords))
2051+ :link-list
2052+ (list (send *robot* :link-list (send *robot* :rleg :end-coords :parent))
2053+ (send *robot* :link-list (send *robot* :lleg :end-coords :parent))
2054+ (send *robot* :link-list (send *robot* :larm :end-coords :parent)))
2055+ :translation-axis (list t t t)
2056+ :rotation-axis (list t t nil)
2057+ :target-centroid-pos (midpoint 0.5 (send *robot* :rleg :end-coords :worldpos)
2058+ (send *robot* :lleg :end-coords :worldpos))
2059+ :cog-translation-axis :z)
2060+ (send *obj* :locate (send *robot* :centroid) :world)
2061+ (send *irtviewer* :draw-objects))
2062+ \end {verbatim }
2063+ }
2064+
2065+ {\baselineskip =10pt
2066+ \begin {verbatim }
2067+ (list rleg-coords
2068+ lleg-coords
2069+ (make-coords :pos (float-vector 400 100 -600)))
2070+ \end {verbatim }
2071+ }
2072+ の行でtarget-coordsに右足、左足、左手の目標位置姿勢を指定している。
2073+ 右足、左足は動かさないため、現在の座標をコピーしたものを与えている。
2074+ このときに、\verb |:translation-axis (list t t t) |, \verb |:rotation-axis (list t t nil) |
2075+ となっているため、右足、左足は位置姿勢を完全に拘束し、左手は姿勢の
2076+ 回転は許した条件で逆運動学を解くことになる。
2077+
2078+ {\baselineskip =10pt
2079+ \begin {verbatim }
2080+ :target-centroid-pos (midpoint 0.5 (send *robot* :rleg :end-coords :worldpos)
2081+ (send *robot* :lleg :end-coords :worldpos))
2082+ :cog-translation-axis :z)
2083+ \end {verbatim }
2084+ }
2085+ の行では重心の逆運動学を指定しており、\verb |:cog-translation-axis :z |で
2086+ z方向の重心の移動は許した状態で\verb |:target-centroid-pos |で目標位置として
2087+ 両足の中間の座標を与えることによって、重心のxy座標を両足の中間に一致させる
2088+ 条件のもとで逆運動学を解くことになる。
2089+
2090+ \subsubsection {外力を考慮したfullbody-inverse-kinematicsを解く例 }
2091+ \begin {figure }[htb]
2092+ \begin {center }
2093+ \includegraphics [width=0.49\columnwidth ]{fig/static-balance-ik.png}
2094+ \caption {Example of InverseKinematics with external force}
2095+ \labfig {static-balance-ik}
2096+ \end {center }
2097+ \end {figure }
2098+ ロボットが外力、外モーメントを受ける場合、外力による足裏まわりのモーメントと
2099+ 釣り合うようにロボットの重心をオフセットすることによって、バランスをとることができる。
2100+ 以下に示すプログラムは両手に外力、外モーメントが加わる場合に、両手両足を目標の位置に
2101+ 到達させかつバランスが取れる姿勢を逆運動学によって求めるものである。
2102+
2103+ {\baselineskip =10pt
2104+ \begin {verbatim }
2105+ (load "irteus/demo/sample-robot-model.l")
2106+ (setq *robot* (instance sample-robot :init))
2107+ (send *robot* :reset-pose)
2108+ (setq *obj* (make-cylinder 10 600))
2109+ (objects (list *robot*))
2110+
2111+ (let* ((force-list '(#f(-20 0 0) #f(-20 0 0)))
2112+ (moment-list '(#f(10 0 0) #f(10 0 0))))
2113+
2114+ (send *robot* :fullbody-inverse-kinematics
2115+ (list (send *robot* :rleg :end-coords :copy-worldcoords)
2116+ (send *robot* :lleg :end-coords :copy-worldcoords)
2117+ (make-coords :pos #f(400 -300 0))
2118+ (make-coords :pos #f(400 300 0)))
2119+ :move-target (mapcar #'(lambda (x)
2120+ (send *robot* x :end-coords))
2121+ (list :rleg :lleg :rarm :larm))
2122+ :link-list (mapcar #'(lambda (x)
2123+ (send *robot* :link-list (send *robot* x :end-coords :parent)))
2124+ (list :rleg :lleg :rarm :larm))
2125+ :centroid-offset-func #'(lambda () (send *robot* :calc-static-balance-point
2126+ :force-list force-list
2127+ :moment-list moment-list))
2128+ :target-centroid-pos (midpoint 0.5 (send *robot* :rleg :end-coords :worldpos)
2129+ (send *robot* :lleg :end-coords :worldpos))
2130+ :cog-translation-axis :z)
2131+ (send *irtviewer* :draw-objects)
2132+
2133+ ;; draw force
2134+ (mapcar
2135+ #'(lambda (f cc)
2136+ (let* ((prev-color (send *viewer* :viewsurface :color))
2137+ (prev-width (send *viewer* :viewsurface :line-width)))
2138+ (send *viewer* :viewsurface :color #F(1 0.3 1))
2139+ (send *viewer* :viewsurface :line-width 5)
2140+ (send *irtviewer* :viewer :draw-arrow
2141+ (send cc :worldpos)
2142+ (v+ (send cc :worldpos) (scale 10 f)))
2143+ (send *viewer* :viewsurface :color prev-color)
2144+ (send *viewer* :viewsurface :line-width prev-width)))
2145+ force-list
2146+ (list (send *robot* :rarm :end-coords)
2147+ (send *robot* :larm :end-coords)))
2148+ (send *irtviewer* :viewer :viewsurface :flush)
2149+ )
2150+ \end {verbatim }
2151+ }
2152+
2153+ この例では、
2154+ {\baselineskip =10pt
2155+ \begin {verbatim }
2156+ :centroid-offset-func #'(lambda () (send *robot* :calc-static-balance-point
2157+ :force-list force-list
2158+ :moment-list moment-list))
2159+ \end {verbatim }
2160+ }
2161+ の行で外力、外モーメントを考慮している。force-listは右手に作用する外力と左手に作用する外力のリスト、force-listは右手に作用する外モーメントと左手に作用する外モーメントのリストであり、単位はそれぞれ[N]、[Nm]である。:calc-static-balance-pointは、現在の両手の位置に作用する外力外モーメントと現在の重心の位置に作用する重力に対してバランスが取れる足裏圧力中心の位置を返す関数である。:centroid-offset-funcは\verb|float-vector|クラスを返す関数を指定することができ、現在の重心位置の代わりにこの関数の返り値を用いて目標重心位置との距離に応じた逆運動学を解く。\verb|:cog-translation-axis :z|でz方向の重心の移動は許した状態で\verb|:target-centroid-pos|で目標重心位置として両足の中間の座標を与えることによって、:centroid-offset-funcの返り値、即ちバランスが取れる足裏圧力中心のxy座標を両足の中間に一致させる逆運動学を解くことになる。
2162+
20202163 \subsection {ロボットモデル }
20212164
20222165ロボットの身体はリンクとジョイントから構成されるが、それぞれ
0 commit comments