Tuesday, November 2, 2010

Nov.2 KISS CBC day

Dave Miller gave a quick introduction toBotball CBC robot.
Its UI is touch screen.   Download is similar to Lego NXT.
We did the typical first time things. Move the motors and follow a line.
The function to start the motors returns as soon as the motors are started.
Later a separate function can be set to wait for the motor function to complete.

BUT BC Botball has a very nice camera which works as a color light sensor.
The range of light is chosen from a spectrem, not restricted to ranges or 3 colors. 
Also you see a picture via the camera and can see what it is detecting.

For Thursday its hoped I can get a Scheme language interface workng on CBC.

Sunday, October 31, 2010

Oct.31 LMS 61499 Segway is possible now!

This application can be created now with the existing LMS FBs


 Hardware:
  • Light Sensor
    • red light turned on 
  • 2 Motors
    • adjusts based on PID
      • direction  forward/backwards base
      • duration based
  • Ultrasonic Sensor - not connected - used to look like a head.
Two topics:
1. NXT Segway description vs. actual results
2. What is needed for a lms event driven (IEC 61499- fordiac) Segway?


1. NXT Segway description vs. actual results
The NXTprograms NXT Segway with Rider   "This robot simulates a Segway PT "
The project construction was straight forward. With the exception of the axle between the wheels, parts were easy to find and could be used as is. The axle had to be modified. The 2 wheels are connected so they move together to avoid drifting to the side.

The Usage Information in the Building Instructions were extremely helpful.
The NXT-G program worked as described and is well commented. And was it was nice surprise it worked on both a solid tan and solid gray surfaces with normal lab lighting.


There are links to PID descriptions and alternative LMS self-balancing robots such as the
alternative NXTway with both light sensor and gyro sensor versions.
Fail safe: The program shuts off, if the PID value is not reasonable indicating it has probably fallen down.

The blue tooth version is unique to this construction.


2. What is needed for a lms event driven (IEC 61499- fordiac) Segway? 
The basic NXT-G code / algorithm  is:
  1. Initialize using the robot's initial value as the goal value
  2. Adjust motors forward or backwards based on the PID correction 
  3. If the correction value unreasonable - Stop

In theory this can work now in fordiac. The only known potential for error is, if the signal to motor is not sent timely. 1st Draft Application/Tests can use existing robot and lms FBs from summer.

FBs needed:
  • Provided: 
    • E_CTU,; 
    • F_NOT; 
    • E_DELAY (3 pre-calibration/balance warnings); 
    • E_CYCLE;
  • lms pallete: 
    • LED; 
    • LT (read light reflection); 
    • MOTOR (sent power setting)
  • utility/ cntlr pallete:
    • PID; 
    • BTW (is # BeTWeen 2 numbers)

Friday, October 29, 2010

Oct.29 clean lms Forte; laptop dev; NXT-G Segway

For break at the end: downloaded NXT-G NXT Segway with Rider  
It works on solid gray desktop and solid tan table. Trick is balancing it well by the third beep.


Note: Video edited and clipped with MPEG Stream Clip.

clean lms Forte - continued creating a clean version of lms forte with minimum files


Development on laptop

The main open issue is how to install drivers so it works and Vista funnies.

JTAG-edu : recognized by both Alex's PC and my laptop

On Alex's PC:
Samba ok following blog instructions for flashing
OpenOcd let me flash

On Laptop:
LMS:   recognized as a libusb-win32 device --> eCos USB Serial Device
It only shows up after the boot squence blinking if finished. When Forte adds the LMS_DEVice.
Sometimes thought eCos device was Lego... then could flash it through LMS Firmware update back to Lego. Still don't have a pattern how Windows choses a  device driver!

BUT Sam-Ba doesn't see it.  (main open issue!)
Sam-Ba 2.9 sees JLink, but not the .-.l--ö-------------------------------ööööööööööööööööööööö----ö-öö_
!
Miscellaneous Links: 
Flashing LMS with SamBa
Sam-Ba for Vista: (installed on laptop)
specifically:


Driver info: USB CDC/ACM Class Driver for Windows 2000, XP, Vista, 7

C++ style links: http://www.possibility.com/Cpp/const.html

Interesting "Examples":

MakerLegoBot: Lego Mindstorms NXT 3D Lego Printer

NXT Segway with Rider (also with tilt control via BT) 

Sideline: Dave Miller from KISS BoeBot is here and will hold a workshop Tue at TU and Th. at TGM.   Will possibly try to install (PLT) Scheme on CBC.

 

Oct. 28

Finished building the basic 4DIAC/FORTE on stick.
And used the 4DIAC on the stick to create and export 4 lms FBs (OFF, LED, TOUCH, LT).

4DIAC-IDE (minor) problems
same old problem:
It requires you exit and enter to see new Systems; Type groups; and export filter.
This can definitely confuse new users and is annoying, but must be included in Tutorials.

Blanked out  author field in properties of new SIFB, so no author tag was filled in. Exported the SIFB fine, but next time re-entered IDE it gave a java null pointer error. Added the tag in manually. It appeared to work at first, but may messed up some internal db. Now the type group never shows up in the drop-down when creating a new FB in Type Manager. However the group name can be typed in and appears to work fine.

LMS arch/ecos C++ style - #defines vs. constants
Used #define s in summer since that is what Atmel include uses. After short discussion.. if its a number then will change to a constant, if it reads or writes - then will use #define. However #define will be used in a method, except in lmsmain. For lmsmain, fast is more important, but using #defines lets the same code be used to initialize leds.

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