|
1117 | 1117 | (tmp-v3b (instantiate float-vector 3)) |
1118 | 1118 | (tmp-m33 (make-matrix 3 3)) |
1119 | 1119 | &allow-other-keys) |
1120 | | - "Calculate jacobian matrix from link-list and move-target. Unit system is [m] or [rad], not [mm] or [deg]." |
1121 | | - "Joint order for this jacobian matrix follows link-list order. Joint torque[Nm] order is also the same. |
| 1120 | + "Calculate jacobian matrix from link-list and move-target. Jacobian is represented in :transform-coords. Unit system is [m] or [rad], not [mm] or [deg]. |
| 1121 | + Joint order for this jacobian matrix follows link-list order. Joint torque[Nm] order is also the same. |
1122 | 1122 | Ex1. One-Arm |
1123 | 1123 | (setq *rarm-link-list* (send *robot* :link-list (send *robot* :rarm :end-coords :parent))) |
1124 | 1124 | (send-all *rarm-link-list* :joint) |
|
1729 | 1729 | (tmp-mcc (make-matrix fik-len fik-len)) |
1730 | 1730 | (tmp-mcc2 (make-matrix fik-len fik-len)) |
1731 | 1731 | (debug-view) (jacobi) |
1732 | | - &allow-other-keys) |
| 1732 | + &allow-other-keys) |
| 1733 | + ":move-joints-avoidance is called in :inverse-kinematics-loop. In this method, calculation of joint position difference are executed and joint positon are moved. |
| 1734 | + Optional arguments: |
| 1735 | + ~ :weight |
| 1736 | + ~~ float-vector of inverse weight of velocity of each joint or a function which returns the float-vector or a list which returns the float-vector. Length of the float-vector should be same as the number of columns of the jacobian. If :weight is a function or a list, it is called in each IK loop as (funcall weight union-link-list) or (eval weight). :weight is used in calculation of weighted norm of joint velocity for sr-inverse. Default is the float-vector filled with 1. |
| 1737 | + ~ :null-space |
| 1738 | + ~~ float-vector of joint velocity or a function which returns the float-vector or a list which returns the float-vector. Length of the float-vector should be same as the number of columns of the jacobian. If :null-space is a function or a list, it is called in each IK loop as (funcall null-space) or (eval null-space). This joint velocity is applied in null space of main task in each IK loop. Default is nil. |
| 1739 | + ~ :avoid-nspace-gain |
| 1740 | + ~ gain of joint velocity to avoid joint limit applied in null space of main task in each IK loop. The avoiding velocity is calculated as $(((t_max + t_min)/2 - t) / ((t_max - t_min)/2))^2$. Default is 0.01. |
| 1741 | + ~ :avoid-weight-gain |
| 1742 | + ~~ gain of dH/dt in calcuration of avoiding joint limits weight. :weight is devided by this avoiding joint limits weight. Default is 1.0. |
| 1743 | + ~~ If :avoid-nspace-gain is 0, :weight is multipled by :weight instead. |
| 1744 | + ~ :avoid-collision-distance |
| 1745 | + ~~ yellow zone. 0.1avoid-collision-distance is regarded as orange zone. |
| 1746 | + ~~ If :avoid-collision-joint-gain is smaller than or equal to 0.0, yellow zone and orange zone become inactive. Default is 200[mm]. |
| 1747 | + ~ :avoid-collision-null-gain |
| 1748 | + ~~ $k_{null}$. Default is 1.0. |
| 1749 | + ~ :avoid-collision-joint-gain |
| 1750 | + ~~ $k_{joint}$. Default is 1.0. |
| 1751 | + ~ :collision-avoidance-link-pair |
| 1752 | + ~~ (list (list link1 link2) (list link3 link4) ...) with any length. Collision between paired links is cared. Default is (send self :collision-avoidance-link-pair-from-link-list link-list :obstacles (cadr (memq :obstacles args))). |
| 1753 | + ~ :additional-weight-list |
| 1754 | + ~~ (list (list target-link1 additional-weight1) (list target-link2 additional-weight2) ...) with any length. The component of :weight corresponding to the parent joint of target-link is scaled by additional-weight. additional-weight should be float (if 1 dof), float-vector with length of the joint dof, or a function which returns the float or float-vector. if additional-weight is a function, it is called in each IK loop as (funcall additional-weight). Default is nil. |
| 1755 | + ~ :additional-nspace-list |
| 1756 | + ~~ (list (list target-link1 var1) (list target-link2 var2) ...) with any length. In each IK loop, the parent joint of target-link is moved by the amount of var in null space of main task. var should be float (if 1dof), float-vector with the same length of the target joint dof, or a function which returns the float or float-vector.If var is float-vector, it is called in each IK loop as (funcall var). Default is nil. |
| 1757 | + ~ other-keys |
| 1758 | + ~~ :manipulability-limit |
| 1759 | + ~~~ If manipulability of jacobian is smaller than manipulability-limit, diagonal matrix is added in calculation of sr-inverse. Default is 0.1. |
| 1760 | + ~ :manipulability-gain |
| 1761 | + ~~ Weight of diagonal matrix in calculation of sr-inverse. Weight is calculated as (* manipulability-gain (expt (- 1.0 (/ manipulability manipulability-limit)) 2)). Default is 0.001. |
| 1762 | + ~~ :collision-distance-limit |
| 1763 | + ~~~ Threshold for collision detection. If collision is detected, the distance between the colliding links is considered to be :collision-distance-limit instead of actual distance. Default is 10[mm]. |
| 1764 | + ~~ :move-joints-hook |
| 1765 | + ~~~ A function which is called right after joints are moved in each IK loop as (funcall move-joints-hook). Default is nil. |
| 1766 | + " |
1733 | 1767 | (let* (joint-angle-limit-nspace |
1734 | 1768 | dav dtheta |
1735 | 1769 | null-space-collision-avoidance |
|
2005 | 2039 | ":inverse-kinematics-loop is one loop calculation for :inverse-kinematics. |
2006 | 2040 | In this method, joint position difference satisfying workspace difference (dif-pos, dif-rot) are calculated and euslisp model joint angles are updated. |
2007 | 2041 | Optional arguments: |
2008 | | - :additional-check |
2009 | | - This argument is to add optional best-effort convergence conditions. |
2010 | | - :additional-check should be function or lambda. |
2011 | | - best-effort => In :inverse-kinematics-loop, 'success' is overwritten by '(and success additional-check)' |
2012 | | - In :inverse-kinematics, 'success is not overwritten. |
2013 | | - So, :inverse-kinematics-loop wait until ':additional-check' becomes 't' as possible, |
2014 | | - but ':additional-check' is neglected in the final :inverse-kinematics return. |
2015 | | - :min-loop |
2016 | | - Minimam loop count (nil by default). |
2017 | | - If integer is specified, :inverse-kinematics-loop does returns :ik-continues and continueing solving IK. |
2018 | | - If min-loop is nil, do not consider loop counting for IK convergence. |
| 2042 | + ~ :dif-pos-ratio |
| 2043 | + ~~ Ratio of spacial velocity used in calculation of joint position difference to workspace difference (after :p-limit applied). Default is 1.0. |
| 2044 | + ~ :dif-rot-ratio |
| 2045 | + ~~ Ratio of angular velocity used in calculation of joint position difference to workspace difference (after :r-limit applied). Default is 1.0. |
| 2046 | + ~ :jacobi |
| 2047 | + ~~ A jacobian of all move-target or a function that returns the jacobian. When a function is given, It is called in every IK loop as (funcall jacobi link-list move-target translation-axis rotation-axis). Default is (send* self :calc-jacobian-from-link-list link-list :translation-axis translation-axis :rotation-axis rotation-axis :move-target move-target method-args). |
| 2048 | + ~ :additional-check |
| 2049 | + ~~ This argument is to add optional best-effort convergence conditions. Default is nil (no additional check). :additional-check should be function or lambda. |
| 2050 | + ~~ best-effort => |
| 2051 | + ~~~ In :inverse-kinematics-loop, 'success' is overwritten by '(and success additional-check)' |
| 2052 | + ~~~ In :inverse-kinematics, 'success is not overwritten. |
| 2053 | + ~~~ So, :inverse-kinematics-loop wait until ':additional-check' becomes 't' as possible, |
| 2054 | + ~~~ but ':additional-check' is neglected in the final :inverse-kinematics return. |
| 2055 | + ~ :cog-gain |
| 2056 | + ~~ Ratio of centroid velocity used in calculation of joint position difference to centroid position difference. max 1.0. Default is 1.0. |
| 2057 | + ~ :min-loop |
| 2058 | + ~~ Minimam loop count. Defalt (/ stop 10). |
| 2059 | + ~~ If integer is specified, :inverse-kinematics-loop does returns :ik-continues and continueing solving IK. |
| 2060 | + ~~ If min-loop is nil, do not consider loop counting for IK convergence. |
| 2061 | + ~ other-keys |
| 2062 | + ~~ :move-joints-avoidance is internally called and args are passed to it. See the explanation of :move-joints-avoidance. |
| 2063 | + ~~ :p-limit |
| 2064 | + ~~~ Maximum spacial velocity of each move-target in one IK loop. Default is 100.0[mm]. |
| 2065 | + ~~ :r-limit |
| 2066 | + ~~~ Maximum angular velocity of each move-target in one IK loop. Default is 0.5[rad]. |
2019 | 2067 | " |
2020 | 2068 | (if target-centroid-pos (send self :update-mass-properties)) |
2021 | 2069 | ;; dif-pos, dif-rot, move-target, rotation-axis, translation-axis, link-list |
|
2219 | 2267 | (additional-jacobi) (additional-vel) |
2220 | 2268 | &allow-other-keys) |
2221 | 2269 | "Move move-target to target-coords. |
| 2270 | + ;; target-coords, link-list and move-target need to be given. |
2222 | 2271 | ;; target-coords, move-target, rotation-axis, translation-axis, link-list |
2223 | 2272 | ;; -> both list and atom OK. |
2224 | | - target-coords : The coordinate of the target, or a function that returns coordinates. Use a list of targets to solve the IK relative to multiple end links simultaneously. |
2225 | | - link-list : List of links to control. When the target-coords is list, this should be a list of lists. |
2226 | | - move-target : Specify end-effector coordinate. When the target-coords is list, this should be list too. |
2227 | | - stop : Maximum number for IK iteration. Default is 50. |
2228 | | - debug-view : Set t to show debug message and visualization. Use :no-message to just show the irtview image. Default is nil. |
2229 | | - warnp : Set nil to not display debug message when the IK failed. Default is t. |
2230 | | - revert-if-fail : Set nil to keep the angle posture of IK solve iteration. Default is t, which return to original position when IK fails. |
2231 | | - rotation-axis : Use nil for position only IK. :x, :y, :z for the constraint around axis with plus direction, :-x :-y :-z for axis with minus direction. :zz :yy :zz for direction free axis. :xm :ym :zm for allowing rotation with respect to mirror direction. When the target-coords is list, this should be list too. Default is t. |
2232 | | - translation-axis : :x :y :z for constraint along the x, y, z axis. :xy :yz :zx for plane. Default is t. |
2233 | | - thre : Threshold for position error to terminate IK iteration. Default is 1 [mm]. |
2234 | | - rthre : Threshold for rotation error to terminate IK iteration. Default is 0.017453 [rad] (1 deg). |
2235 | | - check-collision : Set t to return false when self collision occurs at found IK solution. Default is nil. To avoid collision within IK loop, use set links to collision-avoidance-links slot of cascaded-link. |
2236 | | - dump-command : should be t, nil, :always, :fail-only, :always-with-debug-log, or :fail-only-with-debug-log. |
2237 | | - Log are success/fail log and ik debug information log. |
2238 | | - t or :always : dump log both in success and fail (for success/fail log). |
2239 | | - :always-with-debug-log : dump log both in success and fail (for success/fail log and ik debug information log). |
2240 | | - :fail-only : dump log only in fail (for success/fail log). |
2241 | | - :always-with-debug-log : dump log only in fail (for success/fail log and ik debug information log). |
2242 | | - nil : do not dump log." |
| 2273 | + :target-coords |
| 2274 | + ~ The coordinate of the target, or a function that returns coordinates. When a function is given, it is called in every IK loop as (funcall target-coords). Use a list of targets to solve the IK relative to multiple end links simultaneously. |
| 2275 | + :stop |
| 2276 | + ~ Maximum number for IK iteration. Default is 50. |
| 2277 | + :link-list |
| 2278 | + ~ List of links to control. When the target-coords is list, this should be a list of lists. |
| 2279 | + :move-target |
| 2280 | + ~ Specify end-effector coordinate. When the target-coords is list, this should be list too. |
| 2281 | + :debug-view |
| 2282 | + ~ Set t to show debug message and visualization. Use :no-message to just show the irtview image. Default is nil. |
| 2283 | + :warnp |
| 2284 | + ~ Set nil to not display debug message when the IK failed. Default is t. |
| 2285 | + :revert-if-fail |
| 2286 | + ~ Set nil to keep the angle posture of IK solve iteration. Default is t, which return to original position when IK fails. |
| 2287 | + :rotation-axis |
| 2288 | + ~ Use nil for position only IK. :x, :y, :z for the constraint around axis with plus direction, :-x :-y :-z for axis with minus direction. :zz :yy :zz for direction free axis. :xm :ym :zm for allowing rotation with respect to mirror direction. When the target-coords is list, this should be list too. Default is t. |
| 2289 | + :translation-axis |
| 2290 | + ~ :x :y :z for constraint along the x, y, z axis. :xy :yz :zx for plane. Default is t. |
| 2291 | + :joint-args |
| 2292 | + ~ Arguments passed to joint as (send* joint :joint-angle angle :relative t joint-args). Default nil. |
| 2293 | + :thre |
| 2294 | + ~ Threshold for position error to terminate IK iteration. Default is 1 [mm]. |
| 2295 | + :rthre |
| 2296 | + ~ Threshold for rotation error to terminate IK iteration. Default is 0.017453 [rad] (1 deg). |
| 2297 | + :union-link-list |
| 2298 | + ~ a function that returns union of link-list called as (funcall union-link-list link-list). Default is (send self :calc-union-link-list link-list). |
| 2299 | + :centroid-thre |
| 2300 | + ~ Threshold for centroid position error to terminate IK iteration. Default is 1 [mm]. |
| 2301 | + :target-centroid-pos |
| 2302 | + ~ The float-vector of the target centroid position. Default is nil. |
| 2303 | + :centroid-offset-func |
| 2304 | + ~ A function that returns centroid position. This function is called in each IK loop as (funcall centroid-offset-func). Default is (send self :centroid). |
| 2305 | + :cog-translation-axis |
| 2306 | + ~ :x :y :z for constraint along the x, y, z axis. :xy :yz :zx for plane. t for point. Default is :z. |
| 2307 | + :cog-null-space |
| 2308 | + ~ t: centroid position task is solved in null space of the main task. Default is nil. |
| 2309 | + :dump-command |
| 2310 | + ~should be t, nil, :always, :fail-only, :always-with-debug-log, or :fail-only-with-debug-log. Log are success/fail log and ik debug information log. |
| 2311 | + ~~ t or :always : dump log both in success and fail (for success/fail log). |
| 2312 | + ~~ :always-with-debug-log : dump log both in success and fail (for success/fail log and ik debug information log). |
| 2313 | + ~~ :fail-only : dump log only in fail (for success/fail log). |
| 2314 | + ~~ :always-with-debug-log : dump log only in fail (for success/fail log and ik debug information log). |
| 2315 | + ~~ nil : do not dump log. |
| 2316 | + :periodic-time |
| 2317 | + ~ The amount of joint angle modification in each IK loop is scaled not to violate joint velocity limit \times :periodic-time. Default is 0.5[s]. |
| 2318 | + :check-collision |
| 2319 | + ~ Set t to return false when self collision occurs at found IK solution. Default is nil. To avoid collision within IK loop, use set links to collision-avoidance-links slot of cascaded-link. |
| 2320 | + :additional-jacobi |
| 2321 | + ~ The jacobian of the additional main task, or a function that returns the jacobian. When a function is given, it is called in every IK loop as (funcall additional-jacobi link-list). Use a list of additional-jacobi to solve the IK for multiple additional task. Default is nil. |
| 2322 | + :additional-vel |
| 2323 | + ~ The velocity of additional main task, or a function that returns the velocity. When a function is given, it is called in every IK loop as (funcall additional-vel link-list). The velocity should be expressed in the same coordinates as corresponding additional-jacobi. When the additional-jacobi is list, this should be a list of same length. Default is nil. |
| 2324 | + other-keys |
| 2325 | + ~ function :inverse-kinematics-loop is internally called and args are passed to it. See the explanation of :inverse-kinematics-loop." |
2243 | 2326 | (if (or (atom target-coords) (functionp target-coords)) (setq target-coords (list target-coords))) |
2244 | 2327 | (let* ((loop 0) |
2245 | 2328 | (union-link-list (if (functionp union-link-list) (funcall union-link-list link-list) (send self :calc-union-link-list link-list))) |
|
0 commit comments