Thursday, May 6, 2010

May 6 Turn by angle

Lego Mindstorms NXT Servo Motor can be turned by a specific angle.
  • How? Read the value from the encoder.
  • How often and how to ensure often enough? via scheduling
The official Lego HW Specifications describe the pin connections between the motor via AVR to ARM7.

eCos Scheduler we are using is described in:
Embedded Software Developement with eCos by A.Massa
search cyg_thread_create  (in avr_ctl.c)

Interesting   arm-elf-insight forte shows following at first
     359    inline Cyg_Thread *Cyg_Scheduler_Base::get_current_thread()
     360    {
-    361        return current_thread[CYG_KERNEL_CPU_THIS()];
     362    }


Scheduling in other firmware examples:
Lego Open source firmware
http://mindstorms.lego.com/ >> support >> files >> advanced >> under downloads right until find open source firmware
m_sched.c  (motor related: d_output.c d_output.r, c_output.c)


Lejos
in nxt_avr.c nxt_avr_1kHz_update( )
from systick.c systick_low_priority( )


(Motor related: platform\nxt\nxt_motors.c)

Links: How servo motor works
from http://www.robotadvice.com/lego-mindstorms-nxt_specification.html
"Servo (servo motor): is any kind of electric motor whose speed or position is controlled by a closed loop feedback circuit. An example is the drive motor in a floppy disk drive, which must maintain an exact rotational speed. The speed of the motor is measured by a tachometer that is physically coupled to the output shaft of the motor. The tachometer produces a voltage that is proportional to the speed. This voltage is compared to a reference point and the difference, or error, is used to adjust the speed of the motor, either up or down."

http://www.nxt-in-der-schule.de/lego-mindstorms-education-nxt-system/nxt-hardware/motoren
"Der neue NXT Servomotor hat einen integrierten Rotationssensor, der die genaue Geschwindigkeit und Entfernung messen und an den NXT zurückmelden kann . Das Design und die Handhabung ist auf das LEGO Technik Konstruktionssystem abgestimmt und ermöglicht einfaches und stabiles Bauen. Die Motoren können sehr präzise gesteuert werden und gleichen untereinander die Geschwindigkeit ab, während sich der Roboter bewegt. Der Motor kann in 1°-Schritten angesteuert werden."

Friday, April 30, 2010

*Apr.30 Duplicating Install / Dev.Env

Following will be what needs to be installed and how to be able to develop IEC61499
applications on more the one current development PC. Currently just list of tasks / notes.

Usual 4DIAC/ FORTE required SW
  • Java SE6
  • cygwin
  • 4DIAC (for LegoMS)
  • eclipse C++ (gnu-arm-elf g++);

see Quick set-up guide in Wiki

In addition to standard 4DIAC SW
Debug Environment
openocd for arm-elf-insight

    Thursday, April 29, 2010

    Apr.29 Motors FB clean-up

    Want to use Tacho to turn by degrees.
    Interrupts will probably be needed / desirable.

    Tacho Pin information:

    Apr.29 Buttons clean-up

    Buttons: 2 1 4     each button is a bit.

                         8

    Pressing 2 Buttons
    • Our eCos/lms only supports pressing 1 button.
    • and the raw button value is not available to user.
    • Usually button 1 = enter (orange) + another button is supported.
    Changes needed:
    • eCos avr_cntl add function to return the raw button value
      • will allow a user to add support for 2 buttons pressed via a FB as an exercise
    • add OR of states and test values for at least Button 1+ another button

    Wednesday, April 28, 2010

    Apr.28 CalibrateBnd Basic FB Tests on Brick

     Online Test used on LMS brick (in test) 
    Note: Starting with led off means the first sample is darker than the rest and should not be used.  cnt1 is now initialized to 0 and the 1st data sample is not added in.













    Basic Test used on LMS brick. 
    Note: leds 2 & 3 turned off since default state currently is on.  Delays help see results. GDB Debugger was not used/ necessary.

    *Apr. 28+ Port Manager FB

    A mechanism is needed to avoid:
    • multiple sensors types used on the same port
    • to encourage application developers to only use 1 FB for 1 physical sensor / motor.
    Related notes will collected here and formatted as the ideas become better formulated.

    Open Questions:
    • Can Port assignment / use be required / enforced using FBs?
    Simple Mgr can check if the port is taken and reserve the port#,  but no check if its used.
    • Should input ports (sensors) &output ports (motors) be managed together or separate?
    In other words should there be an Lego Brick FB or 2 port managers? Leaning toward 2 port managers at the moment.
    • Port / sensor Initialization at start-up or when first used?
    If the leds are initialized when the AVR is, then no need when the led FB is used.
    Extra work to initialize all 4 leds even if they are not used.

    Or should initialization be moved into FBs or allowed as an option?

    Sunday, April 25, 2010

    * Apr. 26 Firmware Flashing - general

    Lego Mindstorms 
    •  Update to latest Lego Mindstorms firmware
      • start Lego Mindstorms SW
      • open NXT window 
      • update firmware
    • to restore Lego Mindstorms firmware
      • connect the NXT to the PC 
      • start Lego Mindstorms SW
      • open NXT window 
        • The NXT brick should be available
      • push the reset button with a paper clip 
      • in Mindstorms SW do a firmware update
      • NOTE: If reset and then go into Mindstorms SW brick will not be available.
    Lejos
    • connect NXT to PC
    • upload the firmware via eclipse lejos button (top) or via cmd line
    eCos + Forte   
    Normal mode coming this week....
    currently only debug options
    see Apr.19 Samba mode Firmware flashing