Ticket #80 (closed development: fixed)

Opened 20 months ago

Last modified 19 months ago

Support direct Bluetooth SPP interface from Instrumentation Control Toolbox (2011b)

Reported by: atorf Owned by:
Priority: high Milestone: v4.06
Component: Toolbox Function Keywords:
Cc: staas

Description

This ticket is a summary and rough guide on how to implement the new "direct Bluetooth SPP" interface of MATLAB 2011b's Instrumentation Control Toolbox. For details on this interface, see  http://www.mathworks.com/help/toolbox/instrument/bs5lmbi.html

For connection establishment, sub-function BT_OpenHandle in trunk/mfiles/COM_OpenNXTEx.m would have to be adapted, and maybe the code in COM_OpenNXTEx calling it. If new fields have to be added to our handle struct, see inside trunk/mfiles/private/createHandleStruct.m for the function closures.

With the new interface, the complete concept of "serial ports" is gone, as one directly talks to connected NXT devices. This means, the currently implemented idea Bluetooth-ini-files has to be revised. At the moment, it is "one config-file per virtual port", i.e. one config file for many possible NXT devices. Device selection happens via Bluetooth driver or a Linux script.

Without serial ports, config-files need to be "device specific", so they should contain an NXT device name or (better) its MAC (unique serial no.). Another way is to treat the new interface just as our current way to connect multiple NXTs via Bluetooth — i.e. via the extended syntax of COM_OpenNXTEx. However, then m-files are device-specific, and have to be adapted when used with different NXT devices. This was exactly the reason why "device independent config-files" were developed…


Anyway, once the design issue of how to manage NXT devices based on names or MACs is decided, and once connection handling is updated in COM_OpenNXTEx (especially BT_OpenHandle in there), the files trunk/mfiles/COM_SendPacket.m and trunk/mfiles/COM_CollectPacket.m can be updated (sub-functions BT_SendPacket and BT_CollectPacket). This should be straight forward and without a problem.


Key issue is the intended workflow for users: Where and how is the NXT device chosen that should be connected to? In earlier toolbox versions, we once had an "automatic BT connection feature" which was dropped later on for various reasons (see VersionGuide, ReleaseNotes and especially ticket #9 for a discussion).

In my personal opinion, it would be best to follow the idea of our btconnect-script trunk/tools/LinuxConnection/btconnect and try to implement this exact functionality somehow into MATLAB. Adding / mangling this functionality directly into COM_OpenNXTEx might make things more complex or break the workflow current users are used to. But that's just a "maybe", things would just have to be thought through and tested!


The main advantage of this effort would be better hardware compatibility and more stable Bluetooth support. In our early hardware tests from 2007 (BluetoothAdapter) we found that the combination Bluetooth + NXT + MATLAB is a very tricky one. While the LEGO NXT device is very picky with supported BT hardware anyway (LEGO's "fault"), even some of LEGO's recommended hardware failed with MATLAB. Hopefully with the new direct SPP interface, this additional limitation would fall, and the RWTH - Mindstorms NXT Toolbox would support all the BT hardware which runs with the LEGO NXT device!

The price for this possible improvement is the necessary development described in this ticket, and the introduction of a new dependency for users: MATLAB 2011b and the Instrumentation Control Toolbox. Previous toolboxes rely on 2008b and no additional toolbox!

Any comments are very welcome!

Linus Atorf

Attachments

Change History

Changed 20 months ago by behrens

  • cc staas added
  • add first workable 64Bit version of the toolbox with Changeset [980]
    • only minor changes had to be applied
    • it seems to be, that any number of NXTs (>2) could be connected to MATLAB (tested 3 NXT at the same time)
    • first tests with example demos and parcour bot worked as regular and precise
    • the handle of the serial port has only exchanged by using the new Bluetooth object (MATLAB2011b/Instrument Control Toolbox)
    • our handle struct seems to be so robust to handle this adapation
  • the ini file has been extended to the Name and the communication Channel of the NXT. This would mean the ini file would be specific to the used NXT (only under 64Bit). Right now the Bluetooth object is associated by the Name but could be extended to the MAC-Address. (There is an error of the description of MATLAB2011b:Bluetooth interface documentation, but I identified the bug). Haven't try to handle NXTs with the same name, yet.

Alex

Changed 20 months ago by staas

*The ini file has been extended with the MAC-address

*first Tests show good results in single and multi NXT mode

Changed 19 months ago by behrens

  • status changed from new to closed
  • resolution set to fixed
  • milestone set to v4.06
  • new MATLAB Bluetooth SPP interface from Instrument Control Toolbox v3.0 (2011b) is fully supported on 64Bit Windows machines in new toolbox release (r998) v4.06.

Add/Change #80 (Support direct Bluetooth SPP interface from Instrumentation Control Toolbox (2011b))

Author



Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.