Development of Programming
   Environment for LEGO
 Mindstorms NXT by Yampa


          Takahiro Ebana
     Supervised by Taro Suzuki

       University of Aizu
Basic knowledges

○Reactive Programming
 A programming method that dynamic react to changes of
 various informations such as input from user or the
 progress of time.

○FRP
 a technique to perform Reactive programming with a
 functional language.
 - Yampa is a FRP language based on Haskell.

○LEGO Mindstorms NXT
 the robot teaching material sold by LEGO company.
Background
○Why do I use Yampa?
 - An FRP language is not so really used
 - To show the example which I used an FRP
   language for
 ・

○Why do I use LEGO Mindstorms NXT as a control  
 object?
 - To cancel difficulty of errand of the control that
  I used bluetooth for
Design of programming environment:
            process flow
Process flow step in a time unit:
 1, Get input data from LEGO Mindstorms NXT.
 2, Convert input data to NXTInput.
 3, I hand NXTInput to signal function and run signal
   function.
 4, Convert NXTOutput to direct commands.
 5, Send direct command to LEGO Mindstorms NXT.
 6, Go next time unit(Back to step 1).

A program implemented in Yampa is repetition of this
processing.
Design of programming environment:
    data structure and modules
Data types
・NXTInput
 - The data type that has input from NXT
・NXTOutput
 - The data type that has a parameter to transmit to
   NXT
・SF NXTInput NXTOutput
 - The data type of the main body of program that a   user
 makes in this programming environment

Modules
・NXTMain
 - The centor of this programming environment
・NXTMotorInput/Output, NXTSensorInput
 - Control NXT motor and sensor
Implemantation:
  Run and stop signal function
These functions implemented in NXTMain.

・runNXTProgram
 - This function process 3 step:
  1, Connect NXT by bluetooth.
  2, Run signal function (maked user).
  3, Off bluetooth connect.

・endNXTProgram
 - The process of signal function is an infinite loop.
 - When user want to terminate signal function, use this.
Implementation : input

About a function to get input from a motor and a sensor.

The function to get input from LEGO Mindstorms NXT is signal
 function basically.
 - For example : SF NXTInput Int

There are two types of functions to acquire the input from
 motor and sensor.
 - Get input from a motor or sensor which specified a port
   number for the cause
 - Get input from a motor which specified a kind of motor or
   sensor for the cause.
Implementation : output
The output function performs the output to the motor mainly.

There is the case that is not so when the output function is
 Signal function.
 - There does not need to be it in signal function if they do
   not change output by time.

The procedure of the movement of the output function when I
 considered NXT to be a car is as follows.
 1, Get input data from left and right wheel.
 2, calculation
 3, Return output data (NXTOutput)
Because the function to acquire input is signal function, also
 this function is signal function.
Conclusions

I implemented a function that worked to run of a SF. By this
function, user can make efforts in only making of signal
function.
  Also I implemented any functions to operate motor and
sensor easily. By these functions, user can treat motor and
sensor without being conscious of a direct command.

Functions that I implemented this research tend to be basic
function.
 - It seems that I can build the programming environment
   that is easy to use more by adding more progressive
   functions.

Tw2010slide2

  • 1.
    Development of Programming Environment for LEGO Mindstorms NXT by Yampa Takahiro Ebana Supervised by Taro Suzuki University of Aizu
  • 2.
    Basic knowledges ○Reactive Programming  Aprogramming method that dynamic react to changes of various informations such as input from user or the progress of time. ○FRP  a technique to perform Reactive programming with a functional language.  - Yampa is a FRP language based on Haskell. ○LEGO Mindstorms NXT  the robot teaching material sold by LEGO company.
  • 3.
    Background ○Why do Iuse Yampa?  - An FRP language is not so really used  - To show the example which I used an FRP language for ・ ○Why do I use LEGO Mindstorms NXT as a control    object?  - To cancel difficulty of errand of the control that   I used bluetooth for
  • 4.
    Design of programmingenvironment: process flow Process flow step in a time unit:  1, Get input data from LEGO Mindstorms NXT.  2, Convert input data to NXTInput.  3, I hand NXTInput to signal function and run signal   function.  4, Convert NXTOutput to direct commands.  5, Send direct command to LEGO Mindstorms NXT.  6, Go next time unit(Back to step 1). A program implemented in Yampa is repetition of this processing.
  • 5.
    Design of programmingenvironment: data structure and modules Data types ・NXTInput  - The data type that has input from NXT ・NXTOutput  - The data type that has a parameter to transmit to NXT ・SF NXTInput NXTOutput  - The data type of the main body of program that a   user makes in this programming environment Modules ・NXTMain  - The centor of this programming environment ・NXTMotorInput/Output, NXTSensorInput  - Control NXT motor and sensor
  • 6.
    Implemantation: Runand stop signal function These functions implemented in NXTMain. ・runNXTProgram  - This function process 3 step:   1, Connect NXT by bluetooth.   2, Run signal function (maked user).   3, Off bluetooth connect. ・endNXTProgram  - The process of signal function is an infinite loop.  - When user want to terminate signal function, use this.
  • 7.
    Implementation : input Abouta function to get input from a motor and a sensor. The function to get input from LEGO Mindstorms NXT is signal function basically.  - For example : SF NXTInput Int There are two types of functions to acquire the input from motor and sensor.  - Get input from a motor or sensor which specified a port number for the cause  - Get input from a motor which specified a kind of motor or sensor for the cause.
  • 8.
    Implementation : output Theoutput function performs the output to the motor mainly. There is the case that is not so when the output function is Signal function.  - There does not need to be it in signal function if they do not change output by time. The procedure of the movement of the output function when I considered NXT to be a car is as follows.  1, Get input data from left and right wheel.  2, calculation  3, Return output data (NXTOutput) Because the function to acquire input is signal function, also this function is signal function.
  • 9.
    Conclusions I implemented afunction that worked to run of a SF. By this function, user can make efforts in only making of signal function. Also I implemented any functions to operate motor and sensor easily. By these functions, user can treat motor and sensor without being conscious of a direct command. Functions that I implemented this research tend to be basic function. - It seems that I can build the programming environment that is easy to use more by adding more progressive functions.