marvin:ecp5
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
marvin:ecp5 [2009/01/28 14:07] – deva | marvin:ecp5 [2009/01/29 10:58] (current) – rieper | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | =====Stikord===== | + | <texit info> |
- | * Stadigt voksende klassediagram | + | author=Johnny Rieper, Bent Bisballe Nyeng and Kasper Sohn |
- | * Bluetooth | + | title=Marvin - The Balancing Robot. |
+ | </ | ||
- | ======End course project, lab report 5====== | + | ======Lab report 5 - Bluetooth controlled robot====== |
**Date:** January 19nd 2009\\ | **Date:** January 19nd 2009\\ | ||
**Duration of activity:** 8-16\\ | **Duration of activity:** 8-16\\ | ||
Line 9: | Line 10: | ||
=====Project Goal===== | =====Project Goal===== | ||
- | Make robot communicate | + | Make robot remote controlled from the PC through bluetooth. |
=====Plan===== | =====Plan===== | ||
* 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 a simple | + | * Make PC bluetooth |
- | =====Stikord===== | + | =====Theory==== |
- | * Stadigt voksende klassediagram | + | ====The Protocol==== |
+ | {{ : | ||
- | ======End course project, lab report 6====== | + | From wikipedia: //" |
- | **Date:** January 20nd 2009\\ | + | LeJOS has built an entire framework for bluetooth communication, |
- | **Duration of activity:** 9.30-16\\ | + | (([[http://lejos.sourceforge.net/ |
- | **Participants:** Kasper, Bent and Johnny\\ | + | 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:// |
- | =====Project Goal===== | + | 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/ |
- | Make robot remote controlled. | + | |
+ | 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. | ||
- | =====Plan===== | + | We experienced a lot of slowdown in the balancing thread whenever the bluetooth |
- | * Make pc bluetooth | + | We later discovered that the problem could be worked around by disabling some of the other behaviour threads |
- | FIXME: Insert | + | Here is a movie of the resulting |
- | [[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, | ||
- | + | =====Implementation===== | |
- | =====The BTControl | + | ====The BTControl |
{{ : | {{ : | ||
- | Bluetooth control | + | Bluetooth control |
- | input stream, interpreting them as keycodes. | + | It reacts only on the keycodes |
- | It reacts only on the keycodes | + | |
- | down, left, right) and tells Marvin to drive accordingly. | + | |
^ Key ^ KeyCode ^ Variable | ^ Key ^ KeyCode ^ Variable | ||
Line 71: | Line 72: | ||
case directionLeft: | case directionLeft: | ||
left(200); | left(200); | ||
+ | |||
+ | |||
break; | break; | ||
Line 95: | Line 98: | ||
</ | </ | ||
- | And on the PC a window (JFrame) | + | ====The PCController Class==== |
+ | On the PC, we use a window (JFrame) | ||
<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