User Tools

Site Tools


marvin:ecp5

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
marvin:ecp5 [2009/01/28 17:35] devamarvin:ecp5 [2009/01/29 00:16] rieper
Line 15: Line 15:
   * Make a bluetooth client code Behaviour on the Marvin, that can receive numbers and act on them.   * Make a bluetooth client code Behaviour on the Marvin, that can receive numbers and act on them.
   * Make PC bluetooth application read from keyboard arrows to determine control direction.   * Make PC bluetooth application read from keyboard arrows to determine control direction.
 +
  
 =====The protocol===== =====The protocol=====
Line 20: Line 21:
  
 From wikipedia: //"Bluetooth is a wireless protocol for exchanging data over short distances"//(([[http://en.wikipedia.org/wiki/Bluetooth]])). The NXT hosts a bluetooth communication device, and is capable of communicating at up to approximately 10 metres distance.\\ From wikipedia: //"Bluetooth is a wireless protocol for exchanging data over short distances"//(([[http://en.wikipedia.org/wiki/Bluetooth]])). The NXT hosts a bluetooth communication device, and is capable of communicating at up to approximately 10 metres distance.\\
-Lejos has built an entire framework for bluetooth communication, over normal Java input/output streams.+LeJOS has built an entire framework for bluetooth communication, over normal Java input/output streams.
 (([[http://lejos.sourceforge.net/nxt/nxj/api/lejos/nxt/comm/BTConnection.html]]))\\ (([[http://lejos.sourceforge.net/nxt/nxj/api/lejos/nxt/comm/BTConnection.html]]))\\
 We do not want to go further into the details of the protocol itself, but the way the device is shared can eventually end up in data loss(([[http://lejos.sourceforge.net/nxt/nxj/api/lejos/nxt/comm/BTConnection.html]])). We however do not care about this, since we intend to use it to send loads of control keycodes to the robot without worrying whether they will all arrive safely at the destination.  We do not want to go further into the details of the protocol itself, but the way the device is shared can eventually end up in data loss(([[http://lejos.sourceforge.net/nxt/nxj/api/lejos/nxt/comm/BTConnection.html]])). We however do not care about this, since we intend to use it to send loads of control keycodes to the robot without worrying whether they will all arrive safely at the destination. 
  
-On the PC Lejos has also made a bluetooth interface. This works exactly the same as the one on the NXT, and we therefore simply had to make a connection (listening on the NXT and connecting on the PC) and then creating input/output streams, to make the communication work as intended. +On the PC LeJOS has also made a bluetooth interface. This works exactly the same as the one on the NXT, and we therefore simply had to make a connection (listening on the NXT and connecting on the PC) and then creating input/output streams, to make the communication work as intended. 
  
-Lejos has put a lot of effort into making the bluetooth communication easy to use, and the implementation were therefore quite straight forward. See the resulting code below.+Lejos has put a lot of effort into making the bluetooth communication easy to use, and the implementation were therefore quite straight forward. Observe the resulting code below.
  
 We experienced a lot of slowdown in the balancing thread whenever the bluetooth communication was running, and we had to disable it entirely at numerous occations to avoid the robot falling over.\\ We experienced a lot of slowdown in the balancing thread whenever the bluetooth communication was running, and we had to disable it entirely at numerous occations to avoid the robot falling over.\\
Line 92: Line 93:
 </code> </code>
  
-And on the PC a window (JFrame) captures keyboard input and redirects their keycode values to the bluetooth stream:+On the PCa window (JFrame) captures keyboard input and redirects their keycode values to the bluetooth stream:
 <code java> <code java>
 NXTComm nxtComm = NXTCommFactory.createNXTComm(NXTCommFactory.BLUETOOTH); NXTComm nxtComm = NXTCommFactory.createNXTComm(NXTCommFactory.BLUETOOTH);
marvin/ecp5.txt · Last modified: 2009/01/29 10:58 by rieper