Wednesday, October 27, 2010

Oct.27 new LMS Forte cont.

4diac-ide clone from hg works. Forte from clone hg needs minor changes.
At moment many  more FBs are compiled by forte than LMS's limited memory can hold.
Changing configure.in and makefile.am so conditionally compiles only what LMS needs.

Initially a 64bit #define flag was not set in a forte file - which caused an error. (corrected)

Then added an use_lms conditional to configure.in and used in set-up shell script and makefile.am, so only function blocks needed by lms are compiled.

In process a hg clone repository has been set-up on Q a common hard drive, so changes to be pulled into the official web-hg version. Local clones are being tested on laptop, aa, and usb stick.

The goal is a set-up where different hardware device interfaces can be tested at the same time a version with finished hardware interface and function blocks is being created, tested and used in labs etc.

Monday, October 25, 2010

Oct. 25+ LMS Passive sensors and IEC61499 adaptors

Should IEC61499 adaptors be used /taught? 
Using:
  • LMS passive sensors 
    • raw value read = 0-1023, but FB interface output variables might return:
      • raw value
      • extracted value like True or False
  • All LMS Sensors
Commonality:
  • All Sensors:
    • INIT event:
      • reserves PORT# to the first sensor FB type
  • Passive Sensor Read Value
    • Sensor value read internally is always 0-1023
    • 0 if no sensor is plugged in
    • If FB says its touch sensor, but light sensor plugged no way to flag as an error


Oct.25 LMS 4DIAC-IDE and FORTE on a stick

Creating a version of 4DIAC-IDE and FORTE already set-up with LMS Palette.
It should be  a zip that can be used as soon as its extracted even on an USB stick.

4DIAC-IDE 
  • clone from hg (synchronize, test, export)
  • copy into 4DIAC-IDE directory:
  • template directory from hg 
  • typelibrary with default configuration FBs
    • working on lms palette to be included with:
      • OFF- turns the LMS off (=shutdown)
        • OFF is a shorter name than shutdown
      • LED- light sensor led
      • TOUCH
      • LT (reads light sensor value)
  • set preferences 
    • looking into using system variable for current path in 4diac-ide code: 
      • org.fordiac.ide.fbrtLauncher\src\org\fordiac\ide\fbrtlauncher\preferences\PreferenceInitializer.java
    • FORTE
    • FBDK 
  • export all lms /lms FB types

FORTE
Stage 1: (compile hg version)
  • clone from hg
  • copy in ecos include and lib directories under bin/lms directory
  • run setup_lms.sh
  • run bin/lms/make all 2-3 times until only get a compile error
  • change src/makefile.am to include the whole lms pallete and only FBs needed 
    • see if easy to add lms conditional variable to configure.in
  • E_SWITCH
  • E_CYCLE
  • E_RS
  • E_SR
  • E_CTU?
  • E_DELAY?
  • run bin/lms/make all 
    • Note: This executable will do nothing yet because  lmsmain.cpp still has the empty default code.
