Tutorial?

Robot Dynamics

SIGVerse using OpenDynamicsEngine (ODE) to model the dynamics of the robot. The shapes that are used for such dynamics calculation are modeled using the OpenHRP format in SIGVerse. So, if your requirement is to use some shapes or robots only for the case when dynamics of the entity is OFF, then you may not need this tutorial. But, if your work requires usage of dynamics properties like force, torque etc, then this tutorial is important for you.

This tutorial shows how to model simple objects using the OpenHRP format so that dynamics calculations can be performed using ODE.

Simple Model

Creating a model

To begin with, please create a directory and copy the x3d file given below into your editor and save it.

We shall then discuss its contents.

$ cd ~/MyWorld
$ emacs robot_test.x3d

robot_test.x3d

Layout of the model

The Basic layout of the file is as FOLLOWS:

Header:

    PROTO declaration part (Declare the PROTO Structure)

The rest:

    Real-model definition part (Declare the instances that uses PROTO)

In OpenHRP format, a model is created by combining the instances of PROTO nodes. There are three types of PROTO nodes:

  • 1.Joint node
  • 2.Segment node
  • 3.Humanoid node

The JOINT node specifies the link structure. The Segment node defines the Link shape. The Humanoid Node is the root node of the model.

For more information about OpenHRP format and modeling, please refer their website.

The parent-child relationship of the model we have created, looks like the following:

   Humanoid sample(the root node of the model)
    + Joint JOINT0 (the root joint has six degree of freedom)
     + Joint JOINT1 
         Segment LINK1 ( its fixed joint i.e. zero degrees of freedom )
         + Joint JOINT2 
             Segment LINK2(hinge joint, single degrees of freedom)

With the rotation and movement of a Joint, the segment and the child nodes associated with also undergo the rotation and movement. In this example, LINK1 is the segment of JOINT1 while JOINT2 is its child node.

bou_2.jpg

Making of Configuration and World file

Lets create the configuration file to read the model we created above.

$ emacs robot_test.xml

robot_test.xml

Lets create the world model to use the configuration file of the model.

DynamicsWorld.xml

The dynamics of the robot model is set as "TRUE"

Upload the World File to SIGViewer

Let's run without any controller first. Just to see how it looks like:

$ sigserver.sh -w ./DynamicsWorld.xml

You can see the bar If you look in connection with the SIGViewer. Then click the bar by clicking the "Entity Data" in the tray at the bottom right. You can check the location information of the parts and joints.

bou_4.PNG
  • Red dot indicates the position of the entity. Position of entity means, the position of root joint i.e. JOINT0.
  • Blue is the position of the JOINT2.
  • Green is the position of the part (Segment).
bou_1.PNG

Bar stands straight in the beginning, but when we start the simulation, its joints collapse and bend under the influence of gravity after a while.

Controller

Let's create a controller for applying a torque to the joint.

$ emacs DynamicsController.cpp

DynamicsController.cpp

Here we apply torque to the hinge joint using the SIGVerse API function addJointTorque. Specify torque using name of the joint as first argument, the second argument in the first [N · cm]. This controller and make every one second to "JOINT2" a torque of 500 [Nm] (0.01 seconds).

Lets compile the controller.

$ ./sigmake.sh DynamicsController.cpp

World file modification

Please add the executable in the xml world file.

<set-attr-value name="implementation" value="./DynamicsController.so"/>

Thus, the world file shall look like below:

DynamicsWorld.xml

Uploading the world file to SIGViewer

Its time to run.

$ sigserver.sh -w ./DynamicsWorld.xml

When you start the simulation, you will notice that the Joint bents slowly, under the influence of gravity. Butsince the addition of the torque, the joint will bend like a brick at the same time as the start of the simulation this time.

bou_2.PNG

Setting of the angular velocity of the joint

We added a torque to the joint on the controller earlier. The following sets the angular velocity of the joint. Please replace the function to torque to joints with a function to add velocity to the joints.

DynamicsController.cpp

    ↓

We set the angular velocity of the joint using the API function setJointVelocity. The function takes joint names as the first argument, the second specifies the angular velocity [rad / s]and third specifies the maximum torque [N · cm] which is added to reach the angular velocity to its specified value.

You will reach quickly to the angular velocity that you specified when you specify a value greater to maximum torque.

It is now time to compile and run.

$ ./sigmake.sh DynamicsController.cpp
$ sigserver.sh -w ./DynamicsWorld.xml
bou_3.PNG

Joint continues to rotate at a constant speed after it falls over the ground.

Counter: 2872, today: 2, yesterday: 1

Attach file: filebou_1.PNG 1569 download [Information] filebou_4.PNG 1501 download [Information] filebou_2.PNG 1465 download [Information] filebou_3.PNG 1438 download [Information] filebou_2.jpg 1540 download [Information]

Front page   Edit Freeze Diff Backup Upload Copy Rename Reload   New List of pages Search Recent changes   Help   RSS of recent changes
Last-modified: 2014-06-23 (Mon) 09:22:18 (3595d)