1. 程式人生 > >V-rep學習筆記:機器人逆運動學解算

V-rep學習筆記:機器人逆運動學解算

uri strong sometimes dir pan eve 歐拉 lec oid

  • IK groups and IK elements

  VREP中使用IK groups和IK elements來進行正/逆運動學計算,一個IK group可以包含一個或者多個IK elements:

  • IK groups: IK groups group one or more IK elements. To solve the kinematics of a simple kinematic chain, one IK group containing one IK element is needed. The IK group defines the overall solving properties
    (like what solving algorithm to use, etc.) for one or more IK elements
    .
  • IK elements: IK elements specify simple kinematic chains. One IK element represents one kinematic chain. A kinematic chain is a linkage containing at least one joint object. In short, an IK element is made up by:
    • a base (any type of object, even a joint. In that case however the joint is considered as rigid). It represents the start of the kinematic chain
      .
    • several links (any type of object except joints). Joints which are not in IK mode are however also considered as links(in that case they behave as rigid joints (fixed value)).
    • several joints. A joint which is not in IK mode is however not considered as a joint, but as a link (see above).
    • a tip. The tip is always a dummy and is the last object in the considered kinematic chain
      (when going from the base to the tip). The tip dummy should be linked to a target dummy (see hereafter) and the link should be an IK, tip-target link type.
    • a target. The target is always a dummy and represents the position and/or orientation the tip should adopt (or follow) during simulation.

   一個IK element代表一條運動鏈,最簡單的就是下面這種情況,即場景中只有一個串聯機械臂(一條運動鏈),那麽進行逆運動學求解只需要一個IK group:

技術分享

  如果同一場景中有2個互不幹擾的串聯機械臂,那麽就需要2個IK group。下面這種情況IK group的求解順序對結果沒有影響:

技術分享

  然而當兩個運動鏈相互之間產生影響時,比如上圖中Target2固定到運動鏈1上時,求解順序就很重要了。必須先求解IK group1,求解的結果會直接影響Target2的位置,從而影響IK group2的求解:

技術分享

  下面是一種更復雜的情況:兩個運動鏈共享某一關節,先解算運動鏈1會帶著關節朝左移動從而影響運動鏈2的求解;而先解算運動鏈2會帶著關節朝右移動從而影響運動鏈1的求解。這種矛盾的情況下按順序解算就失去作用,需要同時求解兩個運動鏈。將兩個IK element放在同一IK group中就可以同時進行逆解計算

技術分享

  • 交互式驗證求解結果

  簡單的串聯機械臂按照教程很容易搭建好逆運動學模型,模型和求解參數設定好以後可以通過拖拽/旋轉Target Dummy(或者操控球)來觀察機械臂的行為。下面以幫助文檔中的7自由度冗余機械臂為例進行操作,模型位於C:\Program Files\V-REP3\V-REP_PRO_EDU\tutorials\InverseKinematics中。 Try holding down the Ctrl or Shift-keys during manipulation:打開Object Position/Orientation操縱面板,選中操控球(manipSphere),在默認視圖下按住鼠標只能在X-Y平面內進行位置的拖拽,如果同時按住Ctrl鍵則可切換到Z方向拖拽,這是一個很實用的功能。另外值得一提的是下面的Gif圖片使用ScreenToGif開源軟件制作,相當良心!

技術分享

  打開Tools→User settings對話框,在Object manipulation中也可以自定義拖拽或旋轉物體時的步距/步距角:

技術分享

  • 求解方法

  The pseudoinverse tends to have stability problems in the neighborhoods of singularities. At a singularity, the Jacobian matrix no longer has full row rank, corresponding to the fact that there is a direction of movement of the end effectors which is not achievable. If the configuration is exactly at a singularity, then the pseudoinverse method will not attempt to move in an impossible direction, and the pseudoinverse will be well-behaved. However, if the configuration is close to a singularity, then the pseudoinverse method will lead to very large changes in joint angles, even for small movements in the target position.

  Try to drag the object as far as possible, and notice how the inverse kinematics task breaks. Indeed, this happens when a configuration is singular or not reachable, however there are workarounds to this behavior: while the simulation is still running, select "IK_Group" in the inverse kinematics dialog list, then specify DLS for the Calc. method item. Drag the object out of reach and notice how the inverse kinematics resolution became more stable. Try adjusting the Damping item up and down. Basically, when damping is large, resolution becomes more stable but slower. The damped least squares method(DLS) avoids many of the pseudo inverse method’s problems with singularities and can give a numerically stable method.

  即使用偽逆矩陣法(Pseudo Inverse)進求解,在奇異位置處可能會出現問題,而DLS法在奇異位置處則更穩定。

