Totally outdated page
Brainstorming & Further Concepts
Firmware
Try using a different firmware than official standard NXT, like LeJOS / NXC / RobotC? There are hints to more precise motor control (TachoLimit problem potentially fixed in LeJOS) or better performance of direct commands / bluetooth transmission!
Communication
Check the MATLAB-Help for the command readasync. Can it help to reduce timeouts and lags? Can it be used for the above mentioned non-blocking functions?
USB
Add USB-Support, try to use as many existing BT-functions as possible (by using wrappers if necessary). Some code snippets, hints etc are collected on this temporary page: USBStuff
Bluetooth
Consider Bluetooth / serial port code from MathWorks' NXT toolbox to reduce Bluetooth timeouts (try using option NumRetries?)
The (sometimes optionally) passed Bluetooth-Handle (to functions) gets checked/validated far too often inside these functions. Checking/validating is only necessary at the lowest level, the other checks are a waste of performance…
Compatibility for multiple bluetooth handles / NXT connections at one time is not perfectly implemented: The settings SendSendPause etc. are unique and global, and should be defined PER connection, not only once. Workaround: Disable those pauses by setting to 0.
Motor Control
Note: Apparently we CAN access the PID regulation directly, as this post suggests ( http://forums.nxtasy.org/index.php?showtopic=2054&view=findpost&p=16463). Code-Sample:
def set_PID(motor,P,I,D): """Change the PID parameters >>> set_PID(motor,"\x78","\x78","\x78") Use only hexadecimal number in string !""" brick.write_io_map(131073,motor.port*32+22,P) brick.write_io_map(131073,motor.port*32+23,I) brick.write_io_map(131073,motor.port*32+24,D) update(motor,Update.PID_VALUES)
Note: John Hansen supported the module ids at http://news.lugnet.com/robotics/nxt/nxthacking/?n=14 to access the module directly, without request sequentially the modules
The interpretation should be MSB PP TT CC FF LSB —> 0xPPTTCCFF
PP: identify programmer TT: module type identification CC and FF: module version identificationThe module IDs are: CommandModuleID = 0x00010001 OutputModuleID = 0x00020001 InputModuleID = 0x00030001 ButtonModuleID = 0x00040001 CommModuleID = 0x00050001 IOCtrlModuleID = 0x00060001 SoundModuleID = 0x00080001 LoaderModuleID = 0x00090001 DisplayModuleID = 0x000A0001 LowSpeedModuleID = 0x000B0001 UIModuleID = 0x000C0001
As long as a new firmware update doesn't change this IDs, we are fine to use constants.
Own tests and example programs "DriveAlong" using the NXT-G software showed no different behaviour of the driving robot. The motors also switch into the coast mode after the defined rotation angle is set.
Software Design
Split GET-Functions into REQUEST and COLLECT parts again, making it possible to do calculations inbetween. I.e. add possibility for non-blocking (asynchronous) functions, as known from many sockets implementations.
textOut and
dec2hex are slow. String-handling is slow. What can be done? Consider various performance improvements, use the Profiler.
Version Discussions
Proposal for new toolbox commands with USB support, discussion about changes for toolbox version 2.00, see here: DiscussionRelease2.00 (16.5.2008)
Miscellaneous
Overview and comments about comparison between other solutions for MATLAB: Toolboxes from Chikamasa, The MathWorks
- This page provides a developer's notepad to discuss further concepts → Further Concepts (German)
