marvin:ecp5
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
marvin:ecp5 [2009/01/28 16:37] – deva | marvin:ecp5 [2009/01/29 09:59] – deva | ||
---|---|---|---|
Line 17: | Line 17: | ||
=====The protocol===== | =====The protocol===== | ||
- | From wikipedia: //" | + | {{ :marvin:bluetoothlogo.png |The Bluetooth |
- | Lejos has built an entire framework for bluetooth communication, | + | |
- | (([[http:// | + | |
- | 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:// | + | |
- | 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 | + | From wikipedia: //" |
+ | LeJOS has built an entire framework for bluetooth communication, | ||
+ | (([[http:// | ||
+ | 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 has put a lot of effort into making the bluetooth | + | On the PC LeJOS has also made a bluetooth |
- | 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 | + | 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 later discovered that the problem could be worked around by disabling some of the other behavoir | + | |
+ | 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 | ||
+ | We later discovered that the problem could be worked around by disabling some of the other behaviour | ||
Here is a movie of the resulting remote controlled robot, with all other behaviours disabled:\\ | Here is a movie of the resulting remote controlled robot, with all other behaviours disabled:\\ | ||
[[http:// | [[http:// | ||
{{youtube> | {{youtube> | ||
+ | |||
+ | As it can be seen from the video, Marvin is not exactly reacting real-time to the control changes. This is due to the way the BTControl has been implemented, | ||
=====The BTControl class===== | =====The BTControl class===== | ||
{{ : | {{ : | ||
- | Bluetooth control | + | Bluetooth control |
- | It reacts only on the keycodes | + | It reacts only on the keycodes |
^ Key ^ KeyCode ^ Variable | ^ Key ^ KeyCode ^ Variable | ||
Line 66: | Line 70: | ||
case directionLeft: | case directionLeft: | ||
left(200); | left(200); | ||
+ | |||
+ | |||
break; | break; | ||
Line 90: | Line 96: | ||
</ | </ | ||
- | And on the PC a window (JFrame) captures keyboard input and redirects their keycode values to the bluetooth stream: | + | On the PC, a 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