Mirage Tips
From Tekkotsu Wiki
Contents |
This article is part of the Mirage collection.
Make An Object Movable/Immovable
To make an object movable, give it a non-zero mass. The larger the mass, the harder it will be to move the object. The default mass value is zero, which makes the object completely immovable.
cube scale=[100,100,100] location=[500,0,50] mass=5
Make An Object Non-Collidable
To prevent an object from generating collisions, give it an empty collision model. In the WorldBuilder you can do this by setting collision=false. The robot will pass right through the object as if the object didn't exist. This trick is particularly useful for "decorating" the ground with markings that we don't want the robot to stumble on.
cube scale=[100,100,100] location=[500,0,50] collision=false
Make a Ramp
You can make a ramp from a cube that is rotated and partially buried in the ground.
cube scale=[1200,500,200] location=[1000,0,-60] material=Blue orientation=roty(-pi/32)
To get the robot to climb the ramp, you will need to use a high rate of speed. In the Pilot, set pilotreq.forwardSpeed=500.
Make Your Own Materials
The built-in materials can be found in /usr/local/Tekkotsu/tools/mirage/media. You can define your own materials by adding files to your ~/.mirage directory. You can use any filename, with "material" as the extension. Multiple materials can be placed in the same file.
Here is how to use a jpeg or png file as a material. Let's use the kitten image shown at right. Create a ~/.mirage/images directory, and download the file kitten.jpg to that directory.
Now create the file ~/.mirage/MyStuff.material with the following contents:
material Kitten
{
technique
{
pass
{
texture_unit
{
texture images/kitten.jpg
rotate -90
}
}
}
}
Now you can use Kitten as a material in your Mirage worlds.
Mirage scans all the material files in your ~/.mirage directory on startup, so if you add or edit your material files you must restart Mirage for the changes to take effect; simply reloading the world is not sufficient.
Apply A Skin To An Object
You can use a jpeg or png file as a skin for an object by creating a material that uses that file (see previous item). Then use that material in your object definition. Example:
cube scale=[300,300,300] location=[500,0,150] material=Kitten
Change The Initial Location of the Robot
By default the robot appears in the world at location [0,0,0]. You can change this by supplying InitialLocation parameters to the Mirage device driver on the command line. For example, to start the robot 500 mm in the air, you would write:
./tekkotsu-CALLIOPE -c mirage.plist Drivers.Mirage.InitialLocation.2=500
Change The Initial Orientation of the Robot
Tekkotsu uses quaternions to specify 3D orientations. By default the robot appears in the world in a level attitude, facing north. This is described by the unit quaternion [0,0,0]. To change the initial heading of the robot you will want to rotate it around the z axis. Rotation by an angle θ can be accomplished with the quaternion [0,0,cos(θ/2)]. So, for example, if you want the robot to start out facing west, you would use the quaternion [0, 0, 0.707], which you would specify on the command line as:
./tekkotsu-CALLIOPE -c mirage.plist Drivers.Mirage.InitialOrienation.2=0.707
Run Multiple Robots in Mirage
It is possible to run multiple robots in a single Mirage world. First you must give each robot a unique id by editing the robot's project/ms/config/tekkotsu.xml file and changing the "id" value in the "wireless" section at the end of the file. The default id is 1; any integer value is fine.
Then, to connect all the robots to a single Mirage server you simply tell each Tekkotsu instance to connect to the same host, rather than to localhost. For example, suppose Mirage is running on a host whose IP address is 192.168.1.53. Start each Tekkotsu instance by writing:
./tekkotsu-CALLIOPE -c mirage.plist Drivers.Mirage.Host=192.168.1.53




