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