The Robot Programming Language Interpreter Written in the Logo Language, Journal of Achievements in Materials and Manufacturing Engineering 45/2 (2011) 194-203
VOLUME 45 ISSUE 2 April program, carried with the validation of trajectory points. In some procedures, words and lists, so it does not differ too much from of Achievements in Materials cases, an operator can use an application that will export each other high-level languages. The main advantage is the simplicity and Manufacturing Engineering 2011 point of the trajectory to the CAD program and will present the of the program, while the disadvantages include the fact, that in path in an intelligible form [3,5]. However this method fails if the most cases Logo language is available as interpreter. This means path is created in a dynamic way, based on the result of that during each procedure call, the program code is every time conditional statements in the program. In this case, you can try to re-translated line by line. This affects the speed of program examine all the alternative trajectories, but this would require execution. For this reason, some dialects of the Logo offer sophisticated tool for source code analysis and developing the compilation to the intermediate code ("p-code") or a standalone The robot programming language form of path presentation in the CAD application. Another way of compiler. solving this problem may be the translation of the robot program There are also implementations of the Logo language in to a description similar to the pseudo code, which could be which commands have been translated into the user national interpreter written in the Logo language interpreted in a certain graphical environment. In this case, it was language. Examples include Komeniusz/Comenius Logo, ACLogo decided to adapt the Logo language for the presentation of and Imagine. Translation of commands into the foreign languages manipulator’s trajectory. Compared to the other programming K. Foit* is a non-standard approach when compared to the other languages, the Logo is a convenient tool for use in the field of programming languages. On the one hand, it can help to Institute of Engineering Processes Automation and Integrated Manufacturing robotics, due to: understand the code, but on the other, the source code is not as Systems, Faculty of Mechanical Engineering, Silesian University of Technology, x simple syntax, derived from LISP, universal as in the case of other programming language. In the ul. Konarskiego 18a, 44-100 Gliwice, Poland x direct support for mapping the path on the computer graphics Fig. 1 the sample program written in Logo is shown. On the left device (turtle graphics), * Corresponding author: E-mail address: [email protected] side is the original Logo code and on the right side the Polish x original application of turtle graphics is an interface for translation is shown. Received 14.02.2011; published in revised form 01.04.2011 mobile robot control. In the next part of this work the concept of a simple system 2.2. Turtle graphics used to visualize the trajectory of the robot manipulator, using the
Logo interpreter, will be presented. Manufacturing and processing The turtle graphics is a part of the Logo language [11-15].
This graphics subsystem is very different from that used in the
other high-level programming languages. In the classic case, we Abstract 2. The overall description of the have a screen with a specific resolution. The points and lines Purpose: of this paper is to elaborate a simple system used to visualize the trajectory of the robot manipulator, approach defined in the absolute coordinates. The Logo language uses a using the interpreter written in the Logo programming language. The interpreter should be able to run on the virtual screen (sometimes called canvas), whose resolution is not directly linked with the capabilities of the graphics device. In older PC class hardware with limited RAM and CPU computing power. Design/methodology/approach: Compared to the other programming languages, the Logo is a convenient addition, it uses a component called the "turtle", which is tool for use in the field of robotics, due to simple syntax, derived from LISP, direct support for mapping the 2.1. The history of the Logo language characteristic for the turtle graphics. This little icon in the shape manipulator path on the computer graphics device (turtle graphics), and because the original application of turtle of a triangle or a turtle-like image (Fig. 2), is a kind of cursor, graphics was an interface for mobile robot control. The first Logo interpreter was created in 1967 at BBN which is controlled by the appropriate commands. Generally, the Findings: As the subject of further consideration, the Mitsubishi RV-M1 robot has been selected. Its laboratory, driven by three scientists: Bolt, Beranek and Newman, turtle moves in the relative coordinates, where the reference is the programming language, called Movemaster Commands, is very simply and in some aspects very similar to located in Cambridge, Massachusetts. The creators were Wally local coordinate system associated with the turtle. It is also regular BASIC programming language. This makes it useful for processing by the interpreter due to imperative Feurzeig and Seymour Papert. Two years later, at Massachusetts possible to move the turtle, giving the coordinates in relation to programming model. Institute of Technology, a turtle robot was created, as a Papert’s the global coordinate system (Fig. 3). The user decides which Research limitations/implications: The current, experimental version of the interpreter lacks some functions initiative. Original idea of turtle robot was designed under method should be used, but in most programming tasks, the first (for example workspace limits checking). Another disadvantage is that the application is dedicated to the auspices of Wiliam Grey Walter in the late forties of XX century. one is used more frequently. In later years Apple and Texas Instruments began a broad particular type of robot. Some problems may also occur during the graphical user interface design, because this part is not well implemented in the Logo. campaign to promote Logo as a programming language for beginners, especially useful for kids in primary schools. In this a) b) Practical implications: The result of the experiment is the computer application. The program is written in the way, this language has gained a reputation as trivial software for FMSLogo programming language. The developed application shares the interface with the FMSLogo. This is children. This opinion seemed to be confirmed by the presence of mainly due the fact, that the Logo is the interpreted language. turtle graphics. Originality/value: The program allows performing a simple check of the trajectory, and complements the
typical program editor. There is no need to use dedicated, high-price simulators. a) b) Keywords: Robotics; Simulation; Logo c)
Reference to this paper should be given in the following way: K. Foit, The robot programming language interpreter written in the Logo language, Journal of Achievements in Materials and Manufacturing Engineering 45/2 (2011) 194-203.
1. Introduction which allow testing the program - again for a specific type of 1. Introduction robot or a group of robots [1-10]. There are also complex Fig. 1. The example code in standard Logo (a) and its Polish Fig. 2. Some types of standard turtle shapes: a) default shape, simulation systems, such as RobCAD, which have a large base of localization (b) which could be found in almost all Logo implementation; b) the Robot programming is often done in high-level programming robots possible to handle in a virtual environment, but their main turtle from KTurle application - the part of KDE desktop language designed specifically for a particular type of robot. For disadvantage is the high price and fairy complex usage. However, Logo is derived from LISP and retains all the characteristics environment; c) the turtle from Curly Logo - a web implemen- the same reason dedicated simulation applications are created, in most cases, it is required to perform a simple check of the of that language. Programming in this language is based on tation of Logo
194 Research paper © Copyright by International OCSCO World Press. All rights reserved. 2011
Manufacturing and processing
program, carried with the validation of trajectory points. In some procedures, words and lists, so it does not differ too much from cases, an operator can use an application that will export each other high-level languages. The main advantage is the simplicity point of the trajectory to the CAD program and will present the of the program, while the disadvantages include the fact, that in path in an intelligible form [3,5]. However this method fails if the most cases Logo language is available as interpreter. This means path is created in a dynamic way, based on the result of that during each procedure call, the program code is every time conditional statements in the program. In this case, you can try to re-translated line by line. This affects the speed of program examine all the alternative trajectories, but this would require execution. For this reason, some dialects of the Logo offer sophisticated tool for source code analysis and developing the compilation to the intermediate code ("p-code") or a standalone form of path presentation in the CAD application. Another way of compiler. solving this problem may be the translation of the robot program There are also implementations of the Logo language in to a description similar to the pseudo code, which could be which commands have been translated into the user national interpreted in a certain graphical environment. In this case, it was language. Examples include Komeniusz/Comenius Logo, ACLogo decided to adapt the Logo language for the presentation of and Imagine. Translation of commands into the foreign languages manipulator’s trajectory. Compared to the other programming is a non-standard approach when compared to the other languages, the Logo is a convenient tool for use in the field of programming languages. On the one hand, it can help to robotics, due to: understand the code, but on the other, the source code is not as x simple syntax, derived from LISP, universal as in the case of other programming language. In the x direct support for mapping the path on the computer graphics Fig. 1 the sample program written in Logo is shown. On the left device (turtle graphics), side is the original Logo code and on the right side the Polish x original application of turtle graphics is an interface for translation is shown. mobile robot control. In the next part of this work the concept of a simple system 2.2. Turtle Turtle graphics graphics used to visualize the trajectory of the robot manipulator, using the
Logo interpreter, will be presented. The turtle graphics is a part of the Logo language [11-15].
This graphics subsystem is very different from that used in the
other high-level programming languages. In the classic case, we 2. The The overall overall description description of the of have a screen with a specific resolution. The points and lines the approach defined in the absolute coordinates. The Logo language uses a approach virtual screen (sometimes called canvas), whose resolution is not directly linked with the capabilities of the graphics device. In 2.1. The history of the Logo addition, it uses a component called the "turtle", which is 2.1. Thelanguage history of the Logo language characteristic for the turtle graphics. This little icon in the shape of a triangle or a turtle-like image (Fig. 2), is a kind of cursor, The first Logo interpreter was created in 1967 at BBN which is controlled by the appropriate commands. Generally, the laboratory, driven by three scientists: Bolt, Beranek and Newman, turtle moves in the relative coordinates, where the reference is the located in Cambridge, Massachusetts. The creators were Wally local coordinate system associated with the turtle. It is also Feurzeig and Seymour Papert. Two years later, at Massachusetts possible to move the turtle, giving the coordinates in relation to Institute of Technology, a turtle robot was created, as a Papert’s the global coordinate system (Fig. 3). The user decides which initiative. Original idea of turtle robot was designed under method should be used, but in most programming tasks, the first auspices of Wiliam Grey Walter in the late forties of XX century. one is used more frequently. In later years Apple and Texas Instruments began a broad campaign to promote Logo as a programming language for beginners, especially useful for kids in primary schools. In this a) b) way, this language has gained a reputation as trivial software for children. This opinion seemed to be confirmed by the presence of turtle graphics.
a) b) c)
which allow testing the program - again for a specific type of 1. Introduction robot or a group of robots [1-10]. There are also complex Fig. 1. The example code in standard Logo (a) and its Polish Fig. 2. Some types of standard turtle shapes: a) default shape, simulation systems, such as RobCAD, which have a large base of localization (b) which could be found in almost all Logo implementation; b) the Robot programming is often done in high-level programming robots possible to handle in a virtual environment, but their main turtle from KTurle application - the part of KDE desktop language designed specifically for a particular type of robot. For disadvantage is the high price and fairy complex usage. However, Logo is derived from LISP and retains all the characteristics environment; c) the turtle from Curly Logo - a web implemen- the same reason dedicated simulation applications are created, in most cases, it is required to perform a simple check of the of that language. Programming in this language is based on tation of Logo
READING DIRECT: www.journalamme.org 195
Journal of Achievements in Materials and Manufacturing Engineering Volume 45 Issue 2 April 2011
only a turtle graphics has remained. For many years, not much object in more realistic manner, but there is no advanced display. Therefore, it is possible to display advanced 3D attention was paid to the Logo, which was seen primarily as a techniques available like shadows or reflections. An example of animation and change the position of the observer without Y fd programming language in the early teaching of informatics. use of such features is shown in Figure 5. interrupting drawing of the image. In this way a high-quality 2D rt A few years back, new implementations of Logo began to and 3D graphics, comparable with Flash/Shockwave standard, can appear, and it was often enhanced with new capabilities, which be presented [13]. An example of the Elica Logo graphics is were not implemented in the language standard. Among them, a y shown in Figure 6. downpitch support for dialogs, sound and graphics files and new input/output t devices has been added. uppitch l One of the interesting extension, offered by several dialects Turtle nose logo is a support for the third dimension in turtle graphics. bk Currently, three systems allow the direct use of the third dimension. They are: FMSLogo, Elica and Logo3D. leftroll rightroll marker The FMSLogo is derived from the MSWLogo dialect and refers to the Berkley UCBLogo standard. Compared to the standard, FMSLogo includes the following extensions [14]: X x support for TCP / IP, x up to 1024 independent turtles, Fig. 3. Global coordinate system versus turtle coordinates system; x support for serial and parallel port, the turtle can be moved by FD/BK commands and rotated by x x event handling (mouse, timer, keyboard), z LT/RT commands x support for DLL handling,
x support for dialogs, Fig. 4. The standard view of the turtle in the PERSPECTIVE x support for 3D drawing. The turtle visibility is controlled by the two commands: Three-dimensional mode in FMSLogo is activated using the mode and meaning of the 3D control commands x HT - hide turtle, PERSPECTIVE command. In fact, the 3D mode is an extension x ST - show turtle. of 2D mode. The turtle is properly oriented in space, using the
Some implementations of the Logo allow to use more than LEFTROLL, RIGHTROLL, UPPITCH and DOWNPITCH The Elica Logo is an advanced 3D graphics system based on Fig. 5. The result of FMS Logo program that using one turtle at a time [14,15], so there could be introduced some commands. They determine the location of the turtle, and define Logo programming language. It has little in common with typical PERSPECTIVE and POLYGON modes along with the special additional commands for creating a turtle, selecting active turtle the plane where the turtle moves. In this way, in the Logo, being rather oriented on 3D graphics and animation. The turtles; Source: FMS Logo examples etc. Moreover, the turtle can have different shape, which is PERSPECTIVE mode still can be used the commands word Elica is the acronym for “Educational Logo Interface for
selected by the user. These two features could be useful for FORWARD, BACK, LEFT, RIGHT, etc. To point out that the Creative Activities”. Author claims that Elica is object oriented The Elica Logo also uses some special kind of turtles [15], creating animations. program is in PERSPECTIVE mode, a marker is added to the dialect of Logo [12]. Elica uses so called Easy Object which are organized in a manner of objects and inheritance. The The turtle has a pen, which can be "raised" or "lowered". default turtle icon. The marker also allows to identify the Declaration. It means that there is no any special syntax for object root is the generalturtle object, which defines the methods used Picking up the pen with the command PU allows the free orientation of turtle in space. The Figure 4 shows the standard - the object is distinguished from functions or procedures by by other, lower-hierarchy turtles. The children objects are the movement of the turtle on the canvas without leaving a trace, on view after activating PERSPECTIVE mode and the manner in interpreter. There is no difference between procedure, function spaceturtle and cameraturtle. The spaceturtle divides into the other hand, lowering the pen (using PD command) causes that which turtle is controlled by roll and pitch commands. and object by mean of declaration, so interpreter must analyze the traditionalturtle and sphericalturtle objects. The first one defines every movement of the turtle leaves a trail. This approach Referring to the absolute coordinates, the position of the turtle way in which the piece of code is used. Besides the use of objects, the normal, 2D oriented turtle, the second one is slightly different accurately reproduces the control of a real mobile robot equipped can be set using SETX, SETY, SETZ or SETXYZ command to Elica Logo has extended presentation abilities in comparison with because it act on sphere, not on the plane. The parent-child with a pen, which was one of the aims of the Logo language. In set the appropriate turtle coordinates. In addition, the FMS Logo. The Elica Logo is able to use the potential of the dependence of the objects is shown in Fig. 7. contrast to the real robot after reaching the borders of the canvas, SETHEADING, SETPITCH and SETROLL keywords set the graphics device installed in the computer to accelerate image the behaviour of the turtle is defined using one of three proper orientation of the turtle in space, referring to the absolute commands: angles. This raises the interesting possibility of using the language a) b) c) x FENCE - prevents the turtle crossing the edge of the canvas, specific to define not only the position of the characteristic point then an error is signalled, of the robot, but also to determine the spatial orientation of the x WINDOW - going beyond the area of the canvas is permitted, tool (e.g. gripper or welding tip). the turtle responds to commands, you can restore a lost turtle Using the PERSPECTIVE mode, there are three special on the canvas command HOME, turtles, which control the 3D scene [14]: x WRAP - after reaching the edge of the canvas, the turtle x the turtle #-1 - this turtle controls the point of view position, appears on the opposite side, in this case, the upper edge of i.e. the point, where observer is located; the orientation of the the canvas is "glued" with the bottom one and the right edge turtle does not matter in this case, with the left one. x the turtle #-2 - defines the focus point, i.e. the point which is observed from the position defined by turtle #-1; the 2.3. Turtle Turtle graphics graphics and third and dimension third orientation of this turtle also defines the direction of Y axis in dimension reference to the user screen; x the turtle #-3 - defines the position of the light, but its orientation does not matter; it can be used only in the Most of the older Logo interpreters have a turtle graphics, which uses only two dimensions - so the turtle can act only on the POLYGON mode. plane. This approach was quite natural at the time when the Logo Using these special turtles together with ordinary ones, gives has been used to control a real mobile robot. Later, the fully equipped environment for 3D drawing. Also there is Fig. 6. Some examples of Elica Logo graphics: a) simple 3D obects, b) 3D graphics with lights, shadows and color background, programming language has been isolated from the turtle robot and possibility to use simple rendering - this allows to present 3D c) advanced 3D graphics with textures and the fog (source: Elica Logo examples)
196 Research paper K. Foit
Manufacturing and processing
only a turtle graphics has remained. For many years, not much object in more realistic manner, but there is no advanced display. Therefore, it is possible to display advanced 3D attention was paid to the Logo, which was seen primarily as a techniques available like shadows or reflections. An example of animation and change the position of the observer without Y fd programming language in the early teaching of informatics. use of such features is shown in Figure 5. interrupting drawing of the image. In this way a high-quality 2D rt A few years back, new implementations of Logo began to and 3D graphics, comparable with Flash/Shockwave standard, can appear, and it was often enhanced with new capabilities, which be presented [13]. An example of the Elica Logo graphics is were not implemented in the language standard. Among them, a y shown in Figure 6. downpitch support for dialogs, sound and graphics files and new input/output t devices has been added. uppitch l One of the interesting extension, offered by several dialects Turtle nose logo is a support for the third dimension in turtle graphics. bk Currently, three systems allow the direct use of the third dimension. They are: FMSLogo, Elica and Logo3D. leftroll rightroll marker The FMSLogo is derived from the MSWLogo dialect and refers to the Berkley UCBLogo standard. Compared to the standard, FMSLogo includes the following extensions [14]: X x support for TCP / IP, x up to 1024 independent turtles, Fig. 3. Global coordinate system versus turtle coordinates system; x support for serial and parallel port, the turtle can be moved by FD/BK commands and rotated by x x event handling (mouse, timer, keyboard), z LT/RT commands x support for DLL handling,
x support for dialogs, Fig. 4. The standard view of the turtle in the PERSPECTIVE x support for 3D drawing. The turtle visibility is controlled by the two commands: Three-dimensional mode in FMSLogo is activated using the mode and meaning of the 3D control commands x HT - hide turtle, PERSPECTIVE command. In fact, the 3D mode is an extension x ST - show turtle. of 2D mode. The turtle is properly oriented in space, using the
Some implementations of the Logo allow to use more than LEFTROLL, RIGHTROLL, UPPITCH and DOWNPITCH The Elica Logo is an advanced 3D graphics system based on Fig. 5. The result of FMS Logo program that using one turtle at a time [14,15], so there could be introduced some commands. They determine the location of the turtle, and define Logo programming language. It has little in common with typical PERSPECTIVE and POLYGON modes along with the special additional commands for creating a turtle, selecting active turtle the plane where the turtle moves. In this way, in the Logo, being rather oriented on 3D graphics and animation. The turtles; Source: FMS Logo examples etc. Moreover, the turtle can have different shape, which is PERSPECTIVE mode still can be used the commands word Elica is the acronym for “Educational Logo Interface for selected by the user. These two features could be useful for FORWARD, BACK, LEFT, RIGHT, etc. To point out that the Creative Activities”. Author claims that Elica is object oriented The Elica Logo also uses some special kind of turtles [15], creating animations. program is in PERSPECTIVE mode, a marker is added to the dialect of Logo [12]. Elica uses so called Easy Object which are organized in a manner of objects and inheritance. The The turtle has a pen, which can be "raised" or "lowered". default turtle icon. The marker also allows to identify the Declaration. It means that there is no any special syntax for object root is the generalturtle object, which defines the methods used Picking up the pen with the command PU allows the free orientation of turtle in space. The Figure 4 shows the standard - the object is distinguished from functions or procedures by by other, lower-hierarchy turtles. The children objects are the movement of the turtle on the canvas without leaving a trace, on view after activating PERSPECTIVE mode and the manner in interpreter. There is no difference between procedure, function spaceturtle and cameraturtle. The spaceturtle divides into the other hand, lowering the pen (using PD command) causes that which turtle is controlled by roll and pitch commands. and object by mean of declaration, so interpreter must analyze the traditionalturtle and sphericalturtle objects. The first one defines every movement of the turtle leaves a trail. This approach Referring to the absolute coordinates, the position of the turtle way in which the piece of code is used. Besides the use of objects, the normal, 2D oriented turtle, the second one is slightly different accurately reproduces the control of a real mobile robot equipped can be set using SETX, SETY, SETZ or SETXYZ command to Elica Logo has extended presentation abilities in comparison with because it act on sphere, not on the plane. The parent-child with a pen, which was one of the aims of the Logo language. In set the appropriate turtle coordinates. In addition, the FMS Logo. The Elica Logo is able to use the potential of the dependence of the objects is shown in Fig. 7. contrast to the real robot after reaching the borders of the canvas, SETHEADING, SETPITCH and SETROLL keywords set the graphics device installed in the computer to accelerate image the behaviour of the turtle is defined using one of three proper orientation of the turtle in space, referring to the absolute commands: angles. This raises the interesting possibility of using the language a) b) c) x FENCE - prevents the turtle crossing the edge of the canvas, specific to define not only the position of the characteristic point then an error is signalled, of the robot, but also to determine the spatial orientation of the x WINDOW - going beyond the area of the canvas is permitted, tool (e.g. gripper or welding tip). the turtle responds to commands, you can restore a lost turtle Using the PERSPECTIVE mode, there are three special on the canvas command HOME, turtles, which control the 3D scene [14]: x WRAP - after reaching the edge of the canvas, the turtle x the turtle #-1 - this turtle controls the point of view position, appears on the opposite side, in this case, the upper edge of i.e. the point, where observer is located; the orientation of the the canvas is "glued" with the bottom one and the right edge turtle does not matter in this case, with the left one. x the turtle #-2 - defines the focus point, i.e. the point which is observed from the position defined by turtle #-1; the 2.3. Turtle graphics and third dimension orientation of this turtle also defines the direction of Y axis in reference to the user screen; x the turtle #-3 - defines the position of the light, but its orientation does not matter; it can be used only in the Most of the older Logo interpreters have a turtle graphics, which uses only two dimensions - so the turtle can act only on the POLYGON mode. plane. This approach was quite natural at the time when the Logo Using these special turtles together with ordinary ones, gives has been used to control a real mobile robot. Later, the fully equipped environment for 3D drawing. Also there is Fig. 6. Some examples of Elica Logo graphics: a) simple 3D obects, b) 3D graphics with lights, shadows and color background, programming language has been isolated from the turtle robot and possibility to use simple rendering - this allows to present 3D c) advanced 3D graphics with textures and the fog (source: Elica Logo examples)
The robot programming language interpreter written in the Logo language 197
Journal of Achievements in Materials and Manufacturing Engineering Volume 45 Issue 2 April 2011
The Elica Logo is quite fast interpreter, so there is no functions with parameters. On the other hand, many programming is invoked many times, compiling the program piece by piece 2.5. Using the Logo as the robot programming perceptible slowdown during use the graphics interface elements. languages have changed over time, tending to the object-oriented [11]. Generally, the most compilers consist of four components Of course, some operation may last longer, but generally, the programming (OOP) model. The object oriented and structural (Fig. 9): language interpreter
graphics display and animation are very smooth. The only programming are hard for interpreting, because of existing x the input stream handler, lexical analysis, token generator problem that the Elica Logo introduces is some lack of stability - structures like functions, procedures or objects, which should be or the “reader”, which handles the strings entered by the user there are some situations, when interpreter could cause errors or treated as a whole, but they consist of individual lines of code. using the keyboard or the other input devices and divides it Most of the modern robots’ controllers use the programming exceptions. Besides the intermediate code creation, which is very useful in into smaller parts: semantic units (tokens); at this stage it does languages, which are compliant with structural programming this case, there exists one more possibility - so called incremental not matter what is entered, but how to handle the entered model. As it was mentioned earlier, these languages are difficult compiler. The incremental compiler has some advantages of both: characters - in the simple words it divides strings into to process by the interpreter. The flat (imperative) model of interpreter and traditional compiler. The user is working in the meaningful substrings; this step is often presented as a part of programming is more common for older constructions and in this same way like with standard interpreter, but has a possibility to parsing in general and not shown as a separate process, case building the interpreter for these languages is less error- prone process. As the subject of further consideration, the use structural or object-oriented programming model. The x the parser is a part of compiler, where substrings given by the Mitsubishi RV-M1 robot has been selected. Its programming principle of incremental compiler is the fact, that it treats function, previous step were analyzed and compared to the syntactic language, called Movemaster Commands, is very simply and in procedures and objects as a complete structure. It means that these rules of the language; also the semantic analysis is done, some aspects very similar to regular BASIC programming structures are compiled on the fly, right after entering them. The x the code generator does the translation work; the parsed code language [16]. The syntax of sample line of code is shown in user can change some part of code, and there is no need to is replaced with appropriate instructions of the target Figure 10. recompile the entire program, but only the changed part of it. This language,
gives the answer for question, how Logo - as the high-level x the runtime libraries contain a part of code, which is needed programming language, containing structures like procedures, to execute the generated code (error and input/output functions and even object - could be interpreted. After opening by handling, cooperation with the operating system etc.) - they 10 DW 10,20,30 the user the function or procedure definition, using keyword to, are not required at the compilation phase. Optional line the Logo interpreter opens an editor window (see Fig. 8), where Parameters Fig. 7. Turtle objects hierarchy in Elica Logo number the structure can be defined. Closing the editor window makes the Command structure (procedure, function or object) to be compiled, and after The last of the mentioned Logo system, which have support successful compilation, it will be available from the command DataData streamstream for three-dimensional graphics is the Logo3D. This software is line. The problem concerning this method is that incremental Fig. 10. The syntax of the example program line in Movemaster written in Java, so it requires Java Runtime Environment to run. compiler cannot check if keywords used in the procedure/function Commands robot programming language All the necessary files are included in the installer. This system is definition really exist. In fact, this cannot be done in simple rather experimental than for everyday use, mainly because there is manner, because the user can enter the appropriate definitions LexicalLexical analysisanalysis The line of program in the Movemaster Command language no documentation and due to some installation problem on the later. Due to structural model of Logo language, there is no can be preceded by an optional line number. Presence of the line newer operating systems. limited set of keywords, which can be used in the program code, number is interpreted by the control system as “check and store so any errors can be captured only at the program execution stage. the line for later use”. In this manner, a program is written. When ParsingParsing there is no line number, then the command is executed 2.4. T Thehe Logo Logo and and other other high-level high-level immediately. The program code is separated from the positions programmingprogramming languages languages memory, which is stored in the similar manner - every definition of the position has its own number and parameters. A position can Compiled code RTM libraries There are some examples of high-level language interpreters Compiled code RTM libraries be defined using teachbox or programming (see Fig. 11). written in Logo [11-15], because this language has quite simple Main window syntax allowing some syntactic construction, which are hard or impossible to code in other high-level programming languages. Due to “double interpreting” routine (an interpreter is written in + Logo, which is also interpreted language), they are relatively + slow, when compared to the machine-written (compiled) interpreters - so they have more demonstrational character than are aimed for everyday use. Editor window The programming language interpreter acts in the special manner, which allows checking the program correctness on the fly this button closes the window and - that means after every line confirmed by Enter/Return key. This stores the procedure/function in the memory allows executing the command immediately or storing it in a CodeCode executionexecution memory “container“. If the user runs a program, the interpreter translates it line by line into the machine code - then the code is executed. Almost all interpreters are working in this manner, but Fig. 9. The simplified operating principle of the compiler some are different. Some uses an intermediate code, which is a Fig. 11. The two, equivalent methods of positions defining form between high-level and compiled machine code (for example QBasic from Microsoft works in this manner). This is Fig. 8. The FMSLogo and the procedure or function editor The implementation of the incremental compiler in the Logo First method is the easiest one. Everything is done by moving very useful, when the language uses structural or object oriented window language depends on the complexity of the project. Usually the the robot’s manipulator, using jog keys, to the desired position, programming mode. In fact, the flat (imperative) model of programming languages using flat (imperative) model of and then storing it by pressing P.S key, entering position number programming is the best solution for real-time interpreting: The incremental compiler works in the same way as the programming are the easiest one for implementation as the and accepting it by the ENT key. The second method requires variables are defined globally and there are no procedures or traditional compiler - the difference is that incremental compiler interpreter or incremental compiler. entering Movemaster Commands instructions using a terminal.
198 Research paper K. Foit
Manufacturing and processing
The Elica Logo is quite fast interpreter, so there is no functions with parameters. On the other hand, many programming is invoked many times, compiling the program piece by piece 2.5. Using Using the theLogo Logo as the asrobot the programming robot perceptible slowdown during use the graphics interface elements. languages have changed over time, tending to the object-oriented [11]. Generally, the most compilers consist of four components programming language Of course, some operation may last longer, but generally, the programming (OOP) model. The object oriented and structural (Fig. 9): language interpreter interpreter graphics display and animation are very smooth. The only programming are hard for interpreting, because of existing x the input stream handler, lexical analysis, token generator problem that the Elica Logo introduces is some lack of stability - structures like functions, procedures or objects, which should be or the “reader”, which handles the strings entered by the user there are some situations, when interpreter could cause errors or treated as a whole, but they consist of individual lines of code. using the keyboard or the other input devices and divides it Most of the modern robots’ controllers use the programming exceptions. Besides the intermediate code creation, which is very useful in into smaller parts: semantic units (tokens); at this stage it does languages, which are compliant with structural programming this case, there exists one more possibility - so called incremental not matter what is entered, but how to handle the entered model. As it was mentioned earlier, these languages are difficult compiler. The incremental compiler has some advantages of both: characters - in the simple words it divides strings into to process by the interpreter. The flat (imperative) model of interpreter and traditional compiler. The user is working in the meaningful substrings; this step is often presented as a part of programming is more common for older constructions and in this same way like with standard interpreter, but has a possibility to parsing in general and not shown as a separate process, case building the interpreter for these languages is less error- prone process. As the subject of further consideration, the use structural or object-oriented programming model. The x the parser is a part of compiler, where substrings given by the Mitsubishi RV-M1 robot has been selected. Its programming principle of incremental compiler is the fact, that it treats function, previous step were analyzed and compared to the syntactic language, called Movemaster Commands, is very simply and in procedures and objects as a complete structure. It means that these rules of the language; also the semantic analysis is done, some aspects very similar to regular BASIC programming structures are compiled on the fly, right after entering them. The x the code generator does the translation work; the parsed code language [16]. The syntax of sample line of code is shown in user can change some part of code, and there is no need to is replaced with appropriate instructions of the target Figure 10. recompile the entire program, but only the changed part of it. This language, gives the answer for question, how Logo - as the high-level x the runtime libraries contain a part of code, which is needed programming language, containing structures like procedures, to execute the generated code (error and input/output functions and even object - could be interpreted. After opening by handling, cooperation with the operating system etc.) - they 10 DW 10,20,30 the user the function or procedure definition, using keyword to, are not required at the compilation phase. Optional line the Logo interpreter opens an editor window (see Fig. 8), where Parameters Fig. 7. Turtle objects hierarchy in Elica Logo number the structure can be defined. Closing the editor window makes the Command structure (procedure, function or object) to be compiled, and after The last of the mentioned Logo system, which have support successful compilation, it will be available from the command DataData streamstream for three-dimensional graphics is the Logo3D. This software is line. The problem concerning this method is that incremental Fig. 10. The syntax of the example program line in Movemaster written in Java, so it requires Java Runtime Environment to run. compiler cannot check if keywords used in the procedure/function Commands robot programming language All the necessary files are included in the installer. This system is definition really exist. In fact, this cannot be done in simple rather experimental than for everyday use, mainly because there is manner, because the user can enter the appropriate definitions LexicalLexical analysisanalysis The line of program in the Movemaster Command language no documentation and due to some installation problem on the later. Due to structural model of Logo language, there is no can be preceded by an optional line number. Presence of the line newer operating systems. limited set of keywords, which can be used in the program code, number is interpreted by the control system as “check and store so any errors can be captured only at the program execution stage. the line for later use”. In this manner, a program is written. When ParsingParsing there is no line number, then the command is executed 2.4. The Logo and other high-level immediately. The program code is separated from the positions programming languages memory, which is stored in the similar manner - every definition of the position has its own number and parameters. A position can Compiled code RTM libraries There are some examples of high-level language interpreters Compiled code RTM libraries be defined using teachbox or programming (see Fig. 11). written in Logo [11-15], because this language has quite simple Main window syntax allowing some syntactic construction, which are hard or impossible to code in other high-level programming languages. Due to “double interpreting” routine (an interpreter is written in + Logo, which is also interpreted language), they are relatively + slow, when compared to the machine-written (compiled) interpreters - so they have more demonstrational character than are aimed for everyday use. Editor window The programming language interpreter acts in the special manner, which allows checking the program correctness on the fly this button closes the window and - that means after every line confirmed by Enter/Return key. This stores the procedure/function in the memory allows executing the command immediately or storing it in a CodeCode executionexecution memory “container“. If the user runs a program, the interpreter translates it line by line into the machine code - then the code is executed. Almost all interpreters are working in this manner, but Fig. 9. The simplified operating principle of the compiler some are different. Some uses an intermediate code, which is a Fig. 11. The two, equivalent methods of positions defining form between high-level and compiled machine code (for example QBasic from Microsoft works in this manner). This is Fig. 8. The FMSLogo and the procedure or function editor The implementation of the incremental compiler in the Logo First method is the easiest one. Everything is done by moving very useful, when the language uses structural or object oriented window language depends on the complexity of the project. Usually the the robot’s manipulator, using jog keys, to the desired position, programming mode. In fact, the flat (imperative) model of programming languages using flat (imperative) model of and then storing it by pressing P.S key, entering position number programming is the best solution for real-time interpreting: The incremental compiler works in the same way as the programming are the easiest one for implementation as the and accepting it by the ENT key. The second method requires variables are defined globally and there are no procedures or traditional compiler - the difference is that incremental compiler interpreter or incremental compiler. entering Movemaster Commands instructions using a terminal.
The robot programming language interpreter written in the Logo language 199
Journal of Achievements in Materials and Manufacturing Engineering Volume 45 Issue 2 April 2011
A position is defined by entering the string: The differences between dialects of Logo may interfere with 3.2. General description of the interface and PD
or using as much as possible from the Berkley Logo standard, which commands
HE
200 Research paper K. Foit
Manufacturing and processing
A position is defined by entering the string: The differences between dialects of Logo may interfere with 3. Description of developed 3.2. General General description description of the of interface the and PD
HE
The robot programming language interpreter written in the Logo language 201
Journal of Achievements in Materials and Manufacturing Engineering Volume 45 Issue 2 April 2011
connected, then every command is redirected to the robot’s the Mitsubishi Movemaster RV-M1 robot, mounted on the [2] D. Reclik, G. Kost, The comparison of elastic band and B-Spline controller. Respectively, when the robot is disconnected, then laboratory stand (Fig. 15). 4. Conclusions polynomials methods in smoothing process of collision-free robot commands operate on the local program memory. For example, During the tests, the following aspects are checked: trajectory, Journal of Achievements in Materials and This paper presents a simple example of a simulator, used to giving the RN instruction cause the execution of the program by x opening and closing the connection to the robot, Manufacturing Engineering 29/2 (2008) 187-190. represent the trajectory of the robot manipulator. The Logo the robot, in case the robot is connected, or by the turtle, in case x procedures of positions/program download and upload, [3] J. ĝwider, K. Foit, G. Wszoáek, D. Mastrowski, The system language used in the experiment is quite useful tool to represent the robot is disconnected. On the other hand, the PRGUP, x for simulation and offline, remote programming of the automatic switching between the targets (the robot or the the robot moves, since one of purposes of its creation was to PRGDOWN, POSUP, POSDOWN instruction cannot work Mitsubishi Movemaster RV-M1 robot, Journal of simulator) during execution of the control the robot. without physical connection to the real robot, so their work is Achievements in Materials and Manufacturing Engineering RCONNECT/RDISCONNECT commands, The presented program is based on FMSLogo interpreter and divided into three stages: 25/1 (2007) 7-14. x compliance between simulated and the real trajectory, has been created as a tool to support the process of programming x connection to the robot, [4] K. Foit, The web-based programming interface for the x the results of the compilation of particular commands. a robot. One of the main goals is to run it on older computer x operation on the program or the positions (upload or Mitsubishi Movemaster robot, Journal of Achievements in hardware platforms. The form of the user interface and way of download), Materials and Manufacturing Engineering 27/2 (2008) 183-186. presenting the results of the robot program arises directly from the x disconnection from the robot, [5] J. ĝwider, K. Foit, G. Wszoáek, D. Mastrowski, The off-line properties of the used Logo interpreter. On the other hand x programming and simulation software for the Mitsubishi in the case of download operation, the program is compiled simplifying the graphical representation and the abandonment of Movemaster RV-M1 robot, Journal of Achievements in and the proper procedures are generated. the 3D model of the manipulator derive from the aim to shorten There is one exception, when the robot is connected before Materials and Manufacturing Engineering 20 (2007) 499-502. the process of writing the program - in this case, the focus has issuing these commands: In this case, the command, after the [6] G. Kost, R. Zdanowicz, Modeling of manufacturing systems been on the possibility of a direct Movemaster Command th operation, does not close the communication port. and robot motions, Proceedings of the 13 International language interpretation and generation on this basis of the The LISTPOS and LISTPRG commands use the Notepad Scientific Conference “Achievements in Mechanical and relevant procedures in Logo. The use of the graphics capabilities editor to display the code. The Logo interpreter uses the modal Materials Engineering” AMME'2005, Gliwice-Wisáa, 2005, of the Elica Logo dialect require prior establishment of the input window, so during listing the long program in the output [7] K. Foit, An introduction to the hybrid simulation - the relevant libraries, which contain needed descriptions of graphic box, there is no possibility to use scrollbars. Using the Notepad conception of the simulation system, Journal of elements of the virtual world. The Elica Logo does not provide for displaying the code is effective and simple method. Achievements in Materials and Manufacturing Engineering direct import of 3D graphics to the program code, while creating The program uses two turtles in parallel: one for displaying 39/2 (2010) 347-350. the appropriate converter would take considerable time. In this the tool position and orientation and the second for the tool status [8] G. Kost, D. Reclik, The 2 1/2D algorithm in robot case, the creation of a virtual world based on VRML/X3D is (Fig. 13). This is because FMSLogo does not support bitmap workspace analysis, Acta Mechanica et Automatica faster because a lot of 3D modelling software supports writing to transformations imposed on the turtle. In this way, one of the 2/3 (2008) 65-70. that format. turtles have a standard shape and reflects the orientation of the [9] M. Rohrmeier, Interactive simulation using virtual systems: The current, experimental version of the program lacks some tool, while the second one is associated with an icon that shows web based robot simulation using VRML, WSC'00 functions concerning simulation errors. There is no manipulator nd whether the robot gripper is open or closed. Fig. 14. The example trajectory drawn in the RoboSim program Proceedings of the 32 Conference on Winter Simulation, workspace limits checking, so it is on the user to remember about using the Logo platform San Diego, 2000, 1525-1528. them. Another disadvantage is that the application is dedicated to a) b) [10] S. Carpin, M. Lewis, J. Wang, S. Balakirsky, C. Scrapper, the particular type of robot (in this case the Movemaster RV-M1). USARSim: a robot simulator for research and education, To sum up, the use of the Logo programming language as the Proceedings of the 2007 IEEE International Conference on interpreter of robotic programming language is relatively easy in Robotics and Automation ICRE’2007, Roma, 2007, 1400-1405. comparison with the other high-level programming languages. [11] B. Harvey, Computer Science Logo Style, I-III, MIT Press, Some problems may occur during the graphical user interface http://www.cs.berkeley.edu/~bh/. design, because this part is not well implemented in the Logo th [12] P. Boychev, Elica Logo and Objects, Proceedings of the 7 language. This should be the reason for finding other solution, European Logo Conference EuroLogo 1999, Sofia, which could connect the power of Logo language with the smarter http://www.elica.net/site/papers/papers.html. user interface. [13] P. Boychev, Using Logo To Model And Animate, th Proceedings of the 10 European Logo Conference Fig. 13. The main turtle with the companion turtle, which shows the closed gripper (a) and the opened gripper (b) icon EuroLogo 2005, Warsaw, http://www.elica.net/ site/papers- References /papers.html. The example trajectory, which is a result of a simple program, [14] FMSLogo Manual, http://fmslogo.sourceforge.net/manual- is shown in Fig. 14. The turtle nose shows orientation of the tool [1] J. Li, S.H. Masood, Modelling robotic palletising process /index.html. (gripper). It should be mentioned, that in the prototype version of with two robots using queuing theory, Journal of [15] Elica Logo User’s Manual and Demos (a part of Elica Logo the program, there is no option to change the style or the colour of Achievements in Materials and Manufacturing Engineering system). the line. The application has been designed to be as simple as 31/2 (2008) 526-530. [16] Mitsubishi Movemaster RV-M1 User’s Manual. possible in order to run on almost all software platforms, including the old computer systems.
3.3. The tests of the application 3.3. The tests of the application using the real robot using the real robot Fig. 15. The Mitsubishi Movemaster RV-M1 laboratory stand The correctness of the results of the commands related to the real robot control has been verified in the Intitute’s Laboratory of The RoboSim application successfully passed all of the Automation and Robotization of Technological Processes, using mentioned tests, concerning the scope of implemented functions.
202 Research paper K. Foit
Manufacturing and processing
connected, then every command is redirected to the robot’s the Mitsubishi Movemaster RV-M1 robot, mounted on the 4. Conclusions [2] D. Reclik, G. Kost, The comparison of elastic band and B-Spline controller. Respectively, when the robot is disconnected, then laboratory stand (Fig. 15). 4. Conclusions polynomials methods in smoothing process of collision-free robot commands operate on the local program memory. For example, During the tests, the following aspects are checked: trajectory, Journal of Achievements in Materials and This paper presents a simple example of a simulator, used to giving the RN instruction cause the execution of the program by x opening and closing the connection to the robot, Manufacturing Engineering 29/2 (2008) 187-190. represent the trajectory of the robot manipulator. The Logo the robot, in case the robot is connected, or by the turtle, in case x procedures of positions/program download and upload, [3] J. ĝwider, K. Foit, G. Wszoáek, D. Mastrowski, The system language used in the experiment is quite useful tool to represent the robot is disconnected. On the other hand, the PRGUP, x for simulation and offline, remote programming of the automatic switching between the targets (the robot or the the robot moves, since one of purposes of its creation was to PRGDOWN, POSUP, POSDOWN instruction cannot work Mitsubishi Movemaster RV-M1 robot, Journal of simulator) during execution of the control the robot. without physical connection to the real robot, so their work is Achievements in Materials and Manufacturing Engineering RCONNECT/RDISCONNECT commands, The presented program is based on FMSLogo interpreter and divided into three stages: 25/1 (2007) 7-14. x compliance between simulated and the real trajectory, has been created as a tool to support the process of programming x connection to the robot, [4] K. Foit, The web-based programming interface for the x the results of the compilation of particular commands. a robot. One of the main goals is to run it on older computer x operation on the program or the positions (upload or Mitsubishi Movemaster robot, Journal of Achievements in hardware platforms. The form of the user interface and way of download), Materials and Manufacturing Engineering 27/2 (2008) 183-186. presenting the results of the robot program arises directly from the x disconnection from the robot, [5] J. ĝwider, K. Foit, G. Wszoáek, D. Mastrowski, The off-line properties of the used Logo interpreter. On the other hand x programming and simulation software for the Mitsubishi in the case of download operation, the program is compiled simplifying the graphical representation and the abandonment of Movemaster RV-M1 robot, Journal of Achievements in and the proper procedures are generated. the 3D model of the manipulator derive from the aim to shorten There is one exception, when the robot is connected before Materials and Manufacturing Engineering 20 (2007) 499-502. the process of writing the program - in this case, the focus has issuing these commands: In this case, the command, after the [6] G. Kost, R. Zdanowicz, Modeling of manufacturing systems been on the possibility of a direct Movemaster Command th operation, does not close the communication port. and robot motions, Proceedings of the 13 International language interpretation and generation on this basis of the The LISTPOS and LISTPRG commands use the Notepad Scientific Conference “Achievements in Mechanical and relevant procedures in Logo. The use of the graphics capabilities editor to display the code. The Logo interpreter uses the modal Materials Engineering” AMME'2005, Gliwice-Wisáa, 2005, of the Elica Logo dialect require prior establishment of the input window, so during listing the long program in the output [7] K. Foit, An introduction to the hybrid simulation - the relevant libraries, which contain needed descriptions of graphic box, there is no possibility to use scrollbars. Using the Notepad conception of the simulation system, Journal of elements of the virtual world. The Elica Logo does not provide for displaying the code is effective and simple method. Achievements in Materials and Manufacturing Engineering direct import of 3D graphics to the program code, while creating The program uses two turtles in parallel: one for displaying 39/2 (2010) 347-350. the appropriate converter would take considerable time. In this the tool position and orientation and the second for the tool status [8] G. Kost, D. Reclik, The 2 1/2D algorithm in robot case, the creation of a virtual world based on VRML/X3D is (Fig. 13). This is because FMSLogo does not support bitmap workspace analysis, Acta Mechanica et Automatica faster because a lot of 3D modelling software supports writing to transformations imposed on the turtle. In this way, one of the 2/3 (2008) 65-70. that format. turtles have a standard shape and reflects the orientation of the [9] M. Rohrmeier, Interactive simulation using virtual systems: The current, experimental version of the program lacks some tool, while the second one is associated with an icon that shows web based robot simulation using VRML, WSC'00 functions concerning simulation errors. There is no manipulator nd whether the robot gripper is open or closed. Fig. 14. The example trajectory drawn in the RoboSim program Proceedings of the 32 Conference on Winter Simulation, workspace limits checking, so it is on the user to remember about using the Logo platform San Diego, 2000, 1525-1528. them. Another disadvantage is that the application is dedicated to a) b) [10] S. Carpin, M. Lewis, J. Wang, S. Balakirsky, C. Scrapper, the particular type of robot (in this case the Movemaster RV-M1). USARSim: a robot simulator for research and education, To sum up, the use of the Logo programming language as the Proceedings of the 2007 IEEE International Conference on interpreter of robotic programming language is relatively easy in Robotics and Automation ICRE’2007, Roma, 2007, 1400-1405. comparison with the other high-level programming languages. [11] B. Harvey, Computer Science Logo Style, I-III, MIT Press, Some problems may occur during the graphical user interface http://www.cs.berkeley.edu/~bh/. design, because this part is not well implemented in the Logo th [12] P. Boychev, Elica Logo and Objects, Proceedings of the 7 language. This should be the reason for finding other solution, European Logo Conference EuroLogo 1999, Sofia, which could connect the power of Logo language with the smarter http://www.elica.net/site/papers/papers.html. user interface. [13] P. Boychev, Using Logo To Model And Animate, th Proceedings of the 10 European Logo Conference Fig. 13. The main turtle with the companion turtle, which shows the closed gripper (a) and the opened gripper (b) icon EuroLogo 2005, Warsaw, http://www.elica.net/ site/papers- RReferenceseferences /papers.html. The example trajectory, which is a result of a simple program, [14] FMSLogo Manual, http://fmslogo.sourceforge.net/manual- is shown in Fig. 14. The turtle nose shows orientation of the tool [1] J. Li, S.H. Masood, Modelling robotic palletising process /index.html. (gripper). It should be mentioned, that in the prototype version of with two robots using queuing theory, Journal of [15] Elica Logo User’s Manual and Demos (a part of Elica Logo the program, there is no option to change the style or the colour of Achievements in Materials and Manufacturing Engineering system). the line. The application has been designed to be as simple as 31/2 (2008) 526-530. [16] Mitsubishi Movemaster RV-M1 User’s Manual. possible in order to run on almost all software platforms, including the old computer systems.
3.3. The tests of the application using the real robot Fig. 15. The Mitsubishi Movemaster RV-M1 laboratory stand The correctness of the results of the commands related to the real robot control has been verified in the Intitute’s Laboratory of The RoboSim application successfully passed all of the Automation and Robotization of Technological Processes, using mentioned tests, concerning the scope of implemented functions.
The robot programming language interpreter written in the Logo language 203