Currently HERE
    Stage 2: (compile to run on lms) 
    • copy in the src/arch/ecos/lms the minimum files needed:
      • lmsmain.cpp
      • arv_ctl.c / .h
      • i2c_at91sam7sxxx.c / .h
      • Buttons.c/ .h
      • Port reservation files (sensor INIT service)
    • run run bin/lms/distclean
    • run bin/lms/make all until no errors
    • Flash LMS NXT with forte.bin
    Stage 3: Ready for lms HW FBs and user exported FBs and FB downloads via deployment 
    •  start USB ethernet bat
      • would be nice if bat file could be connected into deployment directly
    • deploy application to LMS NXT

    Friday, October 22, 2010

    Oct.22 Back to project progress blogging

    Daily progress will go in blog
    ... now summary information is being collected in the portable wiki not in blog entries.

    Environment changes:
    Virtual Boxs (Win7, Ubuntu) and portable Wiki  on different USB devices
    Want 4diac/forte also on a fast USB.
    (so can document when waiting on VB to start) 
    Built hg versions
    4diac hg:
    1. hg clone
    2. import into Galileo (modelling tools) Eclipse 
    3. syncronise, test, export to build 4diac-ide
    4. copy into the built 4diac directory:
      • hg template directory
      • typelibrary directory which will be used for default 
      • know where an fbdk is for 4diac-ide preferences
    Forte hg on:
    1. laptop C: and H: drives
    2. Alex's PC C: and Q: drives
    • lms set_up shell
    • make all 
      • need to edit make file so only FBs needed are included
      • Lab Nov. 8 Di. Blinky (Flip-Flop) 45 Minutes''' - need tutorial
    • Problems: 
      • cygwin errors when on USB
      • Spaces in directory or filename cause cygwin problems
      • cd to pwd will be removed from lms shell script
    Flashed LMS with SAM-BA by downloading Lego Firmware and sending it to Lego
    • VT1 (win98) saw it was an ecos device although no drivers installed
    • Plugged lms into laptop with ecos - had no idea any device was attached.
    • Plugged into laptop (WinVista) nothing!
    • Plugged into Alex's PC (Win98) and nothing at first. Powered on with reset button pushed. Then Sam-ba recognized it.
    Noted links in wiki to:
    cmake (easier to have makefile configuration per application) - coming to 4diac in Nov. (I hope)
    and hg to set up a repository and branches for lms fb palette.


    in Virtual Box: Win7
    Can LMS be used with standard LMS SW and downloaded from a Virtual Box (VB)?
    1.  Lego Mindstorm NXT 2.0 Software is installed in VB (not on host= laptop)
         Goal to program LMS and download program
    Did Program the LMS provided RoboCenter >Machines>Color Sorter example

    Connected the LMS to the laptop:
    • Host (Vista) reaction:
      • Installed unknown device
      • Couldn't find in device list, but when turned off device list refreshed
    • VB reaction:
      • crashed  
        • when tried to switch back to it in full screen mode. 
        • first a message about needing more memory
      • would not restart - gave error
      • restart of vista system ok
      • after restart: Win7 VB started in safe mode
      • after Win7 restart - able to program again.
    • Finish program - save after every step
      • Just like it did 2 years ago when I first used LMS - the UI is very, very slow and you can see everything. In this case the motor blocks at the end. 
      • Finished - but not tested
    • Will want to compare to what event driven program would look like.
    Snapshot of VB
    • Connected LMS to VB (check under USB devices)
    • It kept going on and off
    • Finally managed to start download while it was detectect
    • And ColorSorter.rbt downloaded from VB on to the LMS!!!
    • (details: lms ACIN = USB Devices> unknown device 0694:002)

    Wednesday, October 13, 2010

    Oct.13 Lego, ecos, Samba and usb Drivers

    • Lego NXT Mindstorms 
    • ecos
      • Put the following files in their own directory. 
        •  usbser.sys 
          •  C:\WINDOWS\system32\drivers\usbser.sys
          • hint in an ecos forum about ecos slave devices:  "For windows, copy the INF file and the 'usbser.sys' driver from your version of Windows into a directory, plug in the device, and when prompted, navigate to the INF file."
        •  eCosUsbSerial.inf
          • C:\sourceware_ecos\ecos-3.0\packages\io\usb\serial\slave\v3_0\host\windows\ eCosUsbSerial.inf
      • When Windows asks for the local of the driver. Enter this directory name.
    • Samba
    • libusb-win32
      • to create your own usb .inf and .sys for any generic USB device
      • NOT needed for LMS
      • libusb can be used with any good .inf and .sys files for usb devices

    Wednesday, October 6, 2010

    Oct. 5 Sampling - ECycle

    Started using EDelays just to get the applications to work when trying out the algorighms using GUI on PC for simulation. But on real device need to sample at regular intervals. Since EDelays do not guarentee time between samples because of delay time to execute other Function Blocks. 

    Better Solution: ECycle - sends out request at regularly timed intervals. 
    Of course the sample rate chosen must be greater than the execution time of all FBs used in the cycle.

    Wednesday, September 15, 2010

    Sept.15 PNP built

    PNP model (Lego Bonus Model #4)  that will be used as starting point for the 3rd tutorial has been built. Took 4.5 hours over 2 days (3+1.5).