The Bielefeld Type Library¶
The Bielefeld Type Library (BTL) is a collection of XML-based data descriptions that are exchanged between components (e.g. Icewing) or systems (e.g. BIRON). It provides functionality for parsing/creating data objects and is currently available in C++/Java.
We have invested some time to not break the extensibility of XML with this library, which is why you may refer to it as a collection of functionality more as of a type library. We do not want to support strong typing, please keep that in mind when using the BTL. Please feel free to contribute missing data sets or extend existing ones. There is a TypeList of the already available descriptions.
Usage¶
If you have decided to use the BTL you should get the latest release. The trunk version will work but...
There is a BTLFAQ.
Download¶
If you want to download a pre-built version, please check out the Files section .
Getting Started¶
We will try to give you a rather short intro on how to use the BTL here. If you feel something is missing, do not hesitate to write an issue/mail...
General Setup¶
You should install the BTL to the $prefix of your choice, which in many cases will be something like /MYPROJECT/trunk. For install instructions please refer to the README file or check the BTLFAQ. After the installation you will find a $prefix/lib/libbtl.so file as well as a $prefix/lib/java/btl.jar file.
Using the BTL in Java¶
You will need to import the data description you want to use, e.g. something like
... import nu.xom.Builder; import nu.xom.Document; import nu.xom.Element; ... import de.unibi.airobots.btl.common.Timestamp; import de.unibi.airobots.btl.data.NavigationGoalData; import de.unibi.airobots.btl.data.NavigationGoalData.GoalType;
XOM will be used for the XML handling later on. After that you can use e.g. the NavigationGoal
... NavigationGoalData goal = new NavigationGoalData(); final long timestamp = System.currentTimeMillis(); goal.setTimestamp(timestamp); goal.setGenerator("test"); goal.setX(-12.34); goal.setY(34123.45); goal.setYaw(1.234); goal.setCoordinateTolerance(0.45); goal.setYawTolerance(0.5); goal.setType(GoalType.GLOBAL);
If you want to send this goal e.g. using XCF, you can fill it into an XML document with XOM like this
Document doc = new Document(new Element(NavigationGoalData.getBaseTag())); goal.fillInto(doc.getRootElement());
You can handle all BTL descriptions similar to this one. If you want to create a NavigationGoal from XML (we are assuming a XOM Document again) you can do something like this
... Document doc; ... NavigationGoalData parsed = new NavigationGoalData(); NavigationGoalData.fromElement(doc.getRootElement(), parsed);
Using the BTL in C++¶
You will need to import the data description you want to use, e.g. something like
... #include "btl/NavigationGoalData.h" ... using namespace airobots; using namespace xmltio;
We are using XMLTIO for the XML processing. After that you can create a NavigationGoal like this
... NavigationGoalData goal("test", 230.34, -120, 0.623, 3.45, 0.2, NavigationGoalData::GLOBAL); goal.setTimestamp(Timestamp(123, 456));
And parsing, e.g. from a file, can be achieved like this
Location parsedLoc(readFile("NavigationGoal.xml"), NavigationGoalData::getBaseTag()); NavigationGoalData parsed = extract<NavigationGoalData>(parsedLoc);
Have fun!