Hi,
   here is are few lines from one of the reports made at IT univ copenhagen, and it works pretty good.
 also after doin this try to run the oscilloscope program for matlab,given in chap6, i couldnt manage to run it.

MATLAB SETUP
We included the TinyOS folders to the Matlab environment so that it could be able to pick the functions specific to Matlab. This instruction follows the running of Matlab and going file -> Set Path. This will pop up a window with many options. We added "Add with subfolders" and gave it a path to "c:/tinyos/cygwin/opt/tinyos-1.x/tools/matlab". Here it is assumed that TinyOS is at C root folder. We then clicked save and closed the application to make the set path window disappear. We restarted the Matlab which this time gave us certain errors like 'defineTOSEnvironmet not found at startup'. The cause of this error was that the 'ncc -print-tosdir' command that is executed to automate the process of finding installation path of the TinyOS was not recognized. We typed 'edit startup' on Matlab prompt which opened startup.m file to be edited. We added two extra lines after [flag, value] = system('ncc -print-tosdir');

             flag = 0;

            value = 'C:/tinyos/cygwin/opt/tinyos-1.x/tos';

Then we saved the file.

On the Matlab prompt we typed 'edit defineTOSEnvironment' command to edit defineTOSEnvironment.m file to add some TOS paths to the system. Default setting is unable to execute due to above mentioned reason. So we added couple of lines after [flag, value] = system('ncc -print-tosdir');

            flag = 0;

            TOSDIR = 'C:/tinyos/cygwin/opt/tinyos-1.x/tos';

After saving this file too, we restarted the Matlab. The Matlab takes a little time to show 'groupID = DD' which is the verification of correct setting.

As a next step it is very important to configure java settings because Matlab uses java commands to communicate to motes connected to serial port. Class archive 'comm.jar' is needed to be added to class path for serial communication through java and for enabling many TinyOS classes that produce abstraction to mote communication in many ways. This is done by first downloading java communication API from java.sun.com. We just copied 'comm.jar' file present in downloaded material into 'c:\tinyos\cygwin\opt\tinyos-1.x\tools\java' folder and added line 'c:\tinyos\cygwin\opt\tinyos-1.x\tools\java\comm.jar' at the end of classpath.txt file that can be opened to edit through 'edit classpath.txt' command on Matlab. To add TinyOS library, we added the code 'c:\tinyos\cygwin\opt\tinyos-1.x\tools\java' at the end of 'classpath.txt'. This, though, is not enough to have full environment setup. We needed to tell the Java Virtual Machine (JVM), loaded by Matlab, the properties of serial port and environment setting of Java Native Interface (JNI). So we copied the 'win32com.dll' and 'getenv.dll' from downloaded comm API folder and 'C:/tinyos/cygwin/opt/tinyos-1.x/tools/java/jni' folder to 'C:\MATLAB7\sys\java\jre\win32\jre1.4.2\bin' folder. We added 'javax.comm.properties' file from downloaded comm API folder to 'C:\MATLAB7\sys\java\jre\win32\jre1.4.2\lib' folder.

It is important to compile the java files present in 'C:\tinyos\cygwin\opt\tinyos-1.x\tools\java\net\tinyos\matlab' folder. We added the 'C:\MATLAB7\java\jar\jmi.jar' to the system class-path to compile. One should not forget to add 'c:\tinyos\cygwin\opt\tinyos-1.x\tools\java\comm.jar' and 'c:\tinyos\cygwin\opt\tinyos-1.x\tools\java' to the system class-path to compile. This will compile java files that are needed to control Matlab through java. Various classes present in TinyOS API rely on these classes. MatlabControl.java is not compiled on the first shed. It has a bug that prevents it from being compiled. To prevent this bug, we replaced matlab.fevalConsoleOutput(command, args, 0, null) by matlab.fevalConsoleOutput(command, args);           
We than shutdown the Matlab session and started it again – now it is ready to be used to communicate with TinyOS motes.

cheers!!
Manu

On 10/26/05, t3lab <[EMAIL PROTECTED]> wrote:


i'm trying to use matlab with tinyos but i've very difficult with a set up of my matlab environment.

I've Matlab 6.5 on Windows platform.

I have followed the instructions of the tutorial "using matlab with tinyos (set up)"...  The first problem is at step 1: call "defineTOSEnvironment.m"

I'v found the file in tinyos-1.x\tools\matlab and I copy the file in /MATLABPATH/work/startup.m

but when I open Matlab I've an error: command of defineTOSEnvironment
[flag, TOSDIR]=system('echo $TOSDIR') don't work correctly.

In particulary TOSDIR=$TOSDIR and not /opt/tinyos-1.x/tos "that is correctly path"

Then I tryng to assign manually the correctly path to TOSDIR and I don't have any error.

But the problem is: everytime that i've system call to a unix command I've an error.

for example oscope application for Matlab don't work correctly.

I think because i've Matlab on Windows platform and not unix platform... is this the problem?

thanks for any suggestion.

Luigi









_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help



--
Luv Manu
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to