Changing the Position and Posture

This section describes the basic operations to change the position and posture of a body model.

For the explanation, we will use the PA10 model introduced in Loading a Body Model as an example here as well, so please load and display this model when confirming the operation methods on Choreonoid.

Kinematics Bar

The behavior of operations on the position and posture of a body model changes depending on the state of the following “Kinematics Bar”.

../_images/KinematicsBar.png

The first three buttons are particularly important. These buttons are designed so that only one of them is ON, and are used to switch the “kinematics mode”. From left to right, they are:

  • Forward kinematics

  • Preset kinematics

  • Inverse kinematics

For now, it’s fine if the “Preset kinematics” button, which is the default state, is ON. Details about these modes and the functions of other buttons will be explained later.

Joint Displacement View

The basic way to change the model’s posture is to change joint angles. This can be achieved with various functions. First, let’s explain how to change joint angles using the “Joint Displacement View”, which is one of the basic views.

Note

When the joint is a “rotational joint”, the position within the joint is called “joint angle”. On the other hand, there are also “linear joints” as a type of joint, and in that case it is not called “joint angle”. As a general term when both are involved, there is “joint displacement”, and the view introduced here also has that name. In the following, we will also use the term “joint displacement” when both rotational joints and linear joints are involved.

As preparation, select the PA10 body item in the Item Tree View. This sets PA10 as the target model for the Joint Displacement View.

Note

Not only for the Joint Displacement View, but when operating a model through views or toolbars, you need to select the target body item to specify the target. Once you have selected it, it’s OK even if you deselect it afterwards. The last selected body item continues to be the target until another body item is selected. Please note that you basically need to specify the body item with this operation for other views and toolbars mentioned in this section as well.

Then the Joint Displacement View display should look like this:

../_images/jointslider_pa10_initial.png

In this view, there are buttons for display switching at the top. In the main area below, interfaces for displaying and changing the state of each joint are arranged in order of joint ID from top to bottom. For each joint, from left to right: joint name, current joint displacement value, minimum displacement, joint displacement slider, and maximum displacement are arranged. When you turn ON the “ID” button at the top, joint ID values are also displayed.

Here, users can change the joint displacement values and slider positions, and the internal state of the model and the display in the Scene View change in synchronization with that operation. For example, try operating the value or slider of joint “J4”. Then, the joint in the middle of PA10’s arm should bend as shown below:

../_images/pa10_j4.png

You can move other joints in the same way, so please try it.

Changing Joint Displacement in the Scene View

You can also change joint displacement by directly dragging joint positions with the mouse in the Scene View.

This operation is performed using the “Edit Mode” explained in View Mode and Edit Mode of Basic Concepts and Operations - Scene Display. Following the explanation there, first switch the Scene View to edit mode. Then, when you move the mouse cursor to the position of the J4 link you just operated, you should see a display like this:

../_images/j4_drag.png

Here, the red marker surrounding the bottom of the PA10 model indicates that this part is the current base link. This is displayed when the Scene View enters edit mode, so you can also confirm that it’s in edit mode by this display. And the red box surrounding the J4 link indicates that the mouse cursor is pointing to the J4 link and it is the target link for editing operations. If the cursor points to another link, that one will be surrounded.

In this state, try dragging while pressing the left mouse button. Then the J4 joint should move in conjunction with the mouse drag. In this way, you can intuitively drag joints and change postures in the Scene View.

Also, even when you drag a joint in the Scene View, the state of the Joint Displacement View changes synchronously. This is true not only for the Joint Displacement View but for all views that display and edit the state of body models, and by synchronizing the behavior of such views with each other, consistency on the GUI is always maintained.

Moving the Model

You can move the entire body model by dragging the base link. For example, when the “BASE” link at the bottom of the PA10 model is the base link, clicking this link results in the following display:

../_images/pa10_move.png

If you drag the mouse in this state, the entire model moves to follow the drag.

Also, in the default setting, a marker consisting of three-colored arrows and rings (position dragger) is displayed as shown in the figure. By dragging this, you can also move the model and even rotate it (change its orientation). Specifically, dragging the arrow parts results in translational movement along each axis, and dragging the ring parts results in rotation of the orientation along the outer circumference of the ring. The red, green, and blue of the arrows and rings correspond to the X, Y, and Z axes in the link’s local coordinate system, respectively.

Whether to display the position dragger can be toggled with the following button on the Kinematics Bar:

../_images/PositionDraggerButton.png

This button is ON by default, but if the dragger gets in the way during editing, you can turn off the display by unchecking this button.

Undo/Redo of Position and Posture Change Operations

When editing positions or postures, you may want to return to the previous state. In that case, press “Ctrl + Z” while the mouse cursor is pointing to the model in edit mode. This will recall the previous position and posture. You can also recall earlier states by repeatedly performing Undo.

