HowTos

From YARS

Jump to: navigation, search

Contents

Install

Starting up a simulation (with an example xml file)

Yars generates an ODE simulation based on the definitions in an xml file. Once you compiled yars, you might want to check one of the example files included. Make sure yars is in your path, and then type:

yars -d NAMEOFSIMULATION.xml --nocomm

The --nocomm stands for a stand alone instance of yars, without communication to other components, as for example an evolution component, or a network controller component.

Be sure to check all the -- possibilities (--notex, --noshadow, ...) with yars -help.

If the xml file is given as last option in the list of options, the -d can be omitted:

yars NAMEOFSIMULATION.xml
yars --nocomm --notex NAMEOFSIMULATION.xml

Setting up a simulation (editing an xml environment definition file)

In this section, you find an outline on how to write your own xml files, including environments and moving robots. An example file is also dissected.

A short outline of the most important components on the xml describing a simulation could be:

  • SIMULATION
    • Every simulation is composed of an environment and movable obects, as well as and a set of simulation properties.
  • An ENVIRONMENT
      • is composed of object primitives present that are fixed in world (absolute) coordinates.
  • A MOVABLE
  • can be active (e.g., a robot) or passive (e.g., a bouncing ball).
    • An ACTIVE movable
      • is usually composed of primitive solids, that form the body of the movable, along with its sensors and joints.
      • can interface with a network controller, sending sensor info and receiving motor commands.
      • can bump on the environment, sending a signal.
    • A PASSIVE movable
      • has Hammiltonean dynamics (link wikipedia) according to its physical properties
      • can be detected (collision with the sensor ray, for example)
      • can bump (with the active)
    • A CONTROLLED movable
      • has Hammiltonean dynamics (link wikipedia) according to its physical properties
      • can be detected (collision with the sensor ray, for example)
      • can bump (with the active)
      • is not controlled by the communication interface, but by a dynamically loaded C++ library
      • the library receives all sensor informations, and has to provide commands for all actuators
    • A MOVING movable
      • has Hammiltonean dynamics (link wikipedia) according to its physical properties
      • can be detected (collision with the sensor ray, for example)
      • can bump (with the active)
      • is not controlled by the communication interface, but by a dynamically loaded C++ library
      • the library determines the three dimensional force vector, which is applied to the center of mass of the object

Sensors

  • ...

Joints

  • ...

Interface with external controllers

It is possible to define a trajectory for a movable object, in which one has a 'controlled' active movable. For example, one might define a trajectory of a fly-sphere consisting of an 8, by defining forces or velocities in an external file. This howto explains how this is done. (ToDo)



Changing the sky and environment textures

Think the inbuilt textures are boring? To change them is easy. They are 128x128 24bit bitmaps (.bmp), and are originally found in the [svnpath]/trunk/textures. All one has to do is overwrite those there, or, if one has a director .yarsrc in the homefolder, one overwrites the files in .yarsrc/textures. In the command line:

cp sky_new.bm sky.bmp

We are building a little textures repository, with many different textures. Check some of them at the screenshots section!

(More Here)



Communicate with YARS using Matlab

You can use Matlab to communicate with YARS by simply taking the Java client class (YarsCommunication) available in the svn (/trunk/contrib/udpComTestClients/java-test-client) and including it into Matlab using the "javaclasspath" command. Just add the path to the folder containing the class.

Then you can simply create a YarsCommunication object in Matlab and talk to it.

com = YarsCommunication()
com.connect('pyramidal.nbp.uos.de', 4500, 100000)

I added some custom functions to my YarsCommunication class to be able to get information about the dimensionality of sensors and effectors and to send motor commands / receive sensor signals. It's easiest to use the Java Vector Data Structure for communication with the YarsCommunication object. Matlab can create these data structures. Assume "mm" contains a Matlab vector of motor commands and you want to send them to the YarsCommunication object via the custom function "inAndOut" which receives motor commands and returns sensor values.

m=java.util.Vector();
for k = 1:nrM
   m.add(java.lang.Double(mm(k)));
end
ss=com.inAndOut(m);

"ss" then is a Java Vector containing sensor readings that can easily be transformed into the Matlab array type.

Personal tools