1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
This file provides a very brief tutorial on how to use LCM from MATLAB
Requirements:
MATLAB
LCM Java bindings
Step 0:
Compile the Java bindings for the LCM message types that you intend to use.
These need to be placed in a JAR file.
This is typically done from outside of MATLAB, from a command-line shell, and
is the exact same procedure you'd follow if you wanted to use LCM from Java.
For example, if the message type definition file we want is located here:
../types/example_t.lcm
Then we could run the following commands:
$ lcm-gen -j ../types/example_t.lcm
Notice: enclosing LCM types without package into java namespace 'exlcm'.
$ javac -cp /path/to/lcm.jar exlcm/*.java
$ jar cf my_types.jar exlcm/*.class
This is summarized in the shell script "buildjar.sh"
Step 1:
Once you have the message types compiled to a JAR file, you can use them from
MATLAB.
To use a JAR file from MATLAB, you need to tell MATLAB where that JAR file
is. In this case, there are two JAR files: the one for the message types we
just compiled, and the one for the general LCM functionality.
Use the javaaddpath command for this.
>> javaaddpath /path/to/lcm.jar
>> javaaddpath my_types.jar
This is summarized in addjars.m
Step 2:
Now you can use LCM from MATLAB, along with the message types you've
compiled. See the example .m files for more details.
Since LCM in MATLAB uses the Java bindings, refer to the Java API
documentation as needed.
|