Also, pressing “Shift + Ctrl + Z” performs a Redo. This allows you to cancel states that were undone with Undo. Redo can also be repeated as many times as necessary.

Body Bar

When editing the position or posture of a model, you may want to remember a certain state of the model and recall it later, or return to the initial or standard state. The functions to do this are provided in the “Body Bar” shown below:

../_images/BodyBar.png

Pressing the first button from the left remembers the current position and posture. The remembered state can then be recalled by pressing the second button.

The third button from the left moves the position of the model’s root link to the origin position and returns the posture to its initial state (where the local coordinate system matches the global coordinate system).

The fourth button is for returning to the “initial posture” with all joint angles set to 0. The fifth button changes all joints of the model to the pre-configured “standard posture”. Although it depends on the model definition, the standard posture is generally different from the initial posture. For example, in the case of PA10, the initial posture has the arm standing upright, but the following posture is registered as the standard posture:

../_images/pa10_standard.png

When this robot actually operates as a manipulator, it rarely manipulates objects directly above while standing upright, and often begins manipulating objects around the robot from a posture like this. Considering such factors, this posture is registered as the standard posture for the PA10 model, distinguishing it from the initial posture.

Changing Posture Using Inverse Kinematics

As a method for changing the model’s posture, we have so far explained methods that directly change the joint displacement of specific joints. In this case, the procedure is “first specify the joint displacement, and as a result the position and orientation of each link changes”, and this kind of processing is called “forward kinematics”.

While forward kinematics is one effective method for obtaining a desired posture, it is very difficult to bring a specific link, such as the end effector of a manipulator, to a desired position and orientation using this method. Therefore, there are cases where we want to perform the inverse process of forward kinematics: “specify the position and orientation of a link, and obtain the joint displacements that realize it”. This is called “inverse kinematics”, and in Choreonoid it is also possible to change the model’s posture using this method.

Rather than explaining this, it’s easier to understand inverse kinematics by actually trying it. Let’s try this with the PA10 model as well. First, press the “Standard Posture” button on the Body Bar introduced earlier to put PA10 in the standard posture. Also, confirm that the “BASE” link is the base link (default state).

Then, try dragging PA10’s end link (J7). You should see a display like the figure below, with the end link moving to follow the mouse cursor. (Similar to Moving the Model, you can also move the link by dragging each axis of the position dragger attached to the end link.)

../_images/pa10_ik.png

When moving the end link, you can see that the intermediate joints follow along. In this way, inverse kinematics allows you to directly change the position and orientation of links. You can utilize this inverse kinematics operation when you want to intuitively move a specific link to a desired position and orientation.

Note

The reason we first set it to the standard posture is that in the initial posture where the manipulator stands upright, the robot is in a “singular posture” and cannot perform calculations to move the end link with inverse kinematics. Like the “standard posture”, when each joint is bent to some degree, it is not in such a singular posture. You need to be aware of this point when using inverse kinematics. However, although we won’t explain the details here, some models have analytical solutions for inverse kinematics prepared, and in that case it’s possible to move without worrying much about singular postures.

Switching Kinematics Modes

In Changing Joint Displacement in the Scene View, we dragged PA10’s J4 link in the Scene View to change the posture using forward kinematics. Also, in Changing Posture Using Inverse Kinematics, we dragged the J7 link to change the posture using inverse kinematics. In these operations, we didn’t specifically specify forward or inverse kinematics. This is because we were in a mode where the kinematics type is automatically selected depending on the link being dragged. On the other hand, there may be cases where you want to move the J4 link with inverse kinematics or the J7 link with forward kinematics. For such cases, users can also explicitly switch the kinematics type. The following three buttons at the beginning of the Kinematics Bar do this:

../_images/KinematicsBarModeButtons.png

By default, the middle button is ON, which is the “Preset Kinematics Mode” where the kinematics type automatically switches depending on the link. The correspondence between links and kinematics types is predefined for each model, and for example, in the case of the PA10 model, the correspondence is as follows:

Link

Kinematics Type

BASE, J1 to J5

Forward kinematics

J6 to J7

Inverse kinematics

HAND_L, HAND_R

Forward kinematics

The above correspondence relationships in Preset Kinematics Mode are determined with the policy of setting inverse kinematics for links that are likely to be moved using inverse kinematics, and most posture change operations should be covered by this. (This setting is actually done through Preset Kinematics Setting in Additional Information.)

If you want to manually specify the kinematics type, use the other two buttons. The left button is “Forward Kinematics Mode” and the right button is “Inverse Kinematics Mode”. When either of these buttons is ON, the selected kinematics type is applied regardless of which link you drag, so please use the appropriate mode as needed.