Up:Tutorial?     Previous:Exchange of messages between agents     Next:Image capture from agent's perspective

Control method for vision sensor

※This tutorial is compatible with v2.1.0 or later. I will explain how to use the vision sensor.

Environment scanning by vision sensor

I will introduce the sample file for the environment scanning using the vision sensor.

Creation of the controller

$ cd ~/MyWorld
$ emacs WatchController.cpp

WatchController.cpp

This sample is used to rotate the body with an angle which is received as message. I will define the angle in z-axis direction, this angle must be defined between -180[deg] and 180[deg].

Compiling

$ ./sigmake.sh  WatchController.cpp

A world file of a living room

$ emacs WatchWorld.xml

WatchWorld.xml

This is a world file of living room with humanoid robot (Robot-nii.xml), it includes also television and armchair.

In this world file the camera is attached to the robot's head. The direction and the position of the camera set as follows:

You can attach the camera to a specific part of the robot by using link parameter. In this sample, "HEAD_LINK" is used. You can find all parts name of the humanoid robot in this page Joint定義一覧?. If you attach the camera to the entity that doesn't have part or joint, the link cannot be used.

The camera position is the relative position to the link.

The camera direction and position can be set. In the sample below, camera direction is set to 45 degrees downward.

The camera aspect ration and fov can be set as well.

If these parameters are not set the default values are used.

ParametersValues
position"0 0 0"
direction"0 0 1"
link"(Root link name)"
aspectRatio"1.5"
fov"45" (degree)

If several cameras are set to one agent, IDs 1,2,3 ... are assigned.

Start

Let's start SIGVServer.

$ sigserver.sh -w ./WatchWorld.xml

The SIGViewer connects to the server and the simulation will be started. You can see the Agent standing in the living room.

watch_1.PNG

If you click on the robot, you will see the view of the vision sensor on the top left of the SIGVIiewer window as shown in the picture below.

watch_2.PNG

If you click on the top right button in the sub-window, main view and sub view will be switched.

watch_3.PNG

If you want to replace the sub-window, you have to click on its right-top button.

If you want to check the camera's position and rotation, you have to click on the entity button on the right-bottom of the viewer.

Watch_7.PNG

Camera's position and direction are shown as orange vector.

Next, you have to click on the message button on the right bottom of the viewer, then, write and send messages for the agent. In the example below, the message "90" is sent to the agent, which means rotate the agent with 90 degrees.

watch_4.PNG

Then, the agent rotates with 90 degrees and you can see the orange and the toy through the robot vision.

watch_5.PNG

Up:Tutorial?     Previous:Exchange of messages between agents     Next:Image capture from agent's perspective

Counter: 3609, today: 1, yesterday: 0

Attach file: fileWatch_7.PNG 1606 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-02-07 (Fri) 14:45:09 (2726d)