MCA2 Puma Tutorial Chapter 2

From Mca2
Revision as of 13:16, 26 September 2012 by Musiol (Talk | contribs)

Jump to: navigation, search

GO BACK HOME

Contents

The user interface builder mcagui

The goal of this tutorial is simulating and controlling a puma robot. As a first step we will have a look at an Open Inventor 3D model of a puma robot which we will use for visualisation purposes. Download and unpack the linked zip archive into your puma project (~/mca2/projects/puma). A new directory OI will be available which contains the OpenInventor files.

Not everybody has a puma under his/her bed

Not everybody owns a real puma robot to get sensor values and use them for a 3D visualisation. In order to demonstrate the usage of mcagui and the open inventor model we will use a small programme that "simulates" the robot. Actually it just copies controller input values to corresponding sensor outputs (i.e. we are able to predefine and change all sensor values, which are in this special case the puma robot's joint angle values). The name of the program is reply_values and is part of the test project in MCA2.

To start a "simulation" that provides 6 sensor values (a puma robot consists of six joints) we just have to execute:

  reply_values num_values 6

Nothing will happen now, except that our simulation is running. Don't expect a gui to appear! Graphical user interfaces and control methods are completely separated in MCA2. We will start the GUI in the next step.

Moving tons with a small mouse

Our virtual robot is active now but does not do anything as it needs commands to perform tasks. Our user interface builder mcagui can be connected to all MCA2 programmes. That way sensor output values can be visualised and commands can be passed to the programmes via their controller inputs. We start mcagui by typing

> mcagui &

A grey window containing a menu bar, a tool bar, a status line, and a working area appears as shown in the following image

Tutorial1 2.1.png

We choose 3DRobotViewer from menu Plugins. A small black square (called a GUI widget) appears within the working area. Pressing ctrl + middle mouse button while the mouse cursor points on the black item activates the configuration window for this widget (Note that all widgets can be configured in this manner).

Tutorial1 2.2.png

Within the configuration window we select the tab Special. The button Change Robot reveals a file dialogue where we select the file ~/mca2/projects/puma/OI/PUMA260/puma260.iv which contains the OpenInventor model of the puma robot. Back in the configuration window (tab Special) the check box Headlight (on/off) needs to be checked. After pressing the button Show all the 3D model of a coloured puma robot is displayed by the widget:


Tutorial1 2.3.png

With ctrl + right mouse button the widget's size can be adjusted to the user's needs. With ctrl+left mouse button the widget can be moved within the working area. Widgets can be selected by ctrl + shift + left mouse button (e.g. for deletion), deselection is done by ctrl + shift + left mouse button somewhere in the working area.The ctrl + mouse button commands are available for all GUI widgets.

In the 3D widget objects can be manipulated using the mouse: Holding down the left mouse button, the objects can be rotated according to mouse movements. With the middle mouse button the objects can be moved and with the right mouse button the size of the objects can be changed.

The 3D model is now ready for reacting on sensor values. For that purpose the Widget Ports have to be connected to the IO Channels of the reply_values programmes. This can be done in the Sensors tab of the widget's configuration menu. Mark sensor 0 to sensor 5 in the left and WAIST in the right multi select list and press the --> button to connect the sensor values to the joint angles of the 3D model.


Tutorial1 2.4.png

In order to move the puma robot, the sensor values have to be changed. As already mentioned before, reply_values copies the controller input values to the sensor outputs which we have just connected to the 3DRobotViewer widget ports. If we connect sliders to these controller inputs we will be able to control the robot's joint angles. Item Slider in menu Actors places the corresponding widget onto the working area.


Tutorial1 2.5.png

Position and resize the new widget as you wish.


Tutorial1 2.6.png

Use the configuration dialogue to connect it to the back end as described in the following. Let us connect IO Channel actor 0 to the slider's Widget Port on tab Actors.


Tutorial1 2.7.png

After that we specify the minimum (0) and the maximum value (2*PI=6.282) of the slider on the tab Special .


Tutorial1 2.8.png

Moving the slider will now result in a rotation of the the robot's waist.

Repeat these steps for the other joints (actors 1-5). Now all axis of the puma robot can be changed by manipulation of the corresponding sliders with the mouse. To show the current values use six of the LCD-Widgets in the menu Sensors and connect them to the sensor values. Your user interface now should look like the following image:


Tutorial1 2.10.png

The user interface composed so far with all configured widgets can be saved to file by selecting Save in the File menu (You may use ctrl + s as a shortcut.). All mcagui files have the ending .mcagui. In order to load user interfaces which have been stored in files the File menu provides item Load.

After you have finished trying out your puma robot you should stop reply_values. This is especially important as any parts that have not been stopped will show up if somebody else works on your computer. So please always remember killing your parts like this:

> killall reply_values

Preparing OpenInventor files for mcagui

OpenInventor models have to be furnished with IO information to work with the mcagui plugin. For file puma/OI/PUMA260/puma260.iv this has already been done by the tutorial preparers. For different OI models you will have to do this yourself and therefore the steps necessary will briefly be outlined in the following.

The OpenInventor file containing the 3D model of the puma robot has been available on the internet. In order to adapt it such that mcagui knows which values correspond to which robot joint some simple adaptions have to be made. OpenInventor provides means to give transformations names. This can be done by typing DEF NAME in front of the key word Transform:

> DEF WAIST Transform {
>         rotation 0 0 1 1
> }

The mcagui plugin first of all looks for a rotation of which the value is unequal to 0. (The z-axis in the example above has a value of 1 and defines a rotation around the z axis, because the forth parameter is not 0.) If there is no rotation value unequal 0 (or no rotation value given at all), the specified transformation is taken:

> DEF Xpos Transform {
>        rotation 1 0 1
> }

Naming controller and sensor IOs

The IO names of the back end programmes are stored in the executables. mcagui reads out these names in order to display the descriptions in the configuration dialogues. Of course it makes sense to name the IOs waist, shoulder and elbow rather than sensor 0, sensor 1 and sensor 2. As the MCA programme reply_values, which we have been using so far, has been written for test purposes only generic standard IO descriptions are available.

The next chapter will explain how custom IO descriptions can be created.


< Back=== Forward>

Personal tools