RSBm » History » Version 3

« Previous - Version 3/29 (diff) - Next » - Current version
S. Wrede, 10/15/2011 11:13 AM


RSB.m

We are currently exploring the best way to expose RSB in Matlab. The most straightforward way to do this is to use the Java implementation directly from within Matlab. However, as the Matlab Java interpreter is not able to handle Java's Generic types, we need to wrap around some parts of the RSBJava API which use generics.

For this, a very preliminary support library for Matlab is available in the Trunk repository: https://code.cor-lab.org/projects/rsb/repository/show/trunk/matlab

It currently includes a simple example demonstrating the live plotting of rst.JointAngles data.

After installation of this library, the current steps in using RSB in Matlab are as follows:

Loading the Java libraries into Matlab

javaaddpath /vol/cit/share/java/RSBJava-0.5.0.jar
javaaddpath /opt/local/share/java/protobuf.jar
javaaddpath /vol/cit/share/java/rstsandbox.jar
javaaddpath /vol/cit/share/java/rst.jar
javaaddpath /vol/cit/lib/rsb.m-0.5.0.jar
rsb.matlab.ConverterRegistration.register()

The last call initializes the ProtocolBufferConverter instances with a few selected RST types. This mechanism will definitely be changed as it currently introduces an unwanted dependency (at this stage) to RST.

Notes

First successful test of sending data from Matlab to RSB:

>> javaaddpath /vol/cit/share/java/RSBJava-0.4.0.jar
>> javaaddpath /opt/local/share/java/protobuf.jar
>> f = rsb.Factory.getInstance()

f =

rsb.Factory@5c4e0c39

>> s = Scope('/example/informer')

s =

/example/informer/

>> i = f.createInformer(s)
No rsb.conf found in configuration directory '/Users/swrede/.config'
No rsb.conf found in working directory '/Users/swrede/Documents/MATLAB'

i =

rsb.Informer@75222b8e

>> i.activate
18.07.2011 18:21:22 rsb.Informer$InformerStateInactive activate
INFO: Informer activated: [Scope:/example/informer/,Type:String]
>> i.send('RSB')

ans =

Event[id=4145dcfd-aff7-45de-b00f-0c6c315f0ce7, scope=/example/informer/, type =String, metaData=MetaData[senderId = 4d619c1a-b516-4474-9eed-eb216546ff01, createTime = 1311006099963000, sendTime = 1311006099966000, receiveTime = 0, userTimes = {}, userInfos = {}]]