Wednesday, November 17, 2010

Nov. 17 Line Follower Algorithms / Beginners

Each week I meet with 2 friends, so they can learn about Lego Robot one of them recently bought.
Today we accidently found a simple algorithm that looks for the line and then follows it.
The line follower allows lots of algorithms.  First two friends downloaded, tried and looked at existing NXT-G programs. In the end they could somewhat follow the program, but could not make even minor changes successfully to the program. 
Today we started with basics. Motors block; Loop testing light sensor or looping forever;  If-then-else branch block.

[Picture of algorithm goes here]
The idea was:
Step 1: Go when see white, stop when see black. 
Loop while see white
Then stop
Step 2: Loop forever
If-then-else branch for light sensor:
IF white
THEN: forwards
ELSE: turn x degrees

We found when it found the line when x was around 45 degrees, the robot would follow the edge of the  line if it was on the correct edge for the direction it should go in. Since blue was seen as black, it lost the line at the blue box.

The Video shows the attempts starting with 90 degrees, then 45 degrees, then 25 degrees.

[VIDEO(S) COMING]

Monday, November 15, 2010

Nov.15 OpenOCD Flashing on AA PC

TODO
Get a version with export 4.0 working with FBs!
SEGWAY


1a. OpenOCD  is part of the gnuarm toolchain. 
OpenOCD does not have offical releases, but some stable releases are available. It was easiest to copy the OpenOCD in the on Alex's PC to my laptop and add it to the path. Unfortantely its not clear where this working version came from orginally.

1b.Support for mulitple versions of forte.bin at once.
Created a flash_forte_bin directory to copy forte.bin and forte to for use with openocd bat files.
New bat file:  cp_Oflash.bat
Now
C:\openocd\trunk3\testing\examples\SAM7S256Test\prj\sam7s256_flash_Q.cfg file is also hard coded to this directory.

2. CBC/Scheme

- plug in keyboard and display
--  result: CBC booted the same.
    It didn't seem to be aware of the keyboard or display automatically.
- kernel # for ubuntu10.4 is at least 2.6.32.9
-- if kernel is new enough the CBC Linux driver is included
--- (11/17 note: interesting the driver link is same those doggles needing usblib)
- Can't use CBCJVM - Racket has its on Racket machine bytecode

Botball has another language forum. Only Java seems to be doing anything.

Friday, November 12, 2010

Nov.13 How to update driver

1. Right click on the device and choose Update Driver
2. Again choose Update Driver and OK
3. Choose Browse my computer for driver software


4. Enter the directory with the .inf and .sys driver files
5. If driver is installed chose the second option and a list of installed drivers for the device will show-up.  Then you are ready to test in SAM-BA.


Nov.13 Can flash with Sam-BA from laptop!

 Again an already installed driver interfered. 
This time the (normal) LMS driver from Lego company.
So there will be separate blog entry for how to update a driver.

To install the driver and flash the lms using SAM-BA:
1. Plug in the lms in boot mode
2. The driver files directory with the  .inf and .sys files is found under:
 Program Files\ATMEL Corporation\AT91-ISP v1.13\sam-ba 2.9\drv
After installation this driver should show up in the device manager:
3. Open SAM-BA .
The first time the board at91sam7e256-ek must be choosen.
Then hoose the forte.bin to send to the lms to flash its memory.
 Unlock - yes  then afterward lock -no

Nov.12 eCos USB device

Refer back to the  Oct.13 Lego, ecos, Samba and usb Drivers

Two problems solved!
1. Two characters were exchanged in a new parameter in LMS_RMT_DEV.c
This caused usb to not be set-up correctly.
Symptom was the lms was not recognized as an eCos device

2. To install eCosUsbSerial driver
refer back to the  Oct.13 Lego, ecos, Samba and usb Drivers 

Origin of eCosUsbSerial.inf is probably from eCos itself. Specifically:
        packages/io/usb/serial/slave/current/host/windows: 
                                                           eCosUsbSerial.inf 
See:

The copy given us is in the directory \libusbdriver, but LIBUSB (sourceForge) is not needed.

On my laptop having installed the LIBUSB sourgeForge project confused matters. The usblib driver had to be replaced.

Nov.11 JTAG,openocd, arm-elf-insight revisted

Details so can change to use with forte not in 1 place or copy to a common place.

JTAG - the picture shows the connections best. Note the black line goes toward the outside.
openocd - FLASH.bat is hard coded to a specific directory with forte and forte.bin
uses
C:\openocd\trunk3\testing\examples\SAM7S256Test\prj\SAM7S256_flash.cfg  is also hardcoded to a specific directory.
Note: multiple openocd's installed so notice trunk3 is the version used!


arm-elf-insight from cygwin 
openocd.bat  must be running before arm-elf-forte is started.


In a cygwin window:
1. cd to directory with forte and forte.bin
2.  enter arm-elf-insight forte

     The gnu debugger opens
3. Connect to the device (run-->connect to device) using ethernet / localhost / 3333
4. Open console (view-->console) and enter:
  •      monitor reset
  •      monitor halt 
    • stop  button if want to restart this process later]
5. Set breakpoints  (view-->breakpoints)
- at most 2 breakpoints are allowed
- at most 1 breakpoint if you want to examine variables
6. Continue to start debugging




Sunday, November 7, 2010

Nov.5 forte.bin to get an eCos device

When/how is forte.bin is built, so the flashed Lego brick is recognized as an eCos device;  Not which driver is loaded, but that the PC knows a new device has been plugged in.

This is important because the usb download will not work if the Lego is known to the PC.

The following documents what is known so far.
0. Looked at the command to create the forte.bin in the 2 working versions and in current hg
- no difference that I could see (it was late)

1. Known as eCos device = works
Windows XP recognizes the Lego Brick as an eCos Device

* Summer lms version
* Forte Version of Dominik's from Oct. BUT
in lmsmain: 
  code to create lms device commented out
  added in his own main method

2. Unknown as an eCos device  = does not work
Windows XP does NOT recognize the Lego Brick as an eCos Device:
* hg forte out of the box with the same FBs as in Dominik's
* hg forte with lms device commented out
* hg forte with just code to blick led in the main
   (I hope device was commented out - but going on memory at the moment)
   [will check and update]
* my cleaned code version

3. Next tests = try and see if the flashed on Lego -forte.bin  goes from known to unknown or vice versa.
(Ran out of time Friday night.)

known to unknown
- Uncomment the code to create the device in the Dominik  version

unknown to known
- put the main, utilities and BT fb code in the current hg version

If neither test yields anything new... then start a code compare

4. Other info:
After flashing the Lego the device, take out the battery and put it back in.
After about 25-30 sec. the Lego will click. Then the PC will show the Lego as an eCos device or it never will know the Lego is plugged in.  The 25-30 sec. is slightly longer than the normal boot blinking in lmsmain. After this click the Lego is either known/never known, independent of the contents of lmsmain.