技術分享

  Practically, you can get the advantages of both resolution methods, all you need to do is define two identical "IK groups", where the first is not damped and the second is damped. Then, for the second "IK group", you can specify a conditional resolution (refer to the Edit conditional parameters item for more information). 偽逆矩陣法收斂快,但是在奇異位置處存在問題;DLS法在奇異位置處計算結果更穩定,但是運算較慢。因此可以將兩者結合起來使用,在IK Group中添加undamped的偽逆矩陣法和damped的DLS法。選中damped IK group,點開Edit conditional parameters對話框,在Perform if...條件欄中進行配置:如果undamped方法失敗,則執行damped方法。

技術分享

  • 約束

  Make sure that all items are checked in the Constraints section (check als Alpha-Beta and Gamma). Indeed, we want our "tip" dummy to follow our "target" dummy in position and orientation. Sometimes it is however not possible to correctly specify the constraints for a tip, and in that case the IK group‘s calculation method should be a damped method (e.g. DLS method) with an appropriately selected damping factor. A damped resolution method should also be selected when a target can‘t possibly be reached (out of reach, or close to a singular configuration). Damping can result in more stable calculations, but keep in mind that damping will always slow down the IK calculations (more iterations will be needed to put the tip into place). 正確理解和施加約束對於運動學逆解的求解相當重要,如果約束的數目比機構自由度要多則會造成過約束,這時有些求解方法就會失敗。

  在IK element的Constraints選項欄中勾選X、Y、Z可以分別對笛卡爾坐標系下的三個位置分量進行約束,但是姿態的三個分量只有兩個選項框可以勾選:Turning Alpha-Beta constraint on, will match the tip‘s z-axis orientation with the target‘s z-axis orientation, while keeping a free rotation around the z-axis if Gamma constraint is off. When Alpha-Beta constraint AND Gamma constraint are turned on, then the tip will try to adopt exactly the same orientation as its associated target. (V-rep中物體姿態以X-Y-Z歐拉角的方式確定。即以指定的參考系為初始姿態,然後按X-Y-Z的順序依次繞自身的坐標軸旋轉Alpha,Beta,Gamma角度後得到)

  • Alpha-beta on and Gamma off

技術分享

  很多工業機械臂只有4個自由度(包括沿X,Y,Z方向的平移和繞Z軸的旋轉自由度),如SCARA機器人,其末端的Z軸指向是固定不變的(因此要約束Alpha-beta,即繞X-Y軸的旋轉)。

技術分享

  • Alpha-beta and Gamma on

技術分享

  對於自由度等於或大於6的機械臂,在其靈活工作空間內的點可以任意姿態到達,因此可以約束所有的自由度。

技術分享

  • collections

  A collection is a user-defined collection of scene objects. A collection has to contain at least one object and is considered to be an entity (objects are also entities). Collections are useful when referring to several objects like a robot for instance. V-REP supports calculations based not only on objects, but also on collections. For instance the collision detection module allows registering following collision pair: (collection A; object B). The collision checking algorithm will then check whether the collection A (any object composing it) collides with object B.

  VREP中可以將場景裏的物體組成一個集合(collection),後續的一些操作,比如碰撞檢測時就可以選取定義好的集合。將物體添加進集合有多種方式,以這個冗余機器人為例,在工具欄中打開Collections對話框,點擊Add new collection按鈕,添加一個新的集合並將其命名為redundantRob。然後選中機器人的根節點redundantRobot,同時勾選Tree of selected object和Base included,點擊Add把機器人整個加入進collection中。為了驗證可以點Visualize selected collection按鈕,用顏色來顯示加入集合中的物體:

技術分享

  VREP提供多種靈活的選取方法(參考幫助文檔的Collections頁面),上面這種操作只需要選取根節點即可將整個運動鏈上的物體加入集合,比一個個物體單獨添加要方便很多:

技術分享

  In above example, if object 1 is removed from the scene, the element is not valid anymore and will also be removed. Object 1 is the element‘s defining object.

參考:

Inverse kinematics tutorial

Solving IK and FK for any type of mechanism

External kinematics (auxiliary API)

V-rep學習筆記:機器人逆運動